[Insight-users] DICOM Slices :Interslice distance missing

Jim Miller millerjv at gmail.com
Sat Feb 10 09:59:37 EST 2007


Interslice distance is not specified in many DICOM series.  The most
consistent way to derive this information is from the ImagePositionPatient
and ImageOrientationPatient tags which usually defined.

When a DICOM series is read with ITK, the distance between the
ImagePositionPatient positions of two adjacent sliced is used to determine
the "spacing" in the third dimension (with pixel size used for the spacing
in the first two dimensions).  The ImageOrientationPatient fields are used
to define a coordinate frame.  The images in the series are sorted along the
third dimension of the coordinate frame (the cross product of the directions
specified in ImageOrientationPatient), and the interslice distance or
spacing is calculated as the distance between two slices along this third
dimension.

This is all done automatically by the reader.  That coordinate frame is
stored in the image Origin and Directions and the spacing is store in the
image Spacing ivars.

Jim




On 2/8/07, K. Subburaj <subburaj at iitb.ac.in> wrote:
>
>
> Hi,
>
> Yes the same. Thanks for answering my previous mail.
>
> while reading dicom images header informations, in most of the images
> interslice distance is missing. if so what is the solution, should i
> assume 1 mm, or as slice thickness, or contagious one?
>
> // My Code is
>
> const unsigned short imageTags = 7;
>
>                 std::string entryId[imageTags];
>
>                         entryId[0] = "0028|0010";       //      Rows
>                         entryId[1] = "0028|0011";       //      Columns
>                         entryId[2] = "0028|0030";       //      Pixel
> Spacing
>                         entryId[3] = "0018|0050";       //      Slice
> Thickness
>                         entryId[4] = "0018|0088";       //      Inter
> slice distance
>                         entryId[5] = "0020|0032";       //      Image
> Position Patient
>                         entryId[6] = "0020|1041";       //      Slice
> Location
>
>                 DictionaryType::ConstIterator tagItr[7];
>
>                 for(int tag = 0; tag < imageTags; tag++)
>                 {
>                         tagItr[tag] = dictionary.Find( entryId[tag] );
>                 }
>
>                 for(int tag = 0; tag < imageTags; tag++)
>                 {
>                         if( tagItr[tag] == end )
>                         {
>                                 std::cerr << "Tag " << entryId[tag];
>                                 std::cerr << " not found in the DICOM
> header" << std::endl;
>                                 //return EXIT_FAILURE;
>                         }
>                 }
>
>
> //      ---------------------------------------------------------------------------
> //      Tag Entry may or may not be of string type, so cast it to string
>
> ---------------------------------------------------------------------------
>
>                 MetaDataStringType::ConstPointer entryvalue[ imageTags];
>                 std::string tagvalue[imageTags];
>
>                 for(int tag=0; tag < imageTags; tag++)
>                 {
>                         entryvalue[tag] = dynamic_cast<const
> MetaDataStringType *>(
> tagItr[tag]->second.GetPointer() );
>
>                         if( entryvalue > 0 )
>                         {
>                                 tagvalue[tag] =
> entryvalue[tag]->GetMetaDataObjectValue();
>                                 if (tag == 0)
>                                 {
>                                         std::cout << "Rows (" <<
> entryId[tag] <<  ") ";
>                                         std::cout << " is: " <<
> tagvalue[tag] << std::endl;
>                                 }
>                         }
>                         else
>                         {
>                                 std::cerr << "Entry was not of string
> type" << std::endl;
>                                 return EXIT_FAILURE;
>                         }
>                 }
>
>
> Thank / Subbu
>
> //
>
>
>
> //------------------------------------------------------------------------------------
> K. Subburaj wrote:
> > Hi,
> >
> > I need to know how to get the "number of slices stacked" while reading
> > bunch of DICOM Images (single series number) from a directory.
> >
> > Can anyone help me to get answer?
>
> Hi SUbbu,
>
>         Are you looking for the number of slices that will be read ? I
> believe
> you can simply count the number of filenames in the output of the
> itk::GDCMSeriesFileNames
>
>    typedef itk::GDCMSeriesFileNames                SeriesFileNames;
>    SeriesFileNames::Pointer it = SeriesFileNames::New();
>    it->SetInputDirectory( argv[1] );
>    const ReaderType::FileNamesContainer & filenames =
> it->GetInputFileNames();
>    unsigned int numberOfFilenames =  filenames.size();
>    std::cout << numberOfFilenames << std::endl;
>
>
> HTH
> -Mathieu
>
>
>
> --------------------------------------------------------------------------
> Subburaj Karuppasamy                  | Res.: H-1 /# 219
> Research Scholar                      |       IIT Bombay, Powai
> Prof. B.Ravi's Lab                    |       Mumbai - 400 076
> Dept. of Mechanical Engg.             | Tel.: +91 22 2576 7510 (Lab.)
> Indian Institute of Technology Bombay | Cell: +91 98 6915 2700
> Powai, Mumbai - 400 076, India        | URL : www.me.iitb.ac.in/~subbu
> --------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070210/c0b3a138/attachment-0001.htm


More information about the Insight-users mailing list