Read value from ASCII file for image properties
Posted by Lars on Feb 04, 2013; 4:32pm
URL: http://imagej.273.s1.nabble.com/Read-value-from-ASCII-file-for-image-properties-tp5001661.html
Hi all,
First, many thanks to the ImageJ development team. A great tool!
I am a newbie at ImageJ and using Image1.46r.
I have a little question about a macro: I like to read a value from an ASCII file an use it for the image properties Pixel "Width" and "Height" and "Voxel Depth".
What I tried so far:
// ~~~~~~Begin macro
//1.) Choose Image tif File. (e.g:"1166-24.tif")
//Note: Tiled Tiff. Open with ImageIO...
run("Open ...", "Select Tiff File");
?
//2.)Looking for the related ASCII file which should be in the same directory. The name is
//equal, except the extension is ".tfw" instead of ".tif" (e.g:"1166-24.tfw")
//----Begin file example----
//0.250000 //--> This value is wanted
//0.000000
//0.000000
//-0.250000
//2598125.125000
//1202999.875000//
//----End file example----
?
//3.) If the file is being found, read the value from the *first* row (e.g.: 0,250000) and copy it into "Image Properties...":
//pixel_width=copy-value-here (e.g.:0.25)
//pixel_height=copy-value-here (e.g.:0.25)
//voxel_depth=copy-value-here (e.g.:0.25)
//("Properties...", "channels=1 slices=1 frames=1 unit=m pixel_width=copy-value-here pixel_height=copy-value-here voxel_depth=copy-value-here frame=[0 sec] origin=0,0");
?
// ~~~~~~End macro
Many thanks for any help
Lars