Hello,
I'm looking for an example in Python for reading metadata from a Gatan .dm3 file. I want to extract the pixel dimensions in x and y.
Thanks.
--
--
Please avoid top-posting, and please make sure to reply-to-all!
Mailing list web interface: http://groups.google.com/group/fiji-devel
---
You received this message because you are subscribed to the Google Groups "Fiji-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fiji-devel+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi,
Thanks for the help!
I meant the X and Y pixel resolution.
I was also looking for a flexible tool, in case I need other information from the metadata. I guess I can interate 'r' in your script for a complete list. I'll try and figure out later.
Regards,
Nuno.
Okay, reading the image dimensions in pixels is working. Next, I need to read (1) pixel resolution (how big is one pixel); in case of these .dm3 files it's in micrometers / pixel (um/px). I also want to get out of the file the (2) stage X and Y position which are format specific values.
First, I managed to read the contents of the r object like this:meta_string = str(r.getGlobalMetadata())
f = open('C:\somepath\DM3_metadata.txt', 'w')
meta_list = meta_string.split(', ')
for item in meta_list:
f.write(item + chr(13))
print item
Replacing for r.getSeriesMetadata() returned {}
The result is attached. I highlighted the entries I'd like to retrieve.
(1) Pixel resolution is read correctly if I open the .dm3 file in Fiji and also appears in the list Image>Show Info...
root.ImageList.1.ImageData.Calibrations.Dimension.0.Scale = 0.019910393
root.ImageList.1.ImageData.Calibrations.Dimension.1.Scale = 0.019910393
(pixels are squares)
However, I cannot find these values (or 0.02) when I iterate through the 'r' object... I also looked up
http://hudson.openmicroscopy.org.uk/job/BIOFORMATS-trunk/javadoc/
for more methods. I found the suggested .getSizeX() and .getSizeY() under Class ImageReader. There is also one .getResolution() in the same list, but this always gives zero in my tests...
So I don't know how to retrieve the pixel resolution for my script.
I could also work with field of view (yellow highlight), but I would rather work with pixel res if possible. FoV also shows up in FIJI:
root.ImageList.1.ImageTags.Microscope Info.Field of View (µm) = 130.4847533380663
(2) The stage position is the opposite case - FIJI shows the entries but values are NaN:
root.ImageList.1.ImageTags.Microscope Info.Items.5.Data Type = 6
root.ImageList.1.ImageTags.Microscope Info.Items.5.Label = xPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.5.Tag path = Microscope Info:xPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.5.Value = NaN
root.ImageList.1.ImageTags.Microscope Info.Items.6.Data Type = 6
root.ImageList.1.ImageTags.Microscope Info.Items.6.Label = yPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.6.Tag path = Microscope Info:yPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.6.Value = NaN
However you can find the values in the text file, highlighted in green. My question is, what if the best way to read these values (1) and (2) in the script?
On a side note, there are other values that list as NaN in FIJI that can actually be read using these MetadataTools.
Thanks,
Nuno.
root.ImageList.1.ImageTags.Microscope Info.Items.5.Data Type = 6
root.ImageList.1.ImageTags.Microscope Info.Items.5.Label = xPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.5.Tag path = Microscope Info:xPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.5.Value = NaN
root.ImageList.1.ImageTags.Microscope Info.Items.6.Data Type = 6
root.ImageList.1.ImageTags.Microscope Info.Items.6.Label = yPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.6.Tag path = Microscope Info:yPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.6.Value = NaN
Thanks again!
However, this new code is only displaying
Dimensions = 1500 x 1500
Calibration (microns) = 0.01418117806315422 x 0.01418117806315422
and the last 3 'IJ.log' are silent...
By the way, I'm not familiar with 'C', 'T' and 'deltaT'; what's the difference between 'z' and 'posZ'?
Please have a look at a .dm3 file I'm using (maybe it's .dm4 format already in disguise). Perhaps there is something out of place?...
Regards,
Nuno.
Hi,
Thanks for the explanations.
I could swear I attached it... see if there is an attachment in this email.
I get this error #340 in Google groups.... this also happened last time. Maybe tha'ts why on the 2nd try the file was forgotten.
(2) The stage position is the opposite case - FIJI shows the entries but values are NaN:
root.ImageList.1.ImageTags.Microscope Info.Items.5.Data Type = 6
root.ImageList.1.ImageTags.Microscope Info.Items.5.Label = xPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.5.Tag path = Microscope Info:xPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.5.Value = NaN
root.ImageList.1.ImageTags.Microscope Info.Items.6.Data Type = 6
root.ImageList.1.ImageTags.Microscope Info.Items.6.Label = yPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.6.Tag path = Microscope Info:yPos (µm)
root.ImageList.1.ImageTags.Microscope Info.Items.6.Value = NaN
However you can find the values in the text file, highlighted in green. My question is, what if the best way to read these values (1) and (2) in the script?
On a side note, there are other values that list as NaN in FIJI that can actually be read using these MetadataTools.
I was just wondering, how do I know when the fixes to the OME library are implemented/uploaded so that the code that Curtis posted starts working?
Thanks. I read the the ticket. Maybe you could use a .dm3 file acquired in high vacuum to read the pressure values correctly... if so, you can find one here:
https://dl.dropbox.com/u/5200940/Prefix_3VBSED_stack_30_slice_0290.zip
Nuno.