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

Richard Beare richard.beare at gmail.com
Fri May 16 21:06:56 EDT 2008


Hi all,

Another option is the MaskAdaptor class I wrote a while ago. This
takes a mask, which in this case would be the positive pixels
generated using a threshold operation, extracts them, feeds then
through any pixel wise class, such as OtsuThresholding and puts the
results back into the correct locations. The IJ entry is

http://hdl.handle.net/1926/575

On Sat, May 17, 2008 at 6:46 AM, Luca Antiga <luca.antiga at gmail.com> wrote:
> Hi all,
> OtsuMultipleThresholdsCalculator already takes a histogram in input
> and produces a vector of thresholds (I contributed that class a while
> ago).
> Set the number of thresholds to one and you should be done.
>
> Luca
>
>
> On 5/16/08, Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr> wrote:
>>
>> 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
>>
>>
>
> --
> Sent from Gmail for mobile | mobile.google.com
>
> Luca Antiga, PhD
>  Biomedical Technologies Laboratory
>  Bioengineering Department,
>  Mario Negri Institute
> mail: Villa Camozzi, 24020, Ranica (BG), Italy
> phone: +39 035 4535-381
> email: antiga at marionegri.it
> web: http://villacamozzi.marionegri.it/~luca
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list