Created
January 22, 2021 14:45
-
-
Save mutterer/18a52d743a8591fd1b85ef4a20cadfde to your computer and use it in GitHub Desktop.
Read calibration from axiovision tif _meta.xml files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reads and applies, the calibration, if any, | |
// from *_meta.xml files saved alongside | |
// *.tif files in Axiovision. | |
// jerome.mutterer@cnrs.fr | |
fname=getInfo("image.directory")+getInfo("image.filename"); | |
if (File.exists(fname+"_meta.xml")) { | |
x=1;y=1; | |
s=split(File.openAsString(fname+"_meta.xml"),"\n"); | |
for (i=0;i<s.length;i++) { | |
l=s[i]; | |
if (l.indexOf('<Factor_0>')>0) xs=get(); | |
else if (l.indexOf('<Factor_1>')>0) ys=get(); | |
} | |
run("Properties...", "channels=1 slices=1 frames=1 pixel_width=&x pixel_height=&y"); | |
Stack.setXUnit("micron"); | |
} | |
function get() { | |
v=""+l.substring(l.indexOf('>')+1,l.lastIndexOf('<')); | |
v=v.replace(',','.'); | |
return value; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment