<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi
<br> <br>I'd like to know how to run several threads when I use a multithreaded-filter (e.g., FlipImageFilter). I have compiled the next code, but only one thread is spawned. The code is:
<br><br>int main( int argc, char * argv[] )<br>{<br> typedef unsigned char PixelType;<br><br> <span style="text-decoration: underline;"> itk::MultiThreader::SetGlobalDefaultNumberOfThreads(2); </span><br><br> typedef itk::Image< PixelType, 2 > ImageType;<br><br> typedef
itk::ImageFileReader< ImageType > ReaderType;<br> typedef itk::ImageFileWriter< ImageType > WriterType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br><br> reader->SetFileName("example.jpg");<br> writer->SetFileName("example2.jpg");<br><br> typedef itk::FlipImageFilter< ImageType > FilterType;<br><br> FilterType::Pointer filter = FilterType::New();<br><br> typedef FilterType::FlipAxesArrayType FlipAxesArrayType;<br> <br> FlipAxesArrayType flipArray;<br><br> flipArray[0] = 1;<br> flipArray[1] = 0;<br><br> filter->SetFlipAxes( flipArray );<br> <br> filter->SetInput( reader->GetOutput() );<br> writer->SetInput( filter->GetOutput() );<br> writer->Update();<br> <br> return
EXIT_SUCCESS;<br>}<br><br><br> ITK toolkit and my example are compiled in Debug mode.<br><br> <br>
Thank you
<br><br>
Marķa Dolores<br></td></tr></table><br>