[Insight-users] Pixels greater than 0 in an image

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Fri May 16 11:01:01 EDT 2008


Hi,

A cleaner (and heavier) alternative would be to refactor the  
OtsuThresholdImageCalculator to take a itk::Statistics::Histogram as  
input.
That way, it would be possible to use the mask capability of the  
histogram generator, and it would make a nice contribution to the  
insight journal :-)

Regards,

Gaëtan


Le 14 mai 08 à 00:02, Luis Ibanez a écrit :

>
> Hi Suyang,
>
> You are probably right in that there are other placed in the code
> that need to be modified.
>
> The other alternatives that came to mind were related to using the
> IntensityWindowingImageFilter in order to make all your negative  
> pixels
> to be set to zero, but I'm afraid that this will overpopulate the
> histogram bin of the zero value, and shift the Otsu threshold from
> the value that you would obtain by simply ignoring all negative  
> values.
>
>
> There must be many other options that are simply escaping me now...
>
>
>
>                Suggestions anyone ??
>
>
>
>   Thanks
>
>
>      Luis
>
>
> --------------------
> Suyang Mei wrote:
>>  Thanks a lot, Luis, for your prompt response and goog suggestions.
>>   I looked into the code itkOtsuThresholdImageCalculator.txx,  
>> besides the two places you pointed out need to change, I guess  
>> there are other places need to modify, like totalPixels, imageMin,  
>> these numbers will be different from with 0s and without 0s.
>>   Definitely it is a way to solve my problem, just wonder if there  
>> are any other alternative ways to go...
>>   Thanks again for you rhelp.
>> Suyang
>> */Luis Ibanez <luis.ibanez at kitware.com>/* wrote:
>>    Hi Suyang,
>>    After looking at the code of the  
>> itkOtsuThresholdImageCalculator.txx
>>    the simplest solution seems to be insert an "infamous" if  
>> statement
>>    in line 97, inside the while loop of the iterator, something like:
>>    if( value <= 0 )
>>    {
>>    ++iter;
>>    continue;
>>    }
>>    and also in line 72 add:
>>    if( imageMin < 0 )
>>    {
>>    imageMin;
>>    }
>>    You could generalize this to any given value K (instead of zero),
>>    modify the name of the otsu threshold calculator class, and  
>> submit it
>>    as a contribution to the Insight Journal, or submit it as a  
>> feature
>>    request to the bug tracker.
>>    Just to clarify,:what we are suggesting is that you modify your  
>> local
>>    copy of the itkOtsuThresholdImageCalculator class, in order to add
>>    this functionality. Renaming the files will help you have access  
>> to
>>    the new class as well as to the current ITK implementation.
>>    Regards,
>>    Luis
>>    -------------------
>>    Suyang Mei wrote:
>>     > Hi, ITK experts -
>>     >
>>     > I have a simple question, just want to get some advice from -
>>     >
>>     > I have an image, and I want to calculate the Ostu threshold  
>> only
>>    using
>>     > the positive pixels in the image.
>>     >
>>     > What is the best way to proceed?
>>     >
>>     > Thanks a lot in advance.
>>     >
>>     > Suyang
>>     >
>>     >
>>     >
>>     >
>>     
>> ------------------------------------------------------------------------
>>     >
>>     > _______________________________________________
>>     > Insight-users mailing list
>>     > Insight-users at itk.org
>>     > http://www.itk.org/mailman/listinfo/insight-users
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.mandriva.org
http://www.itk.org  http://www.clavier-dvorak.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080516/585571ec/attachment.pgp>


More information about the Insight-users mailing list