18 m_XPixelsCropStart(0),
19 m_YPixelsCropStart(0),
20 m_ZPixelsCropStart(0),
25 MITK_INFO <<
"Instantiating CropImageFilter...";
26 SetNumberOfIndexedInputs(1);
27 SetNumberOfIndexedOutputs(1);
28 MITK_INFO <<
"Instantiating CropImageFilter...[Done]";
33 MITK_INFO <<
"Destructed CastToFloatImageFilter.";
40 std::string type = inputImage->GetPixelType().GetTypeAsString();
41 if (!(type ==
"scalar (float)" || type ==
" (float)"))
43 MITK_ERROR <<
"This filter can currently only handle float type images.";
44 mitkThrow() <<
"This filter can currently only handle float type images.";
49 MITK_ERROR <<
"X Crop area too large for selected input image";
50 mitkThrow() <<
"X Crop area too large for selected input image";
54 MITK_ERROR <<
"Y Crop area too large for selected input image";
55 mitkThrow() <<
"Y Crop area too large for selected input image";
58 if (inputImage->GetDimension() == 3)
63 MITK_ERROR <<
"Z Crop area too large for selected input image";
64 mitkThrow() <<
"Z Crop area too large for selected input image";
71 mitkThrow() <<
"Z Crop area too large for selected input image";
82 unsigned int* outputDim;
83 unsigned int* inputDim = inputImage->GetDimensions();
84 if (inputImage->GetDimension() == 2)
92 outputImage->Initialize(mitk::MakeScalarPixelType<float>(), inputImage->GetDimension(), outputDim);
93 outputImage->SetSpacing(inputImage->GetGeometry()->GetSpacing());
96 const float* inputData = (
const float*)(accR.
GetData());
99 float* outputData = (
float*)(accW.
GetData());
101 unsigned int zLength = inputImage->GetDimension() == 3 ? outputDim[2] : 1;
103 for (
unsigned int sl = 0; sl < zLength; ++sl)
105 for (
unsigned int l = 0; l < outputDim[0]; ++l)
107 for (
unsigned int s = 0; s < outputDim[1]; ++s)
109 outputData[l + s*outputDim[0] + sl*outputDim[0] * outputDim[1]] =
unsigned int m_XPixelsCropEnd
unsigned int m_ZPixelsCropEnd
void * GetData()
Gives full data access.
~CropImageFilter() override
unsigned int m_YPixelsCropEnd
void SanityCheckPreconditions()
unsigned int m_XPixelsCropStart
InputImageType * GetInput(void)
unsigned int m_ZPixelsCropStart
OutputType * GetOutput()
Get the output data of this image source object.
ImageWriteAccessor class to get locked write-access for a particular image part.
ImageReadAccessor class to get locked read access for a particular image part.
const void * GetData() const
Gives const access to the data.
unsigned int m_YPixelsCropStart
void GenerateData() override