33 #include "Core/include/DCore.h"
34 #include "Core/include/private/DSharedImage.hpp"
36 #include <vtkDICOMImageReader.h>
37 #include <vtkImageFlip.h>
38 #include <vtkSmartPointer.h>
39 #include <vtkImageReslice.h>
59 vtkSmartPointer<vtkDICOMImageReader> reader = vtkSmartPointer<vtkDICOMImageReader>::New();
60 reader->SetDirectoryName(dirName);
63 if (reader->GetOutput()->GetScalarType()!=getVtkType<T>())
65 ERR_MSG(
"Wrong image type");
66 cout <<
"vtkImageData type is " << reader->GetOutput()->GetScalarTypeAsString() << endl;
70 double spc = reader->GetDataSpacing()[0];
72 vtkSmartPointer<vtkImageReslice> reslice = vtkSmartPointer<vtkImageReslice>::New();
73 reslice->SetInputConnection(reader->GetOutputPort());
74 reslice->SetOutputSpacing(spc, spc, spc);
81 imData = reslice->GetOutput();
84 imData = reader->GetOutput();
99 RES_T readDICOM<RGB>(
const char *, Image<RGB> &,
bool )
101 return RES_ERR_NOT_IMPLEMENTED;
bool isAllocated() const
Check if the image is allocated.
Definition: DBaseImage.h:176
Main Image class.
Definition: DImage.hpp:57
virtual RES_T setSize(size_t w, size_t h, size_t d=1, bool doAllocate=true)
Set the size of image.
VTK Image Interface.
Definition: DVtkInterface.hpp:68
RES_T readDICOM(const char *dirName, Image< T > &outIm, bool autoReslice=true)
Read DICOM.
Definition: DVtkIO.hpp:57