25 : m_Subset(NULL), m_CameraIntrinsics(), m_InterPixelDistance()
31 m_CameraIntrinsics->SetDistorsionCoeffs(-0.36874385358645773f,-0.14339503290129013,0.0033210108720361795,-0.004277703352074105);
41 this->SetInput(0,distanceImage);
46 if ((distanceImage ==
nullptr) && (idx == this->GetNumberOfInputs() - 1))
48 this->SetNumberOfInputs(this->GetNumberOfInputs() - 1);
52 this->ProcessObject::SetNthInput(idx, const_cast<mitk::Image*>(distanceImage));
53 this->CreateOutputsForAllInputs();
59 return this->GetInput(0);
64 if (this->GetNumberOfInputs() < 1)
67 return static_cast< mitk::Image*
>(this->ProcessObject::GetInput(idx));
75 unsigned int xDim = UINT_MAX;
76 unsigned int yDim = UINT_MAX;
77 if(input.IsNotNull() && input->IsInitialized())
79 unsigned int xDim = input->GetDimension(0);
80 unsigned int yDim = input->GetDimension(1);
83 bool pointSetValid =
true;
84 for (
unsigned int i=0; i<subset.size(); i++)
87 if (currentIndex[0]<0||currentIndex[0]>xDim||currentIndex[1]<0||currentIndex[1]>yDim)
89 pointSetValid =
false;
98 MITK_ERROR<<
"One or more indizes are located outside the image domain";
104 std::vector<itk::Index<3> > subset;
105 for (
int i=0; i<pointSet->GetSize(); i++)
109 currentIndex[0] = currentPoint[0];
110 currentIndex[1] = currentPoint[1];
111 currentIndex[2] = currentPoint[2];
112 subset.push_back(currentIndex);
114 this->SetSubset(subset);
122 if (m_ReconstructionMode)
124 focalLengthInPixelUnits[0] = m_CameraIntrinsics->GetFocalLengthX();
125 focalLengthInPixelUnits[1] = m_CameraIntrinsics->GetFocalLengthY();
128 focalLengthInMm = (m_CameraIntrinsics->GetFocalLengthX()*m_InterPixelDistance[0]+m_CameraIntrinsics->GetFocalLengthY()*m_InterPixelDistance[1])/2.0;
131 principalPoint[0] = m_CameraIntrinsics->GetPrincipalPointX();
132 principalPoint[1] = m_CameraIntrinsics->GetPrincipalPointY();
140 if (m_Subset.size()!=0)
143 for (
unsigned int i=0; i<m_Subset.size(); i++)
147 index2D[0] = currentIndex[0];
148 index2D[1] = currentIndex[1];
152 if (m_ReconstructionMode)
157 output->InsertPoint(i,currentPoint);
162 int xDimension = (int)input->GetDimension(0);
163 int yDimension = (int)input->GetDimension(1);
166 for (
int j=0; j<yDimension; j++)
168 for (
int i=0; i<xDimension; i++)
177 if (m_ReconstructionMode)
184 output->InsertPoint( pointCount, currentPoint );
194 this->SetNumberOfOutputs(this->GetNumberOfInputs());
195 for (
unsigned int idx = 0; idx < this->GetNumberOfIndexedOutputs(); ++idx)
196 if (this->GetOutput(idx) ==
nullptr)
198 DataObjectPointer newOutput = this->MakeOutput(idx);
199 this->SetNthOutput(idx, newOutput);
207 itkDebugMacro(<<
"GenerateOutputInformation()");
212 this->m_ReconstructionMode = withoutInterpixdist;
217 return (this->m_ReconstructionMode);
Gives locked and index-based read access for a particular image part. The class provides several set-...
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength, ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY, ToFScalarType principalPointX, ToFScalarType principalPointY)
Convert index based distances to cartesian coordinates.
bool m_ReconstructionMode
true = Reconstruction without interpixeldistance and with focal lengths in pixel units. false = Reconstruction with interpixeldistance and with focal length in mm.
Image * GetInput()
Returns the input of this filter.
virtual void GenerateOutputInformation() override
virtual void SetInput(const Image *distanceImage)
Sets the input of this filter.
bool GetReconstructionMode()
Returns the reconstruction mode.
ToFDistanceImageToPointSetFilter()
Standard constructor.
void CreateOutputsForAllInputs()
Create an output for each input.
void SetReconstructionMode(bool withoutInterpixdist=true)
Sets the reconstruction mode, if using no interpixeldistances and focal lenghts in pixel units (=true...
itk::Point< ToFScalarType, 2 > ToFPoint2D
Image class for storing images.
ToFProcessingCommon::ToFPoint2D m_InterPixelDistance
distance in mm between two adjacent pixels on the ToF camera chip
virtual void GenerateData() override
Method generating the output of this filter. Called in the updated process of the pipeline...
MITKCORE_EXPORT const ScalarType eps
mitk::CameraIntrinsics::Pointer m_CameraIntrinsics
Member holding the intrinsic parameters needed for PointSet calculation.
void SetSubset(std::vector< itk::Index< 3 > > subset)
If this subset is defined, the cartesian coordinates are only computed for the contained indizes...
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY)
Convert index based distances to cartesian coordinates.
~ToFDistanceImageToPointSetFilter()
Standard destructor.