[Insight-users] question ? [Iterators into image series]
Ariel Hernán Curiale
curiale at gmail.com
Thu Jul 19 12:11:24 EDT 2012
Hi Agata,
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.
I recommend you look at the chapter 8 in the http://dfn.dl.sourceforge.net/project/itk/itk/2.4/ItkSoftwareGuide-2.4.0.pdf 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.
Saludos
__________________________________
| Ariel Hernán Curiale
| ETSI Telecomunicación
| Universidad de Valladolid
| Campus Miguel Delibes
| 47011 Valladolid, Spain
| Phone: 983-423000 ext. 5590
| Web: www.curiale.com.ar
|_________________________________
El 19/07/2012, a las 17:51, Agata Krasoń escribió:
> Hi Ariel,
>
> Thank You form reply and good advice.
> I have already made it.
> I create a function to extract a slice from Volume.
> But finally I need to make registration
> extract each slice with neighbors ( 1-2-3, 2-3-4-..)
> create a Volume (1-2-3 = volume) and register to reference Volume.
> I know that I am poor at programming ..;/
>
> int ExtractSliceFromVolume(const char * inputFilename, const char * outputFilename, int sliceNumber )
> {
>
> typedef signed short InputPixelType;
> typedef signed short OutputPixelType;
>
> typedef itk::Image< InputPixelType, 3 > InputImageType;
> typedef itk::Image< OutputPixelType, 2 > OutputImageType;
>
> typedef itk::ImageFileReader< InputImageType > ReaderType;
> typedef itk::ImageFileWriter< OutputImageType > WriterType;
>
>
> ReaderType::Pointer reader = ReaderType::New();
> WriterType::Pointer writer = WriterType::New();
>
> reader->SetFileName( inputFilename );
> writer->SetFileName( outputFilename );
>
>
> typedef itk::ExtractImageFilter< InputImageType, OutputImageType > FilterType;
> FilterType::Pointer filter = FilterType::New();
>
>
> reader->Update();
> InputImageType::RegionType inputRegion =
> reader->GetOutput()->GetLargestPossibleRegion();
>
>
>
> InputImageType::SizeType size = inputRegion.GetSize();
> size[2] = 2;
>
>
> InputImageType::IndexType start = inputRegion.GetIndex();
> start[2] = sliceNumber;
>
> InputImageType::RegionType desiredRegion;
> desiredRegion.SetSize( size );
> desiredRegion.SetIndex( start );
>
> // Then the region is passed to the filter using the
> // SetExtractionRegion() method.
>
>
>
> filter->SetExtractionRegion( desiredRegion );
>
> filter->SetInput( reader->GetOutput() );
> writer->SetInput( filter->GetOutput() );
>
> try
> {
> writer->Update();
> }
> catch( itk::ExceptionObject & err )
> {
> std::cerr << "ExceptionObject caught !" << std::endl;
> std::cerr << err << std::endl;
> return EXIT_FAILURE;
> }
>
>
>
> return EXIT_SUCCESS;
> }
>
>
> int main( int argc, char *argv[] )
> {
>
> const char * outputFilename = "";
> const char * inputFilename = "";
> const char *volume33D = "";
> std::string format = "";
> const char * refVolume3D = "";
>
> const unsigned int n=10; // number of slices
>
> typedef unsigned char PixelType;
> const unsigned int Dimension = 3;
>
> typedef itk::Image< PixelType, Dimension > ImageType;
>
> typedef itk::ImageFileReader< ImageType > ReaderType;
> typedef itk::ImageFileWriter< ImageType > WriterType;
>
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName( inputFilename );
> reader->Update();
>
> ImageType::Pointer image = reader->GetOutput();
>
>
> // iteration into all slices how extract a size of Volume ? Number of slices ?
> for (int i = 0; i < n; i ++)
> {
> for(int j = 0; j < 3; j++)
> {
>
> // Extaction 1 Slice from Volume and save to directory
> ExtractSliceFromVolume(inputFilename, outputFilename, j );
>
> }
>
> // Create a Volume from 3 Slices
> ReadSeriesCreateVolume(volume33D, format);
>
> // Algorytm RIGID Registration Volume3Slices to Reference Volume
> RigidRegistration3D(volume33D, refVolume3D);
>
> }
>
> return EXIT_SUCCESS;
> }
>
>
>
> I would appreciate for any help please.
>
> Best regards.
> Agata
>
> 2012/7/18 Ariel Hernán Curiale <curiale at gmail.com>
> Hi agatte, you can use the helper ExtractImageFilter (http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html) to extract a particular slide from a volume. You only need to set the start and size properly.
>
>
> Saludos
> __________________________________
> | Ariel Hernán Curiale
> | ETSI Telecomunicación
> | Universidad de Valladolid
> | Campus Miguel Delibes
> | 47011 Valladolid, Spain
> | Phone: 983-423000 ext. 5590
> | Web: www.curiale.com.ar
> |_________________________________
>
> El 18/07/2012, a las 15:38, agatte escribió:
>
>>
>> Hi All ITK Users ;)
>>
>> I am fresh user.
>> I want to extract each slice with two neighbors from image series.
>> For example for second slice it will be 1,2,3 and save it as volume.
>> I will have to be in a loop.
>>
>> Maybe do You have any idea or good solution for this problem ?
>> I would appreciate for any help please.
>>
>> Here I have already created function for extract odd slices from series and
>> save as volume.
>> int ReadSeriesCreateVolumeP(std::string series, const char * outputVolume1P)
>> {
>>
>>
>> typedef unsigned char PixelType;
>> const unsigned int Dimension = 3;
>>
>> typedef itk::Image< PixelType, Dimension > ImageType;
>>
>> typedef itk::ImageSeriesReader< ImageType > ReaderType;
>> typedef itk::ImageFileWriter< ImageType > WriterType;
>>
>> ReaderType::Pointer reader = ReaderType::New();
>> WriterType::Pointer writer = WriterType::New();
>>
>>
>>
>> const unsigned int first = atoi("0");
>> const unsigned int last = atoi("127");
>>
>>
>> typedef itk::NumericSeriesFileNames NameGeneratorType;
>>
>> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
>>
>>
>> nameGenerator->SetSeriesFormat( series );
>>
>> nameGenerator->SetStartIndex( first );
>> nameGenerator->SetEndIndex( last );
>> nameGenerator->SetIncrementIndex(2);
>>
>> reader->SetImageIO( itk::TIFFImageIO::New() );
>>
>> reader->SetFileNames( nameGenerator->GetFileNames() );
>>
>> writer->SetFileName(outputVolume1P);
>>
>> writer->SetInput( reader->GetOutput() );
>>
>> try
>> {
>> writer->Update();
>> std::cout << " 3d Volume saved ! " <<std::endl;
>> }
>> catch( itk::ExceptionObject & err )
>> {
>> std::cerr << "ExceptionObject caught !" << std::endl;
>> std::cerr << err << std::endl;
>> return EXIT_FAILURE;
>> }
>>
>>
>> return EXIT_SUCCESS;
>> }
>>
>>
>>
>> I would appreciate for any help please.
>>
>>
>> agatte ;)
>>
>> --
>> View this message in context: http://old.nabble.com/question----Iterators-into-image-series--tp34179149p34179149.html
>> Sent from the ITK - Users mailing list archive at Nabble.com.
>>
>> _____________________________________
>> 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.php
>>
>> 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
>
>
> _____________________________________
> 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.php
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120719/2d09166e/attachment.htm>
More information about the Insight-users
mailing list