16 #include "vtkImageData.h" 37 mMaxEnvelopeVoxels = maxVoxels;
47 ImageParameters box = this->createEnvelopeParametersFromImage(mImages[0]);
48 for(
unsigned i = 1; i < mImages.size(); ++i)
49 box = selectParametersWithSmallestExtent(box, this->createEnvelopeParametersFromImage(mImages[i]));
53 ImagePtr retval = this->createEnvelopeFromParameters(box);
64 retval.
setSpacingKeepDim(this->getMinimumSpacingFromAllImages(img->get_rMd().inverse()));
91 Eigen::Array3d ImageEnveloper::getMinimumSpacingFromAllImages(
Transform3D qMr)
93 Eigen::Array3d retval;
94 retval = this->getTransformedSpacing(mImages[0]->getSpacing(), qMr * mImages[0]->get_rMd());
95 for (
unsigned i = 1; i < mImages.size(); ++i)
97 Eigen::Array3d current = this->getTransformedSpacing(mImages[i]->getSpacing(), qMr * mImages[i]->get_rMd());
98 retval = retval.min(current);
103 Eigen::Array3d ImageEnveloper::getTransformedSpacing(Eigen::Array3d spacing,
Transform3D qMd)
105 Eigen::Array3d retval;
118 for (
unsigned i = 0; i < 3; ++i)
120 retval[i] = std::max(fabs(sx[i]), fabs(sy[i]));
121 retval[i] = std::max(retval[i], fabs(sz[i]));
129 int maxRange = this->getMaxScalarRange();
133 QString uid = QString(
"envelope_image_%1").arg(box.
mParentVolume);
135 retval->get_rMd_History()->setRegistration(box.
m_rMd);
136 retval->get_rMd_History()->setParentSpace(box.
mParentVolume);
137 retval->setAcquisitionTime(QDateTime::currentDateTime());
138 retval->setModality(
imSC);
143 int ImageEnveloper::getMaxScalarRange()
146 for (
unsigned i=0; i<mImages.size(); ++i)
147 maxRange = std::max<int>(maxRange, mImages[i]->getBaseVtkImageData()->GetScalarRange()[1]);
vtkImageDataPtr generateVtkImageDataUnsignedShort(Eigen::Array3i dim, Vector3D spacing, const unsigned short initValue, int components)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class Image > ImagePtr
Vector3D bottomLeft() const
static ImageEnveloperPtr create()
void limitVoxelsKeepBounds(unsigned long maxVolumeSize)
DoubleBoundingBox3D findEnclosingBoundingBox(std::vector< DataPtr > data, Transform3D qMr)
void setDimKeepBoundsAlignSpacing(Eigen::Array3d bounds)
Eigen::Array3i getDim() const
unsigned long getNumVoxels() const
Transform3D createTransformTranslate(const Vector3D &translation)
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 void setImages(std::vector< ImagePtr > images)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Eigen::Array3d getSpacing() const
virtual ImagePtr getEnvelopingImage()
void setMaxEnvelopeVoxels(long maxVoxels)
boost::shared_ptr< class ImageEnveloper > ImageEnveloperPtr
void setSpacingKeepDim(Eigen::Array3d spacing)
Namespace for all CustusX production code.