35 #include <QApplication> 39 #include "vtkImageData.h" 60 return "resample_image_filter";
67 "<p><i>Resample the volume into the space of the reference volume. Also crop to the same volume.</i></p>" 74 "mm Margin added to ref image bounding box",
88 temp->setValueName(
"Input");
89 temp->setHelp(
"Select input to be resampled");
93 temp->setValueName(
"Reference");
94 temp->setHelp(
"Select reference. Resample input into this coordinate system and bounding box");
103 temp->setValueName(
"Output");
104 temp->setHelp(
"Output thresholded binary image");
122 if (!input || !reference)
126 double margin = marginOption->getValue();
128 Transform3D refMi = reference->get_rMd().inv() * input->get_rMd();
131 Transform3D orient_M_ref = oriented->get_rMd().inv() * reference->get_rMd();
135 bb_crop[0] -= margin;
136 bb_crop[1] += margin;
137 bb_crop[2] -= margin;
138 bb_crop[3] += margin;
139 bb_crop[4] -= margin;
140 bb_crop[5] += margin;
142 oriented->setCroppingBox(bb_crop);
146 QString uid = input->getUid() +
"_resample%1";
147 QString name = input->getName() +
" resample%1";
152 resampled->moveThisAndChildrenToThread(QApplication::instance()->thread());
154 mRawResult = resampled;
165 mServices->patient()->insertData(output);
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
ImagePtr resampleImage(PatientModelServicePtr dataManager, ImagePtr image, Transform3D qMd)
std::vector< SelectDataStringPropertyBasePtr > mInputTypes
QDomElement mCopiedOptions
boost::shared_ptr< class VisServices > VisServicesPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
static StringPropertySelectDataPtr New(PatientModelServicePtr patientModelService, QString typeRegexp=".*")
vtkImageDataPtr cropImage(vtkImageDataPtr input, IntBoundingBox3D cropbox)
Utility class for describing a bounded numeric range.
boost::shared_ptr< class Image > ImagePtr
DoublePropertyPtr getMarginOption(QDomElement root)
virtual void createOptions()
virtual QString getName() const
std::vector< PropertyPtr > mOptionsAdapters
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr
virtual QString getType() const
ImagePtr getCopiedInputImage(int index=0)
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.
virtual QString getHelp() const
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
virtual void createInputTypes()
std::vector< SelectDataStringPropertyBasePtr > mOutputTypes
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
virtual void createOutputTypes()
virtual bool postProcess()
static StringPropertySelectImagePtr New(PatientModelServicePtr patientModelService)
ResampleImageFilter(VisServicesPtr services)
Namespace for all CustusX production code.