[Insight-users] Re: how to select all the slices in the same frame?

Mark Wyszomierski markww at gmail.com
Fri May 27 12:59:52 EDT 2005


kingaza,

Are you specifically looking for an ITK solution? The dicom files
should have time attributes in their tags so you can specifically pull
out the timepoint images. I myself use series time and series number
to do this.

Mark

On 5/27/05, kingaza at gmail.com <kingaza at gmail.com> wrote:
> I am so sorry, for i just thought it is the question many people would
> encounter, and i also thought a little short words are enough.
> 
> now i should discribe the details
> the series is a 4D dataset with the size 512*512*40*6 (3D: 512*512*40,
> time: 6), and all the files are 2D slices, that means 240 files in a
> folder.
> now i want to get all the slices in the time t, for example, t = 0,
> 1,...5, so at the end i should get 6 volumes in size of 512*512*40.
> 
> could you tell me how could I implement it?
> 
> 
> btw, after your previous email, I have tried the filter
> ExtractImageFilter, but I don't know how to read the series data set
> accurately, and the result is not what i expect: it told me that the
> size is 512*512*240*1
>          =========== lost *1 last time
> 
> could any one help me?
> 
> Regrads,
> Kingaza
> 
> here are my codes:
> 
> typedef itk::Image<unsigned char, 4> BinaryImage4DType;
> typedef itk::ImageFileReader<BinaryImage4DType> BinaryReader4DType;
> typedef itk::ImageSeriesReader<BinaryImage4DType>
> BinaryReader4DSeriesType;
> typedef itk::GDCMImageIO DicomImageIOType;
> typedef itk::GDCMSeriesFileNames DicomSeriesFileNames;
> 
> DicomImageIOType::Pointer dcmIO = DicomImageIOType::New();
> DicomSeriesFileNames::Pointer   series = DicomSeriesFileNames::New();
> typedef vector<string> FileNamesContainer;
> BinaryReader4DSeriesType::Pointer reader4d = BinaryReader4DSeriesType::New();
> series->SetInputDirectory( "E:\\series" );
> FileNamesContainer filenames = series->GetInputFileNames();
> 
> reader4d->SetFileNames( filenames );
> reader4d->SetImageIO( dcmIO );
> 
> try
> {
>       reader4d->Update();
> }
> catch (itk::ExceptionObject &excp)
> {
>       cerr << "Exception thrown while writing the image" << endl;
>       cerr << excp << endl;
> }
> 
> typedef itk::ExtractImageFilter< BinaryImage4DType, BinaryImage3DType
> > FilterType;
> FilterType::Pointer filter = FilterType::New();
> 
> BinaryImage4DType::RegionType inputRegion =
> reader4d->GetOutput()->GetLargestPossibleRegion();
> 
> BinaryImage4DType::SizeType size = inputRegion.GetSize();
> BinaryImage4DType::IndexType start = inputRegion.GetIndex();
> 
> 
> On 5/22/05, kingaza at gmail.com <kingaza at gmail.com> wrote:
> > Hi Luis
> >
> > I am so sorry, for i just thought it is the question many people would
> > encounter, and i also thought a little short words are enough.
> >
> > now i should discribe the details
> > the series is a 4D dataset with the size 512*512*40*6 (3D: 512*512*40,
> > time: 6), and all the files are 2D slices, that means 240 files in a
> > folder.
> > now i want to get all the slices in the time t, for example, t = 0,
> > 1,...5, so at the end i should get 6 volumes in size of 512*512*40.
> >
> > could you tell me how could I implement it?
> >
> >
> > btw, after your previous email, I have tried the filter
> > ExtractImageFilter, but I don't know how to read the series data set
> > accurately, and the result is not what i expect: it told me that the
> > size is 512*512*240
> >
> > here are my codes:
> >
> > typedef itk::Image<unsigned char, 4> BinaryImage4DType;
> > typedef itk::ImageFileReader<BinaryImage4DType> BinaryReader4DType;
> > typedef itk::ImageSeriesReader<BinaryImage4DType>       BinaryReader4DSeriesType;
> > typedef itk::GDCMImageIO DicomImageIOType;
> > typedef itk::GDCMSeriesFileNames DicomSeriesFileNames;
> >
> > DicomImageIOType::Pointer dcmIO = DicomImageIOType::New();
> > DicomSeriesFileNames::Pointer   series = DicomSeriesFileNames::New();
> > typedef vector<string> FileNamesContainer;
> > BinaryReader4DSeriesType::Pointer reader4d = BinaryReader4DSeriesType::New();
> > series->SetInputDirectory( "E:\\series" );
> > FileNamesContainer filenames = series->GetInputFileNames();
> >
> > reader4d->SetFileNames( filenames );
> > reader4d->SetImageIO( dcmIO );
> >
> > try
> > {
> >        reader4d->Update();
> > }
> > catch (itk::ExceptionObject &excp)
> > {
> >        cerr << "Exception thrown while writing the image" << endl;
> >        cerr << excp << endl;
> > }
> >
> > typedef itk::ExtractImageFilter< BinaryImage4DType, BinaryImage3DType
> > > FilterType;
> > FilterType::Pointer filter = FilterType::New();
> >
> > BinaryImage4DType::RegionType inputRegion =
> > reader4d->GetOutput()->GetLargestPossibleRegion();
> >
> > BinaryImage4DType::SizeType size = inputRegion.GetSize();
> > BinaryImage4DType::IndexType start = inputRegion.GetIndex();
> >
> >
> >
> > On 5/19/05, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> > >
> > >
> > > Hi Kingaza,
> > >
> > >
> > > Thanks for the additional bit of information.
> > >
> > >
> > >     Five more emails like this one and we
> > >     will be able to figure out what you need .    :-)
> > >
> > >
> > >
> > > You see... when you write short emails...
> > > you end up writing many of them.
> > >
> > > It will be wiser to provide a full description of
> > > your problem in a single shot so we don't have to
> > > go in "interrogatory mode".
> > >
> > >
> > >
> > > How about you let us know if you are reading this
> > > time series from DICOM files or from other means ?
> > >
> > >
> > > ---
> > >
> > >
> > > ITK will allow you to proces 4D datasets in a native
> > > way.  In principle, getting a 3D frame at a time "t"
> > > out of a 4D dataset is as simple as instantiating
> > > the ExtractImageFilter and just setting the region
> > > to be extracted.
> > >
> > >
> > > However,
> > >     chances are that you are by now just trying
> > > to bring your 4D data set from disk into memory.
> > >
> > >
> > > Hopefully we will know that in the next episode
> > > of your problem description      :-)
> > >
> > >
> > >
> > >    Please let us know,
> > >
> > >
> > >
> > >        Thanks
> > >
> > >
> > >
> > >           Luis
> > >
> > >
> > >
> > >
> > > --------------------------
> > > kingaza at gmail.com wrote:
> > >
> > > > Hi Luis,
> > > >
> > > > yes, i mean time series (3D+t), and i want to seek out all the slices
> > > > in a certain t0
> > > >
> > > > Regards,
> > > > Kingaza
> > > >
> > > > On 5/19/05, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> > > >
> > > >>Hi Kingaza,
> > > >>
> > > >>Please provide more information regarding your problem.
> > > >>
> > > >>ITK in itself doesn't have a notion of "frames".
> > > >>
> > > >>Are you talking about visualization ?
> > > >>or about time series ?
> > > >>
> > > >>
> > > >>
> > > >>    Thanks
> > > >>
> > > >>
> > > >>       Luis
> > > >>
> > > >>
> > > >>
> > > >>-------------------------
> > > >>kingaza at gmail.com wrote:
> > > >>
> > > >>
> > > >>>Hi all
> > > >>>
> > > >>>I wonder if there is such a method...
> > > >>>
> > > >>>Regards,
> > > >>>Kingaza
> > > >>>_______________________________________________
> > > >>>Insight-users mailing list
> > > >>>Insight-users at itk.org
> > > >>>http://www.itk.org/mailman/listinfo/insight-users
> > > >>>
> > > >>>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list