[Insight-users] Image filtering and feature detection-

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Mon Aug 16 11:57:50 EDT 2010


Le 16 août 10 à 17:54, Dan Mueller a écrit :

> Hi Lars,
>
> Glad that you worked it out.
>
> Cheers, Dan
>
> On 16 August 2010 17:19, Lars Friedrich Lars <lars- 
> friedrich at gmx.net> wrote:
>> Hi Dan,
>>
>> uups, I forgot the
>>
>> kernel.CreateStructuringElement();

Hi,

That's a very common mistake - I hope that it will be fixed in ITK v4,  
for example by deprecating BallStructuringElement in favor of  
FlatStructuringElement, which does not suffer that problem.

Regards,

Gaëtan

>>
>> source line!!!
>>
>> Sorry for my noise!!
>>
>> regards,
>>
>> lars
>>
>>
>> -------- Original-Nachricht --------
>>> Datum: Mon, 16 Aug 2010 16:57:35 +0200
>>> Von: "Lars Friedrich Lars" <lars-friedrich at gmx.net>
>>> An: Dan Mueller <dan.muel at gmail.com>
>>> CC: insight-users at itk.org, ryanleesmith at gmail.com
>>> Betreff: Re: [Insight-users] Image filtering and feature detection-
>>
>>> Hello Dan,
>>>
>>> thank you for the quick reply. This was the source code:
>>>
>>>
>>> #include <stdlib.h>
>>>
>>> #include <itkImageFileReader.h>
>>> #include <itkImageFileWriter.h>
>>> #include <itkImage.h>
>>> #include <itkWhiteTopHatImageFilter.h>
>>> #include <itkBinaryBallStructuringElement.h>
>>>
>>> int main(int argc, char *argv[])
>>> {
>>>   typedef itk::Image<unsigned char, 2> ImageType;
>>>   typedef itk::ImageFileReader<ImageType> ReaderType;
>>>   typedef itk::ImageFileWriter<ImageType> WriterType;
>>>   typedef itk::BinaryBallStructuringElement<unsigned char, 2>  
>>> KernelType;
>>>   typedef itk::WhiteTopHatImageFilter<ImageType, ImageType,  
>>> KernelType>
>>> FilterType;
>>>
>>>   ReaderType::Pointer r = ReaderType::New();
>>>   r->SetFileName(argv[1]);
>>>   try
>>>   {
>>>     r->Update();
>>>   }
>>>   catch (itk::ExceptionObject &e)
>>>   {
>>>     std::cerr << e << std::endl;
>>>     return EXIT_FAILURE;
>>>   }
>>>
>>>   ImageType::Pointer image = r->GetOutput();
>>>   KernelType kernel;
>>>   kernel.SetRadius(20);
>>>   FilterType::Pointer filter = FilterType::New();
>>>   filter->SetKernel(kernel);
>>>   filter->SetInput(image);
>>>   try
>>>   {
>>>     filter->Update();
>>>   }
>>>   catch (itk::ExceptionObject &e)
>>>   {
>>>     std::cerr << e << std::endl;
>>>     return EXIT_FAILURE;
>>>   }
>>>
>>>   WriterType::Pointer w = WriterType::New();
>>>   w->SetFileName(argv[2]);
>>>   w->SetInput(filter->GetOutput());
>>>   try
>>>   {
>>>     w->Update();
>>>   }
>>>   catch (itk::ExceptionObject &e)
>>>   {
>>>     std::cerr << e << std::endl;
>>>     return EXIT_FAILURE;
>>>   }
>>>
>>>   return EXIT_SUCCESS;
>>> }
>>>
>>>
>>> I have ITK 3.16 here, so I do not have the FlatStructuringElement  
>>> (without
>>> review). Maybe that's the problem?
>>>
>>> THANK YOU!
>>>
>>> lars
>>>
>>>
>>>
>>> -------- Original-Nachricht --------
>>>> Datum: Mon, 16 Aug 2010 16:49:22 +0200
>>>> Von: Dan Mueller <dan.muel at gmail.com>
>>>> An: Lars Friedrich Lars <lars-friedrich at gmx.net>
>>>> CC: ryanleesmith at gmail.com, insight-users at itk.org
>>>> Betreff: Re: [Insight-users] Image filtering and feature detection-
>>>
>>>> Hi Lars,
>>>>
>>>> I used my ITK-based scripting program called "SharpImage"
>>>>     http://www.insight-journal.org/browse/publication/161
>>>>
>>>> with the following commands
>>>>     Open "D:/Temp/wd3Yt.jpg#F2"
>>>>     MorphologicalOpen
>>> Kernel=itkFlatStructuringElement.Ball(itkSize(5,5))
>>>>     BinaryPixelMath Input1="wd3Yt.jpg"
>>>> Input2="wd3Yt_MorphologicalOpen.jpg" Operation="Sub"
>>>>     BinaryThreshold Lower=35 Upper=255
>>>>
>>>> I'm not sure why your pipeline did not work. Can you please post  
>>>> your
>>>> source code?
>>>>
>>>> HTH
>>>>
>>>> Cheers, Dan
>>>>
>>>> On 16 August 2010 16:37, Lars Friedrich Lars <lars-friedrich at gmx.net 
>>>> >
>>>> wrote:
>>>>> Hello Dan,
>>>>>
>>>>> I also tried the WhiteTopHat-filter on the image. I used a
>>>> BinaryBallStructuringElement-kernel with varying radius  
>>>> (1,3,5,6,10,20).
>>> However, I
>>>> never got an output image that was that 'clean' as the one that  
>>>> you sent
>>> on the
>>>> mailing list (wd3Yt_WhiteTopHat.jpg).
>>>>> Could you please tell me which kernel or possibly which exact  
>>>>> pipeline
>>>> did you use to produce this output? I face a comparable problem and
>>> would be
>>>> interest in your pipeline.
>>>>> Thank you very much!!
>>>>>
>>>>> regards,
>>>>> lars
>>>>>
>>>>> p.s.: I attached the produced output with radius = 5.
>>>>>
>>>>> -------- Original-Nachricht --------
>>>>>> Datum: Mon, 16 Aug 2010 06:22:12 +0200
>>>>>> Von: Dan Mueller <dan.muel at gmail.com>
>>>>>> An: Ryan Smith <ryanleesmith at gmail.com>
>>>>>> CC: insight-users at itk.org
>>>>>> Betreff: Re: [Insight-users] Image filtering and feature  
>>>>>> detection-
>>>>>
>>>>>> Hi Ryan,
>>>>>>
>>>>>> You might consider using the "white top hat" operation to  
>>>>>> remove the
>>>>>> background:
>>>>>>     WhiteTopHat = I - Dilate( Erode(I) )
>>>>>> where I is the image, Erode is morphological erosion, and  
>>>>>> Dilate is
>>>>>> morphological dilation.
>>>>>>
>>>>>> You can find an implementation of this operation in:
>>>>>>     Code/BasicFilters/itkWhiteTopHatImageFilter.h
>>>>>>
>>>>>> Once the background is removed, a simple global intensity  
>>>>>> threshold
>>>>>> should suffice to segment the spots. The following filters may be
>>>>>> helpful for that task:
>>>>>>     Code/BasicFilters/itkBinaryThresholdImageFilter.h
>>>>>>     Code/Algorithms/itkOtsuThresholdImageFilter.h
>>>>>>     Code/Review/itkKappaSigmaThresholdImageFilter.h
>>>>>>
>>>>>> HTH
>>>>>>
>>>>>> Cheers, Dan
>>>>>>
>>>>>> On 15 August 2010 23:04, Ryan Smith <ryanleesmith at gmail.com>  
>>>>>> wrote:
>>>>>>> Hi-
>>>>>>> I am attempting to remove the background and detect features  
>>>>>>> in the
>>>>>>> following image:
>>>>>>> http://i.imgur.com/wd3Yt.jpg
>>>>>>>
>>>>>>> I have a series of images in which the white circular spots  
>>>>>>> travel
>>>> and
>>>>>> the
>>>>>>> white vertical stripes remain stationary.  I would like to apply
>>>> some
>>>>>> simple
>>>>>>> background subtraction to remove the white stripes then  
>>>>>>> autodetect
>>>> the
>>>>>>> intensity maxima associated with the circular features.
>>>>>>>
>>>>>>> A brief search provided the following results which address  
>>>>>>> similar
>>>>>> problems
>>>>>>> using itkConnectedComponentFilter.  Is this what I want after my
>>>>>> background
>>>>>>> is subtracted?  Any example code on how to get the location and
>>>> sizes
>>>>>> of the
>>>>>>> components? Thanks in advance-
>>>>>>>
>>>>>>> -Ryan
>>>
>>> --
>>> GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 ¿/ 
>>> mtl.!*
>>> http://portal.gmx.net/de/go/dsl
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>
>> --
>> GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 ¿/ 
>> mtl.!*
>> http://portal.gmx.net/de/go/dsl
>>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> 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.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100816/74864c21/attachment.pgp>


More information about the Insight-users mailing list