[Insight-users] itk-gdcm, GetEntryValue & GDCM_UNFOUND identifier not found
Hsiang-Chi Kuo
kuoxgx at gmail.com
Tue Apr 21 14:26:28 EDT 2009
Hi all,
I am using the internal gdcm (1.2 version) of the itk (3.12) to do dicom
in out
application. Can anyone tell me why do I get the following error message?
Thanks.
Howard
27>..\..\..\ITK3.12\Examples\IO\DicomImageReadWrite.cxx(56) : error
C3861:
'GetEntryValue': identifier not found
27>..\..\..\ITK3.12\Examples\IO\DicomImageReadWrite.cxx(59) : error
C2065:
'GDCM_UNFOUND' : undeclared identifier
Bellow is is the code:
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkGDCMImageIO.h"
#include "gdcmFile.h"
#include <stdio.h> //sscanf
#include "gdcmCommon.h"
int main( int argc, char* argv[] )
{
if( argc < 2 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " DicomImage OutputDicomImage ";
return EXIT_FAILURE;
}
typedef unsigned int InputPixelType;
const unsigned int InputDimension = 3;
typedef itk::Image< InputPixelType, InputDimension > InputImageType;
typedef itk::ImageFileReader< InputImageType > ReaderType;
gdcm::File *f1;
f1->SetFileName( argv[1] );
f1->Load();
int linesNumber = f1->GetYSize();
int rawsNumber = f1->GetXSize();
int framesNumber = f1->GetZSize();// defaulted to 1 if not found
std::cout << "lines : " << linesNumber << " columns : " <<
rawsNumber
<< " frames : " << framesNumber << std::endl;
float xs = f1->GetXSpacing();
float ys = f1->GetYSpacing();
float zs = f1->GetZSpacing();// defaulted to 1.0 if not found
strSpacing
(0x3004,0x000c)
const std::string strSpacing = GetEntryValue(0x3004,0x000c);
const int MaxZ = 256;
float sp[MaxZ] = {1.0, 1.0} ;
if ( strSpacing != GDCM_UNFOUND )
{
if ( sscanf( strSpacing.c_str(), "%f \\ %f ", &sp[0],
&sp[1]) >2 )
zs = sp[1]-sp[0];
}
float xo = f1->GetXOrigin();
float yo = f1->GetYOrigin();
float zo = f1->GetZOrigin();
std::cout << "GetXSpacing()" << xs << std::endl;
std::cout << "GetYSpacing()" << ys << std::endl;
std::cout << "GetZSpacing()" << zs << std::endl;
std::cout << "GetXOrigin()" << xo << std::endl;
std::cout << "GetYOrigin()" << yo << std::endl;
std::cout << "GetZOrigin()" << zo << std::endl;
return EXIT_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090421/84bf8134/attachment-0001.htm>
More information about the Insight-users
mailing list