<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Agata,<div><br></div><div>The algorithm used in the registration process depends to the particular application and the images involve, for example you can use speckle tracking for Ultrasound images or you can use Diffeomorphic Demos if you want to get a diffeomorphic displacement.</div><div><br></div><div>I recommend you look at the chapter 8 in the <a href="http://dfn.dl.sourceforge.net/project/itk/itk/2.4/ItkSoftwareGuide-2.4.0.pdf">http://dfn.dl.sourceforge.net/project/itk/itk/2.4/ItkSoftwareGuide-2.4.0.pdf</a> to understand the ITK process involve into the registration (optimizer, metric, transformation and interpolation) and remember that in the folder example into the source code you can find too many examples.</div><div><br></div><div><br></div><div><div apple-content-edited="true">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; "><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">Saludos</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">__________________________________<br><font class="Apple-style-span" color="#b7bfc5">|</font> Ariel Hernán Curiale<br><font class="Apple-style-span" color="#b7bfc5">|</font> ETSI Telecomunicación<br><font class="Apple-style-span" color="#b7bfc5">|</font> Universidad de Valladolid<br><font class="Apple-style-span" color="#b7bfc5">|</font> Campus Miguel Delibes<br><font class="Apple-style-span" color="#b7bfc5">|</font> 47011 Valladolid, Spain<br><font class="Apple-style-span" color="#b7bfc5">|</font> Phone: 983-423000 ext. 5590</div><div><font class="Apple-style-span" color="#b7b7b7" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">|</font> Web: <a href="http://www.curiale.com.ar/"><font class="Apple-style-span" color="#084ebe">www.curiale.com.ar</font></a><br><font class="Apple-style-span" color="#b7b7b7" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">|</font><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; color: rgb(0, 0, 0); ">_________________________________</span></div></div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div>
</div>
<br><div><div>El 19/07/2012, a las 17:51, Agata Krasoń escribió:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Ariel,<div><br></div><div>Thank You form reply and good advice.</div><div>I have already made it.</div><div>I create a function to extract a slice from Volume.</div><div>But finally I need to make registration</div><div>
extract each slice with neighbors ( 1-2-3, 2-3-4-..)</div><div>create a Volume (1-2-3 = volume) and register to reference Volume.</div><div>I know that I am poor at programming ..;/</div><div><br></div><div><div>int ExtractSliceFromVolume(const char * inputFilename, const char * outputFilename, int sliceNumber )</div>
<div>{</div><div> </div><div> typedef signed short InputPixelType;</div><div> typedef signed short OutputPixelType;</div><div><br></div><div> typedef itk::Image< InputPixelType, 3 > InputImageType;</div>
<div> typedef itk::Image< OutputPixelType, 2 > OutputImageType;</div><div><br></div><div> typedef itk::ImageFileReader< InputImageType > ReaderType;</div><div> typedef itk::ImageFileWriter< OutputImageType > WriterType;</div>
<div><br></div><div><br></div><div> ReaderType::Pointer reader = ReaderType::New();</div><div> WriterType::Pointer writer = WriterType::New();</div><div><br></div><div> reader->SetFileName( inputFilename );</div><div>
writer->SetFileName( outputFilename );</div><div><br></div><div><br></div><div> typedef itk::ExtractImageFilter< InputImageType, OutputImageType > FilterType;</div><div> FilterType::Pointer filter = FilterType::New();</div>
<div><br></div><div><br></div><div> reader->Update();</div><div> InputImageType::RegionType inputRegion =</div><div> reader->GetOutput()->GetLargestPossibleRegion();</div><div> </div><div><br></div><div>
<br></div><div> InputImageType::SizeType size = inputRegion.GetSize();</div><div> size[2] = 2;</div><div><br></div><div><br></div><div> InputImageType::IndexType start = inputRegion.GetIndex();</div><div> start[2] = sliceNumber;</div>
<div><br></div><div> InputImageType::RegionType desiredRegion;</div><div> desiredRegion.SetSize( size );</div><div> desiredRegion.SetIndex( start );</div><div><br></div><div> // Then the region is passed to the filter using the</div>
<div> // SetExtractionRegion() method.</div><div><br></div><div><br></div><div><br></div><div> filter->SetExtractionRegion( desiredRegion );</div><div><br></div><div> filter->SetInput( reader->GetOutput() );</div>
<div> writer->SetInput( filter->GetOutput() );</div><div> </div><div> try </div><div> { </div><div> writer->Update(); </div><div> } </div><div> catch( itk::ExceptionObject & err ) </div><div> { </div>
<div> std::cerr << "ExceptionObject caught !" << std::endl; </div><div> std::cerr << err << std::endl; </div><div> return EXIT_FAILURE;</div><div> } </div><div><br></div><div>
<br></div><div><br></div><div> return EXIT_SUCCESS;</div><div>}</div></div><div><br></div><div><br></div><div><div>int main( int argc, char *argv[] )</div><div>{</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>const char * outputFilename = "";</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>const char * inputFilename = "";</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>const char *volume33D = "";</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>std::string format = "";</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>const char * refVolume3D = "";</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span></div><div> const unsigned int n=10; // number of slices</div><div><br></div><div> typedef unsigned char PixelType;</div><div> const unsigned int Dimension = 3;</div>
<div><br></div><div> typedef itk::Image< PixelType, Dimension > ImageType;</div><div><br></div><div> typedef itk::ImageFileReader< ImageType > ReaderType;</div><div> typedef itk::ImageFileWriter< ImageType > WriterType;</div>
<div><br></div><div> ReaderType::Pointer reader = ReaderType::New(); </div><div> reader->SetFileName( inputFilename );</div><div> reader->Update();</div><div><br></div><div> ImageType::Pointer image = reader->GetOutput();</div>
<div> </div><div><br></div><div><font color="#ff0000"> </font><span style="background-color:rgb(204,0,0)"> // iteration into all slices how extract a size of Volume ? Number of slices ?</span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>for (int i = 0; i <<font color="#cc0000"> n</font>; i ++)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>{ </div><div><span class="Apple-tab-span" style="white-space:pre">        </span> for(int j = 0; j < 3; j++)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> {</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        <span style="background-color:rgb(255,0,0)">        </span></span><span style="background-color:rgb(255,0,0)">// Extaction 1 Slice from Volume and save to directory</span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> ExtractSliceFromVolume(inputFilename, outputFilename, j );</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> }</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><span style="background-color:rgb(255,0,0)"> // Create a Volume from 3 Slices </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> ReadSeriesCreateVolume(volume33D, format);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><span style="background-color:rgb(204,0,0)"> // Algorytm RIGID Registration Volume3Slices to Reference Volume</span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> RigidRegistration3D(volume33D, refVolume3D);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>return EXIT_SUCCESS;</div>
<div>}</div></div><div><br></div><div><br></div><div><br></div><div>I would appreciate for any help please.</div><div><br></div><div>Best regards.</div><div>Agata<br><br><div class="gmail_quote">2012/7/18 Ariel Hernán Curiale <span dir="ltr"><<a href="mailto:curiale@gmail.com" target="_blank">curiale@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi agatte, you can use the helper ExtractImageFilter (<a href="http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html</a>) to extract a particular slide from a volume. You only need to set the start and size properly.<div>
<div><br></div><div><br><div>
<div style="word-wrap:break-word"><div style="word-wrap:break-word"><span style="border-collapse:separate;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<div><div style="font-style:normal;font-size:medium;font-family:Helvetica;font-weight:normal"><div style="font-style:normal;font-size:medium;font-family:Helvetica;font-weight:normal">Saludos</div><div style="font-style:normal;font-size:medium;font-family:Helvetica;font-weight:normal">
__________________________________<br><font color="#b7bfc5">|</font> Ariel Hernán Curiale<br><font color="#b7bfc5">|</font> ETSI Telecomunicación<br><font color="#b7bfc5">|</font> Universidad de Valladolid<br><font color="#b7bfc5">|</font> Campus Miguel Delibes<br>
<font color="#b7bfc5">|</font> 47011 Valladolid, Spain<br><font color="#b7bfc5">|</font> Phone: 983-423000 ext. 5590</div><div><font color="#b7b7b7" style="font-family:Helvetica;font-size:medium;font-weight:normal;font-style:normal">|</font> Web: <a href="http://www.curiale.com.ar/" target="_blank"><font color="#084ebe">www.curiale.com.ar</font></a><br>
<font color="#b7b7b7" style="font-family:Helvetica;font-size:medium;font-weight:normal;font-style:normal">|</font><span style="font-style:normal;font-size:medium;font-family:Helvetica;font-weight:normal">_________________________________</span></div>
</div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></div>
</div>
<br><div><div>El 18/07/2012, a las 15:38, agatte escribió:</div><div><div class="h5"><br><blockquote type="cite"><div><br>Hi All ITK Users ;)<br><br>I am fresh user.<br>I want to extract each slice with two neighbors from image series.<br>
For example for second slice it will be 1,2,3 and save it as volume.<br>I will have to be in a loop.<br><br>Maybe do You have any idea or good solution for this problem ? <br>I would appreciate for any help please.<br><br>
Here I have already created function for extract odd slices from series and<br>save as volume. <br>int ReadSeriesCreateVolumeP(std::string series, const char * outputVolume1P)<br>{<br><br><span style="white-space:pre-wrap">        </span><br>
typedef unsigned char PixelType;<br> const unsigned int Dimension = 3;<br><br> typedef itk::Image< PixelType, Dimension > ImageType;<br><br> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br>
typedef itk::ImageFileWriter< ImageType > WriterType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br><br><br><br> const unsigned int first = atoi("0");<br>
const unsigned int last = atoi("127");<br><br><br> typedef itk::NumericSeriesFileNames NameGeneratorType;<br><br> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();<br><br><br> nameGenerator->SetSeriesFormat( series );<br>
<br> nameGenerator->SetStartIndex( first );<br> nameGenerator->SetEndIndex( last );<br> nameGenerator->SetIncrementIndex(2);<br><br> reader->SetImageIO( itk::TIFFImageIO::New() );<br><br> reader->SetFileNames( nameGenerator->GetFileNames() );<br>
<br> writer->SetFileName(outputVolume1P);<br><br> writer->SetInput( reader->GetOutput() );<br><br> try <br> { <br> writer->Update(); <br><span style="white-space:pre-wrap">        </span>std::cout << " 3d Volume saved ! " <<std::endl;<br>
} <br> catch( itk::ExceptionObject & err ) <br> { <br> std::cerr << "ExceptionObject caught !" << std::endl; <br> std::cerr << err << std::endl; <br> return EXIT_FAILURE;<br>
} <br><br><br> return EXIT_SUCCESS;<br>}<br><br><br><br>I would appreciate for any help please.<br><br><br>agatte ;)<br><br>-- <br>View this message in context: <a href="http://old.nabble.com/question----Iterators-into-image-series--tp34179149p34179149.html" target="_blank">http://old.nabble.com/question----Iterators-into-image-series--tp34179149p34179149.html</a><br>
Sent from the ITK - Users mailing list archive at <a href="http://Nabble.com/" target="_blank">Nabble.com</a>.<br><br>_____________________________________<br>Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
<br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br></div></blockquote></div></div></div><br>
</div></div></div><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></body></html>