Login  Register

Re: Voxel depth not saved?

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jan 31, 2014; 4:26am
URL: http://imagej.273.s1.nabble.com/Voxel-depth-not-saved-tp5006345p5006348.html

On Jan 30, 2014, at 6:26 PM, Norbert Vischer wrote:

> Hello,
>
> in the following macro, I found that the voxel depth is not saved.
> (And by the way, why does the "delete file" instruction return zero ?)
> Running on OS X.

Voxel depths of zero are not saved. You can work around this problem by using a value near zero, such as 1e-39. File.delete() returns zero because saveAs("Tiff",path) changes the file name from "ABC" to "ABC.tif".

-wayne

> run("Close All");
> print("\\Clear");
> path = getDirectory("temp") + "ABC";
> newImage("ABC", "8-bit color-mode label", 400, 300, 3, 3, 5);
> setVoxelSize(0.5, 0.5, 0, "um");
> getVoxelSize(width, height, depth, unit);
> print("voxelDepth = ", depth, "  expected: 0");
> saveAs("Tiff", path);
> run("Revert");
> deleted = File.delete(path);
> print("deleted = ", deleted, "  expected: 1" );
> print("file exists = ", File.exists(path), "  expected: 0" );
> getVoxelSize(width, height, depth, unit);
> print("voxelDepth = ", depth, "  expected: 0");
>
> output:
> =======
> voxelDepth =  0   expected: 0
> deleted =  0   expected: 1
> file exists =  0   expected: 0
> voxelDepth =  1   expected: 0
>
> Norbert Vischer

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html