20 #include "itkBinaryThresholdImageFilter.h"
21 #include "itkConstantPadImageFilter.h"
25 this->SetNumberOfIndexedInputs(2);
26 this->SetNumberOfRequiredInputs(2);
27 m_BinaryFilter =
false;
29 m_PadConstant = -32766;
30 m_LowerThreshold = -32766;
31 m_UpperThreshold = -32765;
54 double outputOrigin[3];
55 unsigned long padLowerBound[3];
56 unsigned long padUpperBound[3];
59 for (i = 0; i < 3; ++i)
61 outputOrigin[i] = referenceOrigin[i];
63 padLowerBound[i] =
static_cast<unsigned long>((origin[i] - referenceOrigin[i]) / spacing[i] + 0.5);
65 padUpperBound[i] = referenceImage->GetDimension(i) - image->GetDimension(i) - padLowerBound[i];
70 itkImage->SetOrigin(outputOrigin);
72 typedef itk::ConstantPadImageFilter<ImageType, ImageType> PadFilterType;
74 padFilter->SetInput(itkImage);
75 padFilter->SetConstant(m_PadConstant);
76 padFilter->SetPadLowerBound(padLowerBound);
77 padFilter->SetPadUpperBound(padUpperBound);
86 typedef itk::BinaryThresholdImageFilter<ImageType, BinaryImageType> BinaryFilterType;
89 binaryFilter->SetInput(padFilter->GetOutput());
90 binaryFilter->SetLowerThreshold(m_LowerThreshold);
91 binaryFilter->SetUpperThreshold(m_UpperThreshold);
92 binaryFilter->SetInsideValue(1);
93 binaryFilter->SetOutsideValue(0);
94 binaryFilter->Update();
104 outputImage->SetRequestedRegionToLargestPossibleRegion();
const Point3D GetOrigin() const
Get the origin, e.g. the upper-left corner of the plane.
virtual void GenerateData() override
A version of GenerateData() specific for image processing filters.
itk::SmartPointer< Self > Pointer
const mitk::Vector3D GetSpacing() const
Get the spacing (size of a pixel).
virtual ~PadImageFilter()
map::core::discrete::Elements< 3 >::InternalImageType ImageType
itk::Image< unsigned char, 3 > BinaryImageType
void CastToMitkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, itk::SmartPointer< mitk::Image > &mitkoutputimage)
Cast an itk::Image (with a specific type) to an mitk::Image.
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
BaseGeometry Describes the geometry of a data object.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.