resetMinAndMax() not being applied immediately?

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

resetMinAndMax() not being applied immediately?

Kenneth Sloan-3
I have an ImageStack containing FloatProcessors.

Most of the images have values in [0.0, 255.0]

ONE of the images may have values in [0.0, 700.0]

I am trying to use resetMinAndMax to adjust the range of values mapped
to [0,255] for display purposes.

It seems to me that this does not always take effect immediately.  In particular,
the adjustment appears to take effect only after scrolling in the ImageStack away
from the image, and then back again.

Is there some sort of "update" call that I need to make?  If so, I seem to
have overlooked it in the documentation for the FloatProcessor API.

I had similar issues when displaying a single image (not as part of a stack), but
my current code seems to do the right thing.  I'm not sure why.  I don't like
not knowing...

Similarly, earlier attempts tried to use setMinAndMax.

In the future, I may want to use an auto setting for Adjust Brightness & Contrast,
but, for now I'm happy with resetMinAndMax - when it actually takes effect!

If it matters - I typically apply the resetMinAndMax to the FloatProcessor *before*
making the ImageStack visible.

All of this is embedded in a rather large Java plugin - but I can try to produce a minimal
demonstration version, if that will help.

I suspect I've simply missed a "DoIt!" method, somewhere.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

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

Re: resetMinAndMax() not being applied immediately?

Michael Schmid-3
Hi Kenneth,

It seems you are programming in Java.
In this case, either call IJ.resetMinAndMax(imp) or do the
(re)setMinAndMax on the ImageProcessor, then updateAndDraw() on the
ImagePlus.


Michael
________________________________________________________________

On 02/05/2018 01:08, Kenneth Sloan wrote:

> I have an ImageStack containing FloatProcessors.
>
> Most of the images have values in [0.0, 255.0]
>
> ONE of the images may have values in [0.0, 700.0]
>
> I am trying to use resetMinAndMax to adjust the range of values mapped
> to [0,255] for display purposes.
>
> It seems to me that this does not always take effect immediately.  In particular,
> the adjustment appears to take effect only after scrolling in the ImageStack away
> from the image, and then back again.
>
> Is there some sort of "update" call that I need to make?  If so, I seem to
> have overlooked it in the documentation for the FloatProcessor API.
>
> I had similar issues when displaying a single image (not as part of a stack), but
> my current code seems to do the right thing.  I'm not sure why.  I don't like
> not knowing...
>
> Similarly, earlier attempts tried to use setMinAndMax.
>
> In the future, I may want to use an auto setting for Adjust Brightness & Contrast,
> but, for now I'm happy with resetMinAndMax - when it actually takes effect!
>
> If it matters - I typically apply the resetMinAndMax to the FloatProcessor *before*
> making the ImageStack visible.
>
> All of this is embedded in a rather large Java plugin - but I can try to produce a minimal
> demonstration version, if that will help.
>
> I suspect I've simply missed a "DoIt!" method, somewhere.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> 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: resetMinAndMax() not being applied immediately?

Kenneth Sloan-3
Yes - Java. I am doing resetMinAndMax on the FloatProcessor, BEFORE there
is an ImagePlus. The code that creates the FloatProcessors knows how it
wants Min and Max set - the code that assembles them into a StackWindow
does nit(yet...I’ll have to change that)

I later put the FloarProcessors in an ImageStack, and finally create a
StackWindow.

The reset takes effect only after scrolling away from a given slice and
then back again.

I will try adding UpdateAndDraw calls AFTER I create the StackWindow. But -
since the resetMinAndMax is applied to the FloatProcessor, I didn’t think
it was necessary (or possible at that point) to call UpdateAndDraw for the
(not yet created) ImagePlus.

Thanks for the reply.
On Thu, May 3, 2018 at 03:28 Michael Schmid <[hidden email]> wrote:

> Hi Kenneth,
>
> It seems you are programming in Java.
> In this case, either call IJ.resetMinAndMax(imp) or do the
> (re)setMinAndMax on the ImageProcessor, then updateAndDraw() on the
> ImagePlus.
>
>
> Michael
> ________________________________________________________________
>
> On 02/05/2018 01:08, Kenneth Sloan wrote:
> > I have an ImageStack containing FloatProcessors.
> >
> > Most of the images have values in [0.0, 255.0]
> >
> > ONE of the images may have values in [0.0, 700.0]
> >
> > I am trying to use resetMinAndMax to adjust the range of values mapped
> > to [0,255] for display purposes.
> >
> > It seems to me that this does not always take effect immediately.  In
> particular,
> > the adjustment appears to take effect only after scrolling in the
> ImageStack away
> > from the image, and then back again.
> >
> > Is there some sort of "update" call that I need to make?  If so, I seem
> to
> > have overlooked it in the documentation for the FloatProcessor API.
> >
> > I had similar issues when displaying a single image (not as part of a
> stack), but
> > my current code seems to do the right thing.  I'm not sure why.  I don't
> like
> > not knowing...
> >
> > Similarly, earlier attempts tried to use setMinAndMax.
> >
> > In the future, I may want to use an auto setting for Adjust Brightness &
> Contrast,
> > but, for now I'm happy with resetMinAndMax - when it actually takes
> effect!
> >
> > If it matters - I typically apply the resetMinAndMax to the
> FloatProcessor *before*
> > making the ImageStack visible.
> >
> > All of this is embedded in a rather large Java plugin - but I can try to
> produce a minimal
> > demonstration version, if that will help.
> >
> > I suspect I've simply missed a "DoIt!" method, somewhere.
> >
> > --
> > Kenneth Sloan
> > [hidden email]
> > Vision is the art of seeing what is invisible to others.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> 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: resetMinAndMax() not being applied immediately?

Michael Schmid-3
Hi Kenneth,

please note that an ImageStack does NOT consist of individual
ImageProcessors. It only contains the pixels arrays.
So the ImageStack does NOT have min&max values for each slice, it only
has one min and one max value, which is valid for the whole stack.

If you call imageStack.getProcessor(sliceNumber), the pixel array for
the given slice number is taken. An ImageProcessor is created with these
pixels and gets the min&max from the ImageStack.

If you add an ImageProcessor to an ImageStack, the whole stack gets the
min&max of the added ImageProcessor.


Michael
________________________________________________________________


On 03/05/2018 17:14, Kenneth R Sloan wrote:

> Yes - Java. I am doing resetMinAndMax on the FloatProcessor, BEFORE there
> is an ImagePlus. The code that creates the FloatProcessors knows how it
> wants Min and Max set - the code that assembles them into a StackWindow
> does nit(yet...I’ll have to change that)
>
> I later put the FloarProcessors in an ImageStack, and finally create a
> StackWindow.
>
> The reset takes effect only after scrolling away from a given slice and
> then back again.
>
> I will try adding UpdateAndDraw calls AFTER I create the StackWindow. But -
> since the resetMinAndMax is applied to the FloatProcessor, I didn’t think
> it was necessary (or possible at that point) to call UpdateAndDraw for the
> (not yet created) ImagePlus.
>
> Thanks for the reply.
> On Thu, May 3, 2018 at 03:28 Michael Schmid <[hidden email]> wrote:
>
>> Hi Kenneth,
>>
>> It seems you are programming in Java.
>> In this case, either call IJ.resetMinAndMax(imp) or do the
>> (re)setMinAndMax on the ImageProcessor, then updateAndDraw() on the
>> ImagePlus.
>>
>>
>> Michael
>> ________________________________________________________________
>>
>> On 02/05/2018 01:08, Kenneth Sloan wrote:
>>> I have an ImageStack containing FloatProcessors.
>>>
>>> Most of the images have values in [0.0, 255.0]
>>>
>>> ONE of the images may have values in [0.0, 700.0]
>>>
>>> I am trying to use resetMinAndMax to adjust the range of values mapped
>>> to [0,255] for display purposes.
>>>
>>> It seems to me that this does not always take effect immediately.  In
>> particular,
>>> the adjustment appears to take effect only after scrolling in the
>> ImageStack away
>>> from the image, and then back again.
>>>
>>> Is there some sort of "update" call that I need to make?  If so, I seem
>> to
>>> have overlooked it in the documentation for the FloatProcessor API.
>>>
>>> I had similar issues when displaying a single image (not as part of a
>> stack), but
>>> my current code seems to do the right thing.  I'm not sure why.  I don't
>> like
>>> not knowing...
>>>
>>> Similarly, earlier attempts tried to use setMinAndMax.
>>>
>>> In the future, I may want to use an auto setting for Adjust Brightness &
>> Contrast,
>>> but, for now I'm happy with resetMinAndMax - when it actually takes
>> effect!
>>>
>>> If it matters - I typically apply the resetMinAndMax to the
>> FloatProcessor *before*
>>> making the ImageStack visible.
>>>
>>> All of this is embedded in a rather large Java plugin - but I can try to
>> produce a minimal
>>> demonstration version, if that will help.
>>>
>>> I suspect I've simply missed a "DoIt!" method, somewhere.
>>>
>>> --
>>> Kenneth Sloan
>>> [hidden email]
>>> Vision is the art of seeing what is invisible to others.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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