Posted by
Michael Ellis on
May 21, 2010; 6:29pm
URL: http://imagej.273.s1.nabble.com/setMinAndMax-fails-on-currently-selected-channel-of-a-CompositeImage-tp3688229p3688231.html
Wayne, thanks. That does the trick.
I don't understand the difference between the two approaches, the code
for CompositeImage and associated goodies is pretty hairy, but at
least it is working so I'm a happy bunny!
Many thanks.
On 21 May 2010, at 18:59, Rasband, Wayne (NIH/NIMH) [E] wrote:
> On May 21, 2010, at 1:07 PM, Michael Ellis wrote:
>
>> I'm trying to write a plugin that will let me interactively
>> manipulate
>> a CompositeImage.
>> I find setMinAndMax() fails to work on the image processor returned
>> by
>> getProcessor(channelIndex)
>> for the currently selected channel of the CompositeImage.
>>
>> The plugin below is a minimal piece of code that illustrates my
>> problem.
>> It creates an 8 bit 256x256 3 channel CompositeImage filling each
>> channel with a ramp.
>> By default the LUTS for each channel are:
>> channel 1 = red
>> channel 2 = green
>> channel 3 = blue
>>
>> I set the min and max values using setMinAndMax(175,200) for each
>> channel.
>> I repeat this three times, selecting channel 1, then 2, then 3. In
>> each case the
>> setMinAndMax(175,200) appears to fail for the currently selected
>> channel.
>>
>> My goal is to create a plugin where I can interactively adjust the
>> enabled,
>> min and max values for every plane in a composite image.
>>
>> Using setPosition() to select a channel other than the one I want to
>> adjust
>> seems to work around the problem (try setting workAround to true) but
>> this
>> seem inelegant and probably indicative that I am doing something
>> wrong!
>>
>> Help!
>
> Try using
>
> imp.setPosition(channel, imp.getSlice(), imp.getFrame());
> imp.setDisplayRange(min, max);
>
> which is what the "Image>Adjust>Color Balance widget
> (ij.plugin.frame.ContrastAdjuster.java) uses.
>
> -wayne
>
<snip>
Michael Ellis
Managing Director
Digital Scientific UK Ltd.
http://www.digitalscientific.co.uk[hidden email]
tel: +44(0)1223 329993
fax: +44(0)1223 370040
Sheraton House
Castle Park
Cambridge
CB3 0AX
The contents of this e-mail may be privileged and are confidential.
It may not be disclosed to or used by anyone other than the
addressee(s), nor copied in any way. If received in error, please
advise the sender and delete it from your system.