35 #include <vtkImageData.h>
36 #include <vtkImageReslice.h>
37 #include <vtkMatrix4x4.h>
39 #include <vtkImageResample.h>
40 #include <vtkImageClip.h>
67 orientator->SetInputData(image->getBaseVtkImageData());
68 orientator->SetInterpolationModeToLinear();
69 orientator->SetOutputDimensionality(3);
70 orientator->SetResliceAxes(qMd.inv().getVtkMatrix());
71 orientator->AutoCropOutputOn();
77 QString uid = image->getUid() +
"_or%1";
78 QString name = image->getName()+
" or%1";
85 oriented->get_rMd_History()->setRegistration(image->get_rMd() * qMd.inv());
86 oriented->mergevtkSettingsIntosscTransform();
97 resampler->SetInputData(image->getBaseVtkImageData());
98 resampler->SetAxisOutputSpacing(0, spacing[0]);
99 resampler->SetAxisOutputSpacing(1, spacing[1]);
100 resampler->SetAxisOutputSpacing(2, spacing[2]);
106 uid = image->getUid() +
"_res%1";
107 name = image->getName()+
" res%1";
121 Vector3D spacing(image->getBaseVtkImageData()->GetSpacing());
122 return resampleImage(dataManager, image, spacing, image->getUid()+
"_copy%1", image->getName()+
" copy%1");
131 clip->SetInputData(input);
132 clip->SetOutputWholeExtent(cropbox.begin());
139 rawResult->ComputeBounds();
149 double* sp = image->getBaseVtkImageData()->GetSpacing();
151 static_cast<int>(bb[0]/sp[0]+0.5), static_cast<int>(bb[1]/sp[0]+0.5),
152 static_cast<int>(bb[2]/sp[1]+0.5), static_cast<int>(bb[3]/sp[1]+0.5),
153 static_cast<int>(bb[4]/sp[2]+0.5), static_cast<int>(bb[5]/sp[2]+0.5));
156 QString uid = image->getUid() +
"_crop%1";
157 QString name = image->getName()+
" crop%1";
161 result->mergevtkSettingsIntosscTransform();
171 QRegExp tsReg(
"[0-9]{8}T[0-9]{6}");
172 if (tsReg.indexIn(text)>0)
vtkSmartPointer< class vtkMatrix4x4 > vtkMatrix4x4Ptr
ImagePtr resampleImage(PatientModelServicePtr dataManager, ImagePtr image, Transform3D qMd)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkImageDataPtr cropImage(vtkImageDataPtr input, IntBoundingBox3D cropbox)
boost::shared_ptr< class Image > ImagePtr
QString timestampSecondsFormat()
ImagePtr duplicateImage(PatientModelServicePtr dataManager, ImagePtr image)
ImagePtr createDerivedImage(PatientModelServicePtr dataManager, QString uid, QString name, vtkImageDataPtr raw, ImagePtr parent)
vtkSmartPointer< class vtkImageReslice > vtkImageReslicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Representation of an integer bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
vtkSmartPointer< class vtkImageResample > vtkImageResamplePtr
vtkSmartPointer< class vtkImageClip > vtkImageClipPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
QDateTime extractTimestamp(QString text)