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

Miller, James V (Research) millerjv at crd.ge.com
Fri May 27 15:23:18 EDT 2005


Kingaza, 

It sounds like all the files in your 4D dataset are in the 
same DICOM series.  This is why they appeared as a 512x512x240
dataset when you read them all in.

We have discussed a solution to this problem amongst the ITK
developers.  Basically, we will be adding an ability to the 
GDCMSeriesFileNames to select files not
only that belong to the same series but also have some other DICOM
tag in common.  The hope is that all the images at one time step
will have the same value for some other DICOM tag where that value
is different for images at other time points.  We have a similar
issue with some MR acquisitions.

You might be able to do this with ITK now but you'd have to write
some code.  I believe that if you read in all the files using GDCM, 
then you can get an array of MetaDataDictionaries attached to the 
GDCMImageIO.  These dictionaries contain all the tags from the 
files, one dictionary per file.  You could run through these
dictionaries and find which entries have the unique tags for the 
timepoint you want.  Then you can filter down the original list 
of files given to the ImageSeriesReader and rerun the reader.

Jim



-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Mark Wyszomierski
Sent: Friday, May 27, 2005 1:00 PM
To: kingaza at gmail.com
Cc: insight-users at itk.org; Luis Ibanez
Subject: Re: [Insight-users] Re: how to select all the slices in the
sameframe?


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
>
_______________________________________________
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