Different results with duplicate or re-open the image

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

Different results with duplicate or re-open the image

Karel Jansseune-2
Hello imageJ users,

I have a strange problem with my macro.
The macro is used to measure a certain part of the image that contains
plant parts.

The macro is creating a mask of the image, this mask is then renamed
as "mask", and this is used to filter out the parts that I need in the
next measuring step by subtracting it from the original image.

In the first version I used to re-open the original image and to apply the
mask to that image.
I have now discovered that if I duplicate the image in stead of re-opening
it, I get different results when I measure the area of the plant parts.
(up to 15% difference!).

Is there a differnce between the original image and a duplicate in terms
of resolution? or should I look for the error in another place?

kind regards,

Karel Jansseune
Reply | Threaded
Open this post in threaded view
|

Re: Different results with duplicate or re-open the image

William Joseph Ashby
I've noticed that the duplicate command will only duplicate the region of
interest if you have selected a portion of the image.  That might cause your
problem.

-Will Ashby


On 8/26/09 9:06 AM, "Karel Jansseune" <[hidden email]>
wrote:

> Hello imageJ users,
>
> I have a strange problem with my macro.
> The macro is used to measure a certain part of the image that contains
> plant parts.
>
> The macro is creating a mask of the image, this mask is then renamed
> as "mask", and this is used to filter out the parts that I need in the
> next measuring step by subtracting it from the original image.
>
> In the first version I used to re-open the original image and to apply the
> mask to that image.
> I have now discovered that if I duplicate the image in stead of re-opening
> it, I get different results when I measure the area of the plant parts.
> (up to 15% difference!).
>
> Is there a differnce between the original image and a duplicate in terms
> of resolution? or should I look for the error in another place?
>
> kind regards,
>
> Karel Jansseune
Reply | Threaded
Open this post in threaded view
|

Re: Different results with duplicate or re-open the image

Karel Jansseune-2
In reply to this post by Karel Jansseune-2
I browsed through the macro, but this is not the case.
At the moment of duplication, nothing is selected.

I'm currently trying to find out what exactely happens, but so far I can't
really find any reason why the two would give different results



On Wed, 26 Aug 2009 09:18:53 -0500, Will Ashby
<[hidden email]> wrote:

>I've noticed that the duplicate command will only duplicate the region of
>interest if you have selected a portion of the image.  That might cause
your
>problem.
>
>-Will Ashby
>
>
>On 8/26/09 9:06 AM, "Karel Jansseune"
<[hidden email]>

>wrote:
>
>> Hello imageJ users,
>>
>> I have a strange problem with my macro.
>> The macro is used to measure a certain part of the image that contains
>> plant parts.
>>
>> The macro is creating a mask of the image, this mask is then renamed
>> as "mask", and this is used to filter out the parts that I need in the
>> next measuring step by subtracting it from the original image.
>>
>> In the first version I used to re-open the original image and to apply
the
>> mask to that image.
>> I have now discovered that if I duplicate the image in stead of re-
opening

>> it, I get different results when I measure the area of the plant parts.
>> (up to 15% difference!).
>>
>> Is there a differnce between the original image and a duplicate in terms
>> of resolution? or should I look for the error in another place?
>>
>> kind regards,
>>
>> Karel Jansseune
>=========================================================================
Reply | Threaded
Open this post in threaded view
|

Re: Different results with duplicate or re-open the image

Gabriel Landini
On Thursday 27 August 2009, Karel Jansseune wrote:
> I browsed through the macro, but this is not the case.
> At the moment of duplication, nothing is selected.
>
> I'm currently trying to find out what exactely happens, but so far I can't
> really find any reason why the two would give different results

Perhaps the wrong image is selected by default during the macro execution.
Post the macro to the list for us to see, otherwise it is impossible to know
what is going on.

G.
Reply | Threaded
Open this post in threaded view
|

Re: Different results with duplicate or re-open the image

Karel Jansseune-2
In reply to this post by Karel Jansseune-2
This is (a part) of my macro
The whole macro involves some input boxes and some control structures.
but they are of no real importance here.

So the idea is that an image is openened, duplicated.
the duplicate is used to create a mask (with makeRGB, this is a macro for
colour thresholding)
Than the mask is added to the original and the resulting image is used
again in MakeHSB to detect plant parts.
than I analyse particles to detect the area and the diameter of the plants.

In the first version I used open(inputpath) again in stead of duplicate.

After changing this to duplicate in the macro I notice a difference
between the results after analysis.

.
.
.
open(inputPath);
ID = getTitle();
run("Duplicate...", "title=double");
run("Set Measurements...", "area centroid circularity feret's
redirect=None decimal=4");
run("Set Scale...", "distance="+pixels+" known="+length+" pixel=1 unit=mm
global");
selectWindow("double");
MakeRGB();
imageCalculator("AND", ID ,"mask");
selectWindow("mask");
close();
MakeHSB();
run("Invert");
run("Analyze Particles...", "size="+Size2+"-infinity circularity=0.00-1.00
show=Nothing clear include add");
roiManager("Measure");
.
.
.
On Thu, 27 Aug 2009 08:35:15 +0100, Gabriel Landini <[hidden email]>
wrote:

>On Thursday 27 August 2009, Karel Jansseune wrote:
>> I browsed through the macro, but this is not the case.
>> At the moment of duplication, nothing is selected.
>>
>> I'm currently trying to find out what exactely happens, but so far I
can't
>> really find any reason why the two would give different results
>
>Perhaps the wrong image is selected by default during the macro execution.
>Post the macro to the list for us to see, otherwise it is impossible to
know
>what is going on.
>
>G.
Reply | Threaded
Open this post in threaded view
|

Re: Different results with duplicate or re-open the image

Gabriel Landini
I cannot run the code because MakeRGB() and MakeHSB() are not defined.

On Thursday 27 August 2009, Karel Jansseune wrote:
> selectWindow("double");
> MakeRGB();
> imageCalculator("AND", ID ,"mask");
> selectWindow("mask");
> close();

However I do not understand what you are trying to do with this:

> MakeHSB();
> run("Invert");
> run("Analyze Particles...", "size="+Size2+"-infinity circularity=0.00-1.00
> show=Nothing clear include add");
> roiManager("Measure");

It seems that you run the particle analyzer on one of the inverted hsb
channels (without specifying which one) and without specifying a threshold
range either?

Cheers,

G.
Reply | Threaded
Open this post in threaded view
|

Re: Different results with duplicate or re-open the image

Karel Jansseune-2
In reply to this post by Karel Jansseune-2
Sorry for beeing so unclear, I forgot to copy the functions in my previous
mail.

In the mean time I figured out what was going wrong. I made a mistake in
the image titles for the duplicate and the original image in one of the
functions in my macro, and incidently both approaches give more or less
the same result, so it wasn't very clear to me why and where things went
wrong.

thanks anyway for the help,

kind regards

Karel Jansseune

On Thu, 27 Aug 2009 09:42:00 +0100, Gabriel Landini <[hidden email]>
wrote:

>I cannot run the code because MakeRGB() and MakeHSB() are not defined.
>
>On Thursday 27 August 2009, Karel Jansseune wrote:
>> selectWindow("double");
>> MakeRGB();
>> imageCalculator("AND", ID ,"mask");
>> selectWindow("mask");
>> close();
>
>However I do not understand what you are trying to do with this:
>
>> MakeHSB();
>> run("Invert");
>> run("Analyze Particles...", "size="+Size2+"-infinity circularity=0.00-
1.00

>> show=Nothing clear include add");
>> roiManager("Measure");
>
>It seems that you run the particle analyzer on one of the inverted hsb
>channels (without specifying which one) and without specifying a threshold
>range either?
>
>Cheers,
>
>G.