Greetings Michael,
The creation of each mip ImageProcessor I assume should be the same as
imps[0]'s ImageProcessor and thus, just from a from-type to a to-type
there should not be a conversion/scaling; n.b., all imps are extracted
frames from the same ImagePlus, thus all the same type (16bit) and same
W&L. I create the ImageProcessor in this way to specifically avoid the
problem that you describe, and thus the code should work no matter what
the ImageProcessor subclass is/was.
Is there a type agnostic way to tell insert to not rescale if the
ImageProcessor types are the same? The main reason for doing this is to
compare the actual values side-by-side, so changing the actual values is
bad. Albeit, sometimes this would be a desired effect, and thus I'd like
to know how to control this.
Thanks in afvance,
Fred
On Thu, April 18, 2024 3:15 am, Michael Schmid wrote:
> Hi Fred,
>
> your code snippet does not say which type of images you have, i.e.,
> 8-bit, 16-bit, Float or RGB.
> ImageProcessor.insert has to do a conversion if you insert an image of a
> different type, e.g., if you insert a 16-bit or float image into a byte
> image. The conversion scales the input to make the display range of the
> input image fit the range of possible pixel values in the target image.
>
> To avoid scaling on type conversion, you can
> - either set the limits of the input image to fit the range of the
> target image, e.g. setMinAndMax(0,255) if you want to insert it into a
> byte image,
> - or you convert it beforehand to the target type. the TypeConverter has
> a doScaling option where you can suppress scaling.
>
> Michael
> ________________________________________________________________
>
> On 18.04.24 06:03, Fred Damen wrote:
>> Greetings,
>>
>> In the below java code the ImageProcessor.insert is some how changing
>> the
>> dynamic range, i.e., the values, of the ImageProcessor that is being
>> passed to insert; seems as W&L-auto is performed and LUT values are what
>> is inserted. What to add to Java code to stop or cause this effect.
>>
>> Thanks in advance,
>>
>> Fred
>>
>>
>>
>> ImageStack mis = new ImageStack(width,imps.length*height);
>> for(int iz=0; iz<ss; iz++) {
>> ImageProcessor mip =
>> imps[0].getProcessor().createProcessor(width,imps.length*height);
>> mip.setColor(Toolbar.getBackgroundColor());
>> mip.fill();
>> for(int i=0; i<imps.length; i++)
>> if (imps[i] != null) {
>> int[] x0y0 =
>> offset(width,height,imps[i].getWidth(),imps[i].getHeight(),where);
>>
>> mip.insert(imps[i].getStack().getProcessor(iz+1),x0y0[0],i*height+x0y0[1]);
>> }
>> mis.addSlice(mip);
>> }
>> ImagePlus mimp = new ImagePlus(null, mis);
>>
>> --
>> 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