Orthogonal Views Size Correction Possible?

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

Orthogonal Views Size Correction Possible?

Derek Xu
Hello all,

First time post for me! I'm new to this so please forgive any seemingly dumb
questions.

Normally Othrogonal Views works great for me, but now when I try and run it,
I get this error message:
 
Exception in thread "Orthogonal Views" java.lang.IllegalArgumentException:
Width (0) and height (1024) must be > 0
        at java.awt.image.SampleModel.<init>(SampleModel.java:126)
        at
java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:146)
        at
java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
        at
java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:144)
        at ij.process.ImageProcessor.getIndexSampleModel(ImageProcessor.java:2404)
        at ij.process.ShortProcessor.createBufferedImage(ShortProcessor.java:129)
        at ij.process.ShortProcessor.createImage(ShortProcessor.java:94)
        at ij.ImagePlus.getImage(ImagePlus.java:483)
        at ij.ImagePlus.show(ImagePlus.java:421)
        at ij.ImagePlus.show(ImagePlus.java:401)
        at ij.plugin.Orthogonal_Views.updateViews(Orthogonal_Views.java:271)
        at ij.plugin.Orthogonal_Views.exec(Orthogonal_Views.java:730)
        at ij.plugin.Orthogonal_Views.run(Orthogonal_Views.java:969)
        at java.lang.Thread.run(Thread.java:745)

I'm not sure why this is happening - I have a suspicion it might be because
something went wrong with the metadata not aquiring the right information
from the software about the objective lens used, etc., as ImageJ seems to
think my image is meters in length, not microns.

Is there a way to set the size of the image somehow (I've already tried
Image>Adjust>Size... and Canvas size... to work around this but nothing has
worked so far. Can anything be done? Also, where exactly can I find the code
for Orthogonal Viewer?

Thanks for the help!

Best,
Derek



--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: Orthogonal Views Size Correction Possible?

Michael Schmid-3
Hi Derek, Wayne,

looks like a bug in Orthogonal Views; it should not throw an exception
but rather complain about the cause of the problem or avoid it.
It might be caused by an invalid 'voxel depth', i.e. by a wrong
calibration of the depth scale (spacing between the slices).

Please have a look at Image>Properties, to check the voxel depth.
It this value is ok, do you have a hyperstack? (more than 3 dimensions)?

---
@wayne: I would suggest the following modifications in Orthogonal_Views:
line 235:
   int height2 = Math.max(int)Math.round(fp1.getHeight()*az), 1);
line 256:
   height2 = Math.max((int)Math.round(fp2.getHeight()*az), 1);

These should avoid that an image with width or height of zero is created
even if the spacing between the slices is so small that the depth of the
stack would be less than one pixel at the x and y scale.

Michael
________________________________________________________________
On 29/09/2017 15:42, Derek Xu wrote:

> Hello all,
>
> First time post for me! I'm new to this so please forgive any seemingly dumb
> questions.
>
> Normally Othrogonal Views works great for me, but now when I try and run it,
> I get this error message:
>  
> Exception in thread "Orthogonal Views" java.lang.IllegalArgumentException:
> Width (0) and height (1024) must be > 0
> at java.awt.image.SampleModel.<init>(SampleModel.java:126)
> at
> java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:146)
> at
> java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
> at
> java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:144)
> at ij.process.ImageProcessor.getIndexSampleModel(ImageProcessor.java:2404)
> at ij.process.ShortProcessor.createBufferedImage(ShortProcessor.java:129)
> at ij.process.ShortProcessor.createImage(ShortProcessor.java:94)
> at ij.ImagePlus.getImage(ImagePlus.java:483)
> at ij.ImagePlus.show(ImagePlus.java:421)
> at ij.ImagePlus.show(ImagePlus.java:401)
> at ij.plugin.Orthogonal_Views.updateViews(Orthogonal_Views.java:271)
> at ij.plugin.Orthogonal_Views.exec(Orthogonal_Views.java:730)
> at ij.plugin.Orthogonal_Views.run(Orthogonal_Views.java:969)
> at java.lang.Thread.run(Thread.java:745)
>
> I'm not sure why this is happening - I have a suspicion it might be because
> something went wrong with the metadata not aquiring the right information
> from the software about the objective lens used, etc., as ImageJ seems to
> think my image is meters in length, not microns.
>
> Is there a way to set the size of the image somehow (I've already tried
> Image>Adjust>Size... and Canvas size... to work around this but nothing has
> worked so far. Can anything be done? Also, where exactly can I find the code
> for Orthogonal Viewer?
>
> Thanks for the help!
>
> Best,
> Derek
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: Orthogonal Views Size Correction Possible?

Derek Xu
The voxel size was 1um, which is right.

But I managed to fix it! Based on what you said I changed the pixel width
and height values to what it should be (.31um instead of 12429.6110um which
it was set to for some reason) and then it worked!

Thanks for all the help!

Best,
Derek



--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: Orthogonal Views Size Correction Possible?

Wayne Rasband-2
In reply to this post by Michael Schmid-3
> On Sep 29, 2017, at 10:55 AM, Michael Schmid <[hidden email]> wrote:
>
> Hi Derek, Wayne,
>
> looks like a bug in Orthogonal Views; it should not throw an exception but rather complain about the cause of the problem or avoid it.
> It might be caused by an invalid 'voxel depth', i.e. by a wrong calibration of the depth scale (spacing between the slices).
>
> Please have a look at Image>Properties, to check the voxel depth.
> It this value is ok, do you have a hyperstack? (more than 3 dimensions)?
>
> ---
> @wayne: I would suggest the following modifications in Orthogonal_Views:
> line 235:
>  int height2 = Math.max(int)Math.round(fp1.getHeight()*az), 1);
> line 256:
>  height2 = Math.max((int)Math.round(fp2.getHeight()*az), 1);
>
> These should avoid that an image with width or height of zero is created even if the spacing between the slices is so small that the depth of the stack would be less than one pixel at the x and y scale.

Michael’s fix is in the latest daily build (1.51r11). This bug can be reproduced by opening the T1 Head sample stack, setting “Image width:” in Image>Properties to 10000 and running Orthogonal Views.

-wayne


> ________________________________________________________________
> On 29/09/2017 15:42, Derek Xu wrote:
>> Hello all,
>> First time post for me! I'm new to this so please forgive any seemingly dumb
>> questions.
>> Normally Othrogonal Views works great for me, but now when I try and run it,
>> I get this error message:
>>  Exception in thread "Orthogonal Views" java.lang.IllegalArgumentException:
>> Width (0) and height (1024) must be > 0
>> at java.awt.image.SampleModel.<init>(SampleModel.java:126)
>> at
>> java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:146)
>> at
>> java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
>> at
>> java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:144)
>> at ij.process.ImageProcessor.getIndexSampleModel(ImageProcessor.java:2404)
>> at ij.process.ShortProcessor.createBufferedImage(ShortProcessor.java:129)
>> at ij.process.ShortProcessor.createImage(ShortProcessor.java:94)
>> at ij.ImagePlus.getImage(ImagePlus.java:483)
>> at ij.ImagePlus.show(ImagePlus.java:421)
>> at ij.ImagePlus.show(ImagePlus.java:401)
>> at ij.plugin.Orthogonal_Views.updateViews(Orthogonal_Views.java:271)
>> at ij.plugin.Orthogonal_Views.exec(Orthogonal_Views.java:730)
>> at ij.plugin.Orthogonal_Views.run(Orthogonal_Views.java:969)
>> at java.lang.Thread.run(Thread.java:745)
>> I'm not sure why this is happening - I have a suspicion it might be because
>> something went wrong with the metadata not aquiring the right information
>> from the software about the objective lens used, etc., as ImageJ seems to
>> think my image is meters in length, not microns.
>> Is there a way to set the size of the image somehow (I've already tried
>> Image>Adjust>Size... and Canvas size... to work around this but nothing has
>> worked so far. Can anything be done? Also, where exactly can I find the code
>> for Orthogonal Viewer?
>> Thanks for the help!
>> Best,
>> Derek
>> --
>> Sent from: http://imagej.1557.x6.nabble.com/

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