Math - NaN background crashes with stacks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Math - NaN background crashes with stacks

Stein Rørvik
The Math - NaN background function is useful in many cases.
For obvious reasons it only works for 32-bit images.

The problem is that if you by accident try to run it on 8-bit or 16-bit stacks, you are still asked if you want to process all slices; and then an expection is thrown and the ImageJ status bar seems to be stuck. (In one case the contents of my image was set to all zeros but I am unable to reproduce that).

This problem can be fixed by having the check for 32-bit image done at an earlier stage, telling you that it is not supported and then aborting with no changes done to the image. It seems to abort safely with single images.

Here are two demo macro snippets illustrating the problem:

run("CT (420K, 16-bit DICOM)");
setAutoThreshold("Default dark no-reset");
run("NaN Background");
//exits safely with an error message

run("T1 Head (2.4M, 16-bits)");
setSlice(nSlices/2);
setAutoThreshold("Default dark no-reset");
run("NaN Background", "stack");
//an exception is thrown

Stein


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Math - NaN background crashes with stacks

Wayne Rasband-2
=
> On Jul 4, 2018, at 6:57 AM, Stein Rørvik <[hidden email]> wrote:
>
> The Math - NaN background function is useful in many cases.
> For obvious reasons it only works for 32-bit images.
>
> The problem is that if you by accident try to run it on 8-bit or 16-bit stacks, you are still asked if you want to process all slices; and then an expection is thrown and the ImageJ status bar seems to be stuck. (In one case the contents of my image was set to all zeros but I am unable to reproduce that).

This bug is fixed in the latest ImageJ daily build (1.52e29).

-wayne

> This problem can be fixed by having the check for 32-bit image done at an earlier stage, telling you that it is not supported and then aborting with no changes done to the image. It seems to abort safely with single images.
>
> Here are two demo macro snippets illustrating the problem:
>
> run("CT (420K, 16-bit DICOM)");
> setAutoThreshold("Default dark no-reset");
> run("NaN Background");
> //exits safely with an error message
>
> run("T1 Head (2.4M, 16-bits)");
> setSlice(nSlices/2);
> setAutoThreshold("Default dark no-reset");
> run("NaN Background", "stack");
> //an exception is thrown
>
> Stein

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