<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv1985668164"><table id="yiv1985668164bodyDrftID" class="yiv1985668164" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td id="yiv1985668164drftMsgContent" style="font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; font-family: arial; font-size: 10pt;"><div id="yiv1985668164"><table id="yiv1985668164bodyDrftID" class="yiv1985668164" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td id="yiv1985668164drftMsgContent" style="font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; font-family: arial; font-size: 10pt;">Hi<br><br>I'm starting to use ITK toolkit and I'm interested in working using several threads. Until now, I have been doing tests using "itkFlipImageFilter"
(according to ITK documentation, it's a multhreaded filter). The main program runs fine, but I think only one thread is spawned because I switch on/off one core and execution times are similar (I'm working on Linux and processor has 2 cores). I compile the next code (this example is provided
by ITK toolkit):<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>Thank you<br><br>P.S. Sorry, my English is not very good.<br></td></tr></tbody></table></div></td></tr></tbody></table></div></td></tr></table><br>