28 this->ProcessObject::SetNthInput(1, const_cast<mitk::BoundingObject *>(boundingObject));
42 this->SetNumberOfIndexedInputs(2);
43 this->SetNumberOfRequiredInputs(2);
74 mitkThrow() <<
"Input is not a mitk::Image";
76 itkDebugMacro(<<
"GenerateOutputInformation()");
77 unsigned int dimension = input->GetDimension();
81 mitkThrow() <<
"ImageCropper cannot handle 1D or 2D Objects.";
92 mitk::BoundingBox::Pointer boBoxRelativeToImage =
106 mitk::BoundingBox::PointType
min = boBoxRelativeToImage->GetMinimum();
107 index[0] = (mitk::SlicedData::IndexType::IndexValueType)(std::ceil(min[0]));
108 index[1] = (mitk::SlicedData::IndexType::IndexValueType)(std::ceil(min[1]));
109 index[2] = (mitk::SlicedData::IndexType::IndexValueType)(std::ceil(min[2]));
112 mitk::BoundingBox::PointType
max = boBoxRelativeToImage->GetMaximum();
113 size[0] = (mitk::SlicedData::SizeType::SizeValueType)(std::ceil(max[0]) - index[0]);
114 size[1] = (mitk::SlicedData::SizeType::SizeValueType)(std::ceil(max[1]) - index[1]);
115 size[2] = (mitk::SlicedData::SizeType::SizeValueType)(std::ceil(max[2]) - index[2]);
127 boRegion.SetSize(size);
129 mitkThrow() <<
"No overlap of the image and the cropping object.";
139 auto dimensions =
new unsigned int[dimension];
142 memcpy(dimensions + 3, input->GetDimensions() + 3, (dimension - 3) *
sizeof(
unsigned int));
151 AffineTransform3D::Pointer indexToWorldTransform = AffineTransform3D::New();
152 indexToWorldTransform->SetParameters(input->GetSlicedGeometry()->GetIndexToWorldTransform()->GetParameters());
199 int tstart = outputRegion.GetIndex(3);
200 int tmax = tstart + outputRegion.GetSize(3);
203 for (t = tstart; t < tmax; ++t)
unsigned int m_InsidePixelCount
mitk::BoundingObject::Pointer m_BoundingObject
void IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
Convert (continuous or discrete) index coordinates of a vector vec_units to world coordinates (in mm)...
void SetBoundingObject(const mitk::BoundingObject *boundingObject)
void SetIndexToWorldTransform(mitk::AffineTransform3D *transform)
unsigned int m_OutsidePixelCount
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
vcl_size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
ScalarType m_OutsideValue
void GenerateData() override
DataCollection - Class to facilitate loading/accessing structured data.
virtual const PixelType GetOutputPixelType()
friend void CutImage(itk::Image< TPixel, VImageDimension > *itkImage, mitk::BoundingObjectCutter *cutter, int boTimeStep)
itk::Size< RegionDimension > SizeType
void GenerateOutputInformation() override
void GenerateInputRequestedRegion() override
itk::TimeStamp m_TimeOfHeaderInitialization
superclass of all bounding objects (cylinder, cuboid,...)
virtual void ComputeData(mitk::Image *input3D, int boTimeStep)
#define AccessFixedDimensionByItk_2(mitkImage, itkImageTypeFunction, dimension, arg1, arg2)
itk::ImageRegion< RegionDimension > RegionType
virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const =0
Converts a time point to the corresponding time step.
void SetOrigin(const Point3D &origin)
Set the origin, i.e. the upper-left corner of the plane.
Image class for storing images.
virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const =0
Converts a time step to a time point.
const mitk::BoundingObject * GetBoundingObject() const
void vtk2itk(const Tin &in, Tout &out)
mitk::ScalarType TimePointType
mitk::SlicedData::RegionType m_InputRequestedRegion
mitk::ImageTimeSelector::Pointer m_InputTimeSelector
Describes the geometry of a data object consisting of slices.
void GenerateTimeInInputRegion(const mitk::TimeGeometry *outputTimeGeometry, const TOutputRegion &outputRegion, const mitk::TimeGeometry *inputTimeGeometry, TInputRegion &inputRegion)
void itk2vtk(const Tin &in, Tout &out)
~BoundingObjectCutter() override
InputImageType * GetInput(void)
virtual bool IsInitialized() const
Check whether the data has been initialized, i.e., at least the Geometry and other header data has be...
mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(const mitk::AffineTransform3D *transform) const
Calculates a bounding-box around the geometry relative to a coordinate system defined by a transform...
bool m_UseWholeInputRegion
OutputType * GetOutput()
Get the output data of this image source object.
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector
itk::ImageRegion< 5 > RegionType
BaseGeometry Describes the geometry of a data object.
Class for defining the data type of pixels.
mitk::AffineTransform3D * GetIndexToWorldTransform()
Get the transformation used to convert from index to world coordinates.
#define AccessVectorFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, va_tuple)
Access a vector mitk-image with known dimension by a ITK vector image with one or more parameters...