[Insight-users] ExtractImageFilter and ImageSeriesReader
John Drescher
drescherjm at gmail.com
Mon Sep 7 14:49:09 EDT 2009
On Mon, Sep 7, 2009 at 12:37 PM, Ralf Denhof<ralf.denhof at gmx.de> wrote:
> My code ist like the following:
>
> typedef float InputPixelType;
> typedef itk::Image< InputPixelType, 3 > InputImageType;
> typedef itk::ImageSeriesReader< InputImageType > ReaderType;
> typedef itk::GDCMImageIO ImageIOType;
> typedef itk::GDCMSeriesFileNames NamesGeneratorType;
> typedef std::vector< std::string > FileNamesContainer;
>
> std::string seriesIdentifierCT;
> FileNamesContainer fileNamesCT;
> NamesGeneratorType::Pointer nameGenerator;
> ImageIOType::Pointer dicomIO;
>
> ReaderType::Pointer reader = ReaderType::New();
> dicomIO = ImageIOType::New();
> nameGenerator = NamesGeneratorType::New();
>
> reader->SetImageIO( dicomIO );
> nameGenerator->SetDirectory("C:\\images");
> seriesIdentifierCT = "1.3.12.2.1107.5.1.4.33023.4.0.6777559093481830"
> fileNamesCT = nameGenerator->GetFileNames( seriesIdentifierCT );
> reader->SetFileNames( fileNamesCT );
>
> this->reader->Update();
>
> filter = FilterType::New();
>
> InputImageType::RegionType inputRegion =
> reader->GetOutput()->GetLargestPossibleRegion();
> InputImageType::SizeType size = inputRegion.GetSize();
> size[2] = 0;
> InputImageType::IndexType start = inputRegion.GetIndex();
> const unsigned int sliceNumber = 25;
> start[2] = sliceNumber;
> VolumenOutputImageType::RegionType desiredRegion;
> desiredRegion.SetSize( size );
> desiredRegion.SetIndex( start );
> filter->SetExtractionRegion( desiredRegion );
>
I think you want size[2]=1 instead of size[2]=0
John
More information about the Insight-users
mailing list