18 #ifndef __itkCoreAtomImageToDistanceMatrixProcess_txx
19 #define __itkCoreAtomImageToDistanceMatrixProcess_txx
29 template<
typename TSourceImage >
33 itkDebugMacro(<<
"itkCoreAtomImageToDistanceMatrixProcess::itkCoreAtomImageToDistanceMatrixProcess() called");
45 template<
typename TSourceImage >
50 return static_cast<DataObject*
>(DistanceMatrixType::New().GetPointer());
56 template<
typename TSourceImage >
61 if (this->GetNumberOfOutputs() < 1)
72 template<
typename TSourceImage >
77 itkDebugMacro(<<
"itkCoreAtomImageToDistanceMatrixProcess: Setting core atom image");
79 SetNthInput(0, const_cast<TSourceImage *>( image1 ) );
85 template<
typename TSourceImage >
91 return const_cast<TSourceImage *
>(this->GetNthInput(0));
97 template<
typename TSourceImage >
102 itkDebugMacro(<<
"itkCoreAtomImageToDistanceMatrixProcess::GenerateData() called");
109 m_NumberOfNodes = m_CoreAtomImage->GetMedialNodeCount();
112 if(m_DistanceMatrix->set_size(m_NumberOfNodes,m_NumberOfNodes))
114 itkDebugMacro(<<
"m_DistanceMatrix resized successfully");
118 itkDebugMacro(<<
"m_DistanceMatrix resize failed");
121 itkDebugMacro(<<
"CoreAtomImageToDistanceMatrixProcess::GenerateData(): Matrix Size: " << m_NumberOfNodes <<
" x " << m_NumberOfNodes);
126 BloxIterator bloxIt = BloxIterator(m_CoreAtomImage,
127 m_CoreAtomImage->GetRequestedRegion() );
129 BloxIterator bloxIt2 = BloxIterator(m_CoreAtomImage,
130 m_CoreAtomImage->GetRequestedRegion() );
145 for ( bloxIt.GoToBegin(); !bloxIt.IsAtEnd(); ++bloxIt)
147 pPixel1 = &bloxIt.Value();
149 if( pPixel1->empty() )
153 for ( bloxIt2.GoToBegin(); !bloxIt2.IsAtEnd(); ++bloxIt2)
155 pPixel2 = &bloxIt2.Value();
157 if( pPixel2->empty() )
162 Location1 = pPixel1->GetVotedLocation();
165 DistanceVector[0] = Location1[0] - Location2[0];
166 DistanceVector[1] = Location1[1] - Location2[1];
167 DistanceVector[2] = Location1[2] - Location2[2];
169 distance = vcl_sqrt(vcl_pow((
double)DistanceVector[0],2.0) + vcl_pow((
double)DistanceVector[1],2.0) + vcl_pow((
double)DistanceVector[2],2.0) );
171 m_DistanceMatrix->put(counter1,counter2,distance);
178 itkDebugMacro(<<
"Finished CoreAtomImageToDistanceMatrixProcess\n");
184 template<
typename TSourceImage >
189 Superclass::PrintSelf(os,indent);