1 /*============================================================================
3 The Medical Imaging Interaction Toolkit (MITK)
5 Copyright (c) German Cancer Research Center (DKFZ)
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
11 ============================================================================*/
12 #ifndef __itkShortestPathCostFunctionTbss_cpp
13 #define __itkShortestPathCostFunctionTbss_cpp
20 template <class TInputImageType>
21 ShortestPathCostFunctionTbss<TInputImageType>::ShortestPathCostFunctionTbss()
25 template <class TInputImageType>
26 double ShortestPathCostFunctionTbss<TInputImageType>::GetCost(IndexType p1, IndexType p2)
28 // Cost function for tbss tract definition
31 if (this->m_Image->GetPixel(p2) < m_Threshold)
33 c = std::numeric_limits<double>::max();
37 double dxSqt = (p1[0] - p2[0]) * (p1[0] - p2[0]); // * (p1[0]-p2[0]);
38 double dySqt = (p1[1] - p2[1]) * (p1[1] - p2[1]);
39 double dzSqt = (p1[2] - p2[2]) * (p1[2] - p2[2]);
41 double weight = this->m_Image->GetPixel(p2);
43 c = sqrt(dxSqt + dySqt + dzSqt) + 1000 * (1 - weight);
49 template <class TInputImageType>
50 void ShortestPathCostFunctionTbss<TInputImageType>::Initialize()
54 template <class TInputImageType>
55 double ShortestPathCostFunctionTbss<TInputImageType>::GetMinCost()
60 } // end namespace itk
62 #endif // __itkShortestPathCostFunctionSimple_txx