Image Import of Raw files fails silenty if parameters exceeds file size

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

Image Import of Raw files fails silenty if parameters exceeds file size

Stein Rørvik
This is perhaps related to the previous problem I just posted.

A raw file import fails silently if the requested image exists,
but the combination of width, height and number of slices exceeds the file size:

                run("Raw...", "open=&pathToExistingFile image=[16-bit Unsigned] width=&tooLargeX height=&tooLargeY number=&tooManyImages offset=123 gap=456 little-endian");

However, this error does not always happen.

In this example macro, the AuPbSn40 file import fails but the t1-head does not,
even though in both cases we try to load 10 times too many slices:

                run("Close All");
                dir = getDirectory("temp");

                //create a sample tiff file
                run("AuPbSn 40 (56K)");
                saveAs("Tiff", dir + "AuPbSn40.tif");
                close();

                //create a sample tiff stack
                run("T1 Head (2.4M, 16-bits)");
                saveAs("Tiff", dir + "t1-head.tif");
                close();

                //load the image using the correct parameters:
                run("Raw...", "open=" + dir + "AuPbSn40.tif image=[8-bit] width=600 height=400 number=1 offset=148");                //ok
                //try to load 10 times too many slices
                run("Raw...", "open=" + dir + "AuPbSn40.tif image=[16-bit Unsigned] width=600 height=400 number=10 offset=148");    //fails silently

                //load the image using the correct parameters:
                run("Raw...", "open=" + dir + "t1-head.tif name=t1-head width=256 height=256 number=129 offset=1141 image=[16-bit Unsigned] big-endian"); //ok
                //try to load 10 times too many slices
                run("Raw...", "open=" + dir + "t1-head.tif name=t1-head width=256 height=256 number=1290 offset=1141 image=[16-bit Unsigned] big-endian"); //ok, imports the available data

I am using daily build ImageJ 1.52f with Java 1.6 on Windows 7/64-bit.

Stein


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

Re: Image Import of Raw files fails silenty if parameters exceeds file size

Michael Schmid-3
Hi Stein, (& Wayne):

could it be that the silent fail occurs if the file is not large enough
to read even *one* slice?

In your example, it happens when you open "AuPbSn40.tif", which is a
one-slice image, as "16-bit Unsigned" data. It opens correctly if I try
to import it as raw 8-bit data.


@ Wayne: Nevertheless, I would suggest to add an IJ.error statement if
there is no image (I guess an 'else' branch in ImportDialog.java, line
221 would do the job).


Michael
________________________________________________________________
On 10/08/2018 12:59, Stein Rørvik wrote:

> This is perhaps related to the previous problem I just posted.
>
> A raw file import fails silently if the requested image exists,
> but the combination of width, height and number of slices exceeds the file size:
>
>                  run("Raw...", "open=&pathToExistingFile image=[16-bit Unsigned] width=&tooLargeX height=&tooLargeY number=&tooManyImages offset=123 gap=456 little-endian");
>
> However, this error does not always happen.
>
> In this example macro, the AuPbSn40 file import fails but the t1-head does not,
> even though in both cases we try to load 10 times too many slices:
>
>                  run("Close All");
>                  dir = getDirectory("temp");
>
>                  //create a sample tiff file
>                  run("AuPbSn 40 (56K)");
>                  saveAs("Tiff", dir + "AuPbSn40.tif");
>                  close();
>
>                  //create a sample tiff stack
>                  run("T1 Head (2.4M, 16-bits)");
>                  saveAs("Tiff", dir + "t1-head.tif");
>                  close();
>
>                  //load the image using the correct parameters:
>                  run("Raw...", "open=" + dir + "AuPbSn40.tif image=[8-bit] width=600 height=400 number=1 offset=148");                //ok
>                  //try to load 10 times too many slices
>                  run("Raw...", "open=" + dir + "AuPbSn40.tif image=[16-bit Unsigned] width=600 height=400 number=10 offset=148");    //fails silently
>
>                  //load the image using the correct parameters:
>                  run("Raw...", "open=" + dir + "t1-head.tif name=t1-head width=256 height=256 number=129 offset=1141 image=[16-bit Unsigned] big-endian"); //ok
>                  //try to load 10 times too many slices
>                  run("Raw...", "open=" + dir + "t1-head.tif name=t1-head width=256 height=256 number=1290 offset=1141 image=[16-bit Unsigned] big-endian"); //ok, imports the available data
>
> I am using daily build ImageJ 1.52f with Java 1.6 on Windows 7/64-bit.
>
> Stein
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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