Login  Register

Re: possible bug in the 'redirect to" option in Set Measurements

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jun 02, 2010; 4:02am
URL: http://imagej.273.s1.nabble.com/possible-bug-in-the-redirect-to-option-in-Set-Measurements-tp3688112p3688117.html

ImageJ 1.44b fixes a bug that caused redirected measurement of non-displayed images to fail.

-wayne

On Jun 1, 2010, at 8:12 PM, Md Tamjidul Hoque wrote:

> Dear Michael
>
> thanks and apology for mis-understanding your previous explanation. But,
> the problem is still there.
>
> Here is the part of the code sample and the problem:
> ===================================
> Line #1: String anaStr = "...........";
> Line #2: Prefs.blackBackground = false;
> Line #3:
> Line #4: IJ.run("Set Measurements...", "area mean min shape
> redirect=None decimal=9"); //clears any redirect
> Line #5:
> Line #6: Analyzer.setRedirectImage(impA); //sets the redirect
> Line #7:
> Line #8: IJ.run(impB, "Analyze Particles...", anaStr); //
> ========================================
>
> The above code does not work unless I place "impA.show();" at line #3or
> # 5(but not at line #7);
> It may be either to do something with "setRedirectImage()" or I am
> missing something else.
>
> And the most surprising thing to me was, by placing "impA.show();" at
> line #3or # 5 it works but
> it works alternatively! like if it works 1st time then it will work 3rd,
> 5th, 7th ...time ... and will not work
> 2nd, 4th, 6th ... time - ... but certainly
> "Analyzer.setRedirectImage(impA);" without calling "impA.show();" before
> is not working.
> When it does not work it shows message, "Redirect image("ImageA") not
> found." ... hope all these information will help.
>
> Any help is much appreciated.
>
> Thanks
> Tamjid
>
>
>
>
> Michael Schmid wrote:
>> Hi Tamjid,
>>
>> set the other measurement options, then the redirect:
>>
>> IJ.run("Set Measurements...", "area mean min shape redirect=None
>> decimal=9"); //clears any redirect
>> Analyzer.setRedirectImage(imp); //sets the redirect
>>
>> Michael
>> ________________________________________________________________
>>
>> On 1 Jun 2010, at 16:10, Tamjid wrote:
>>
>>> Thanks Michael for the info. But, do you mean
>>>
>>> I have to use
>>>
>>> "IJ.run("Set Measurements...", "area mean min shape redirect=None
>>> decimal=9");"
>>>
>>> instead? I mean "redirect=None" or equivalent by passing null through
>>> the
>>> method?
>>>
>>> If so, then I think the philosophy behind the "redirect to" was to
>>> get some
>>> information
>>>
>>> from image A when you are working on image B, when B can be a modified
>>> version of A.
>>>
>>> I am getting outlined image from image B and need to get the
>>> intensity from
>>> the original image A
>>>
>>> for the corresponding outlined area.
>>>
>>> I am using batch mode java-application and can't open window. So,
>>> what to do
>>> in such case?
>>>
>>> Thanks
>>> Tamjid
>>>
>>>
>>>
>>>
>>> On Tue, Jun 1, 2010 at 11:20 PM, Michael Schmid
>>> <[hidden email]>wrote:
>>>
>>>> Hi Tamjid,
>>>>
>>>> you can refer to an image by name only if the WindowManager knows
>>>> about it
>>>> - that's the only place where a list of all images and their name is
>>>> kept.
>>>>
>>>> If you create a new ImagePlus and don't show it, the WindowManager
>>>> (and no
>>>> one else except your plugin) will know about its existence. Then,
>>>> you can't
>>>> access it by its name.
>>>>
>>>> So it is no bug, it has to be like that.
>>>>
>>>> Instead of giing the name, you have to use the following method in
>>>> ij.plugin.filter.Analyzer:
>>>>
>>>> /** Set the "Redirect To" image. Pass 'null' as the argument to
>>>> disable
>>>> redirected sampling. */
>>>> public static void setRedirectImage(ImagePlus imp)
>>>>
>>>>
>>>> Michael
>>>> ________________________________________________________________
>>>>
>>>>
>>>> On 1 Jun 2010, at 14:11, Tamjid wrote:
>>>>
>>>> Dear All
>>>>>
>>>>>       I was trying to use the "redirect to" option available in
>>>>> the "set
>>>>> Measurements" to work with image file,
>>>>>       but it did not.  But, when I opened the image window (i.e used
>>>>> imp.show()) it worked.
>>>>>
>>>>> I was using:
>>>>>
>>>>> IJ.run("Set Measurements...", "area mean min shape
>>>>> redirect="+imp1.getTitle()+" decimal=9");
>>>>> or,
>>>>> IJ.run("Set Measurements...", "area mean min shape
>>>>> redirect="+imp.getTitle()+".tif decimal=9");
>>>>>
>>>>> Even converted the image into 8 bit assuming 'Gray' min max and
>>>>> mean will
>>>>> not work  - ... but worked once used imp.show() before calling the
>>>>> above
>>>>> line.
>>>>>
>>>>>
>>>>> Any help or update, please.
>>>>>
>>>>> Thanks
>>>>> Tamjid
>>>>>
>>>>