[Insight-users] My God , I just want to read a dcm file and write to dcm file , Please help me

章强 15891495523 at 126.com
Wed Jul 24 10:01:01 EDT 2013


Dear 
       I just want to read a dcm file and write to dcm file , but when I run my code , something confuse me happened .
 
and My code is :
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkGDCMImageIO.h"


#include <list>
#include <fstream>


int main()
{
  typedef signed short InputPixelType;
  const unsigned int   InputDimension = 3;


  typedef itk::Image< InputPixelType, InputDimension > InputImageType;


  typedef itk::ImageFileReader< InputImageType > ReaderType;


  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName( "C:\\Users\\zhq\\Desktop\\data\\pdVISTA\\E403434298\\E403434298S1601I1.dcm" );


  typedef itk::GDCMImageIO           ImageIOType;


  ImageIOType::Pointer gdcmImageIO = ImageIOType::New();


  reader->SetImageIO( gdcmImageIO );


  reader->Update();


  typedef itk::ImageFileWriter< InputImageType >  Writer1Type;


  Writer1Type::Pointer writer1 = Writer1Type::New();


  writer1->SetFileName( "C:\\Users\\zhq\\Desktop\\2.dcm" );
  writer1->SetInput( reader->GetOutput() );


  writer1->SetImageIO( gdcmImageIO );


  writer1->Update();


}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130724/50bc11e7/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.jpg
Type: image/jpeg
Size: 137343 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130724/50bc11e7/attachment-0001.jpg>


More information about the Insight-users mailing list