[Insight-users] How to use the code in testing ? itkVoronoiSegmentationImageFilter

Luis Ibanez luis.ibanez at kitware.com
Wed Mar 25 21:35:41 EDT 2009


Hi x0_y0_0,


This particular test is probably not a good exmple of how to use
the filter.


You can get rid of most of the code before line 88,


You just need:


   typedef itk::Image<unsigned short,2> UShortImage;
   typedef itk::Image<unsigned char,2>  PriorImage;
   typedef itk::VoronoiSegmentationImageFilter<
      UShortImage, UShortImage, PriorImage> VorSeg;

   VorSeg::Pointer testVorseg(VorSeg::New());

   typedef itk::ImageFileReader< UShoftImage > ReaderType;
   ReaderType::Pointer reader = ReaderType::New();

   reader->SetFileName( argv[1] );

   testVorseg->SetInput( reader->GetOutput() );
   testVorseg->SetMean(520);
   testVorseg->SetSTD(20);
   testVorseg->SetMeanTolerance(10);
   testVorseg->SetSTDTolerance(20);
   testVorseg->SetNumberOfSeeds(400);
   testVorseg->SetSteps(5);

   std::cout << "Running algorithm" << std::endl;
   testVorseg->Update();

   typedef itk::ImageFileWriter< UShoftImage > WriterType;
   WriterType::Pointer writer = WriterType::New();

   writer->SetFileName( argv[2] );

   writer->SetInput( testVorseg->GetOutput() );
   writer->Update();



   Regards,


      Luis


----------------
x0_y0_0 wrote:
> Hi,Luis,
>    thank you help!It could recompile and recompile,but I don't know how 
> to input the image and output the result.It seems no Parameters  for 
> input and output.Could you tell me how to replace the parameters like 
> argv[1] or how to input the image ? thanks!
>  
> regards,
>                                                                               
> mexiao
> 
> 
> 
> ÔÚ2009-03-26 02:16:56£¬"Luis Ibanez" <luis.ibanez at kitware.com> дµÀ£º
>>
>>Hi x0_y0_0,
>>
>>Simply go to line 29 and replace the function name
>>
>>
>>     int itkVoronoiSegmentationImageFilterTest(
>>
>>
>>with
>>
>>               int main(
>>
>>Then,
>>
>>    * recompile
>>    * run
>>    * enjoy
>>
>>
>>
>>   Regards,
>>
>>
>>       Luis
>>
>>
>>
>>---------------------
>>x0_y0_0 wrote:
>>> 
>>> Hi,
>>>      I want to use itkVoronoiSegmentationImageFilterTest.cxx to Segment 
>>> the image,but I don't kown how to write a call back function to do 
>>> it.Could someone give me some help or some examples ? thanks!
>>>  
>>>  
>>>    regards,
>>>                                                                                  
>>> mexiao
>>> 
>>> 
>>> ------------------------------------------------------------------------
>>> ÍøÒ×ÓÊÏ䣬ÖйúµÚÒ»´óµç×ÓÓʼþ·þÎñÉÌ <http://www.yeah.net>
>>> 
>>> 
>>> ------------------------------------------------------------------------
>>> 
>>> _____________________________________
>>> Powered by www.kitware.com
>>> 
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.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
> 
> 
> 
> ------------------------------------------------------------------------
> ÍøÒ×ÓÊÏ䣬ÖйúµÚÒ»´óµç×ÓÓʼþ·þÎñÉÌ <http://www.yeah.net>


More information about the Insight-users mailing list