by256 / imagedataextractor Goto Github PK
View Code? Open in Web Editor NEWImageDataExtractor 2.0 - a Python library for electron microscopy image quantification.
Home Page: https://imagedataextractor.org
License: MIT License
ImageDataExtractor 2.0 - a Python library for electron microscopy image quantification.
Home Page: https://imagedataextractor.org
License: MIT License
Hi, I installed the latest version of imagedataextractor (2.0.4) and run the same codes as example. I found some sample images' scale bar could be detected, but some still failed. I have attached my codes and results below. I am currently learning this program, but I got stuck in the scale bar detection, I hope I can discuss this issue with you. Many thanks.
screenshot.docx
Hi, I am Alissa.
I manually measured the scale bar of example image. And I got pixel of 68.5. So I input the [ conversion = 200 / 68.5 ] for test.
Then I find that the results are different with the automatic extraction.
I tried the example-image on imageJ and the reults I got via manual conversion by both imagedataextractor and imageJ extraction are similar. But they have great difference with the results shown in example-notebook.
I am confused and I dont know the reason.
Anyway thank you for reading my question.
Hi,
Thank you for providing the imagedataextractor. I've been trying to use this for image extraction in chemistry-related literature recently. I noticed that example 2 of the online demo version in ChemDataExtractor v2, e.g., I Kinoshita et al., Dalton Trans. (2003), 1993-2003, 10.1039/b210420m was extracted using imagedataextractor, and I was using the imagedataextractor to extract it, and I'm having some difficulties, and I'd like to know exactly how to use it. Can you help with some detailed parameters?
Best wishes,
Xy
Hi there, nice work.
However, please it how can we implement new case image besides the examples given in your Jupyter Notebook?
Cos the last time i TRIED, IT GAVE THIS ERROR:
error: OpenCV(4.5.5) /io/opencv/modules/dnn/src/layers/convolution_layer.cpp:404: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'getMemoryShapes'
Kindly suggest an appropriate solution. Thank you.
Thank you!
Traceback (most recent call last)
in
1 im_path = './example-image.png'
2 device = 'cpu'
----> 3 data = ide.extract(im_path,
4 seg_bayesian=True, # Bayesian mode
5 seg_tu=0.0125, # uncertainty threshold beyond which to filter FPs
D:\hebida\lib\site-packages\imagedataextractor-2.0.4-py3.8.egg\imagedataextractor\extract.py in extract(input_path, seg_bayesian, seg_n_samples, seg_tu, seg_device)
61 images = [image]
62 for i, im in enumerate(images):
---> 63 em_data = _extract_image(im, seg_bayesian, seg_n_samples, seg_tu, seg_device)
64 if len(images) == 1:
65 em_data.fn = fn
D:\hebida\lib\site-packages\imagedataextractor-2.0.4-py3.8.egg\imagedataextractor\extract.py in _extract_image(image, seg_bayesian, seg_n_samples, seg_tu, seg_device)
130 sb_detector = ScalebarDetector()
131 segmenter = ParticleSegmenter(bayesian=seg_bayesian, n_samples=seg_n_samples, tu=seg_tu, device=seg_device)
--> 132 shape_detector = ShapeDetector()
133
134 # initialise EM data object
D:\hebida\lib\site-packages\imagedataextractor-2.0.4-py3.8.egg\imagedataextractor\analysis\shapedetect.py in init(self)
17 self.shapes_dir = os.path.join(os.path.dirname(os.path.abspath(file)), 'shapes/')
18 self.shapes_dict = None # key - name, value - image
---> 19 self.populate_shape_dict()
20
21 def match_shapes(self, mask):
D:\hebida\lib\site-packages\imagedataextractor-2.0.4-py3.8.egg\imagedataextractor\analysis\shapedetect.py in populate_shape_dict(self)
46 for shape_name in self.shape_names:
47 shape_image = cv2.imread(os.path.join(self.shapes_dir, '{}.png'.format(shape_name)))
---> 48 shape_image = cv2.cvtColor(shape_image, cv2.COLOR_BGR2GRAY)
49 shape_images.append(shape_image)
50 self.shapes_dict = dict(zip(self.shape_names, shape_images))
error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
I can read the image file
data = ide.extract(image_path)
and get a list of [EMData,EMData...] but any further action
seg = data.segmentation
uncertainty = data.uncertainty
fails as the 'list' object has no attribute 'segmentation'.
BTW as I am mainly interested in segmentation without downstream analysis, isn't there any option for that?
Hi OP,
I've managed to run imagedataextractor successfully and would like to use the contents in the fine tune file in the scalebar section to improve the detection rate of the scalebar. However I have some trouble with running the 'make training' line. I am running ide on windows 10 and the solutions that I have found so far are using Chocolatey to install the 'make' command or using a Linux subsystem, both of which I do not have any experience. Is there a guide on how to use that?
Thank you and I appreciate your help with the previous question I had for ide.
import imagedataextractor as ide input_path='ide1.jpg' dat = ide.extract(input_path)
`error Traceback (most recent call last)
in
1 input_path='ide1.jpg'
----> 2 dat = ide.extract(input_path)
~/anaconda3/envs/vineeth/lib/python3.6/site-packages/imagedataextractor/extract.py in extract(input_path, seg_bayesian, seg_n_samples, seg_tu, seg_device)
61 images = [image]
62 for i, im in enumerate(images):
---> 63 em_data = _extract_image(im, seg_bayesian, seg_n_samples, seg_tu, seg_device)
64 if len(images) == 1:
65 em_data.fn = fn
~/anaconda3/envs/vineeth/lib/python3.6/site-packages/imagedataextractor/extract.py in _extract_image(image, seg_bayesian, seg_n_samples, seg_tu, seg_device)
139
140 # detect scalebar
--> 141 scalebar = sb_detector.detect(image)
142 em_data.scalebar = scalebar
143 text, units, conversion, scalebar_contour = scalebar.data
~/anaconda3/envs/vineeth/lib/python3.6/site-packages/imagedataextractor/scalebar/scalebar.py in detect(self, image)
108 scalebar = Scalebar()
109
--> 110 rois, roi_locs = self.text_detector.get_text_rois(image)
111 text, best_idx = self.ocr.get_text_from_rois(rois)
112
~/anaconda3/envs/vineeth/lib/python3.6/site-packages/imagedataextractor/scalebar/textdetection.py in get_text_rois(self, image, scale, augment)
96 rois = []
97 roi_locs = []
---> 98 boxes = self.detect_text(image)
99 for x1, y1, x2, y2 in boxes:
100 box_w = int(scale * (x2 - x1))
~/anaconda3/envs/vineeth/lib/python3.6/site-packages/imagedataextractor/scalebar/textdetection.py in detect_text(self, image)
89 blob = cv2.dnn.blobFromImage(image, **blob_params)
90 self.model.setInput(blob)
---> 91 scores, geometry = self.model.forward(self.layer_names)
92 boxes = self.postprocess_detections(scores, geometry)
93 return boxes
error: OpenCV(4.5.3) /tmp/pip-req-build-tjxnaiom/opencv/modules/dnn/src/layers/convolution_layer.cpp:385: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 1 in function 'getMemoryShapes'`
Hi, I am Alissa.
I got issue about scalebar detection. As the image shown, the scalebar is 50 nm, but the output particle size are over 400 nm. I think its not right. The particle size should be less than 50 nm. Then I imput the Example image and got same error.
Last time you replied me that if I have to measure scalebar manually to get the result in this case. Could you please instruct me to measure it by myself?
Thank you for reading my writing.
Trying to read a local xml file on drive:
import imagedataextractor as ide
input_path='test.xml'
dat = ide.extract(input_path)
It gives the error:
----> 2 dat = ide.extract(input_path)
~/anaconda3/envs/vineeth/lib/python3.6/site-packages/imagedataextractor/extract.py in extract(input_path, seg_bayesian, seg_n_samples, seg_tu, seg_device)
100 error_msg = 'Input is invalid. Provide a path to an image, a path to a document of type {}, or a path to a directory of images and/or documents.'.format(allowed_doc_exts[:2])
101 raise TypeError(error_msg)
--> 102 if len(data) == 1:
103 data = data[0]
104 return data
UnboundLocalError: local variable 'data' referenced before assignment
Hi
My name is Alissa. Sorry for bother you. It's me agian. I use ImageJ to measure the scalebar in pixel.
As the image 1 shown, this 20nm scalebar was converted to distance in pixels of 83.5. I think its right. However, I dont know how to input this figure into the code to make the tool process smoothly.
Could I input this 83.5 manually into the original code?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.