[Insight-users] DICOM Slices :Interslice distance missing
K. Subburaj
subburaj at iitb.ac.in
Thu Feb 8 15:47:47 EST 2007
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
--------------------------------------------------------------------------
More information about the Insight-users
mailing list