1 /*===================================================================
3 The Medical Imaging Interaction Toolkit (MITK)
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 See LICENSE.txt or http://www.mitk.org for details.
15 ===================================================================*/
16 #ifndef __itkShortestPathCostFunctionTbss_cpp
17 #define __itkShortestPathCostFunctionTbss_cpp
24 template <class TInputImageType>
25 ShortestPathCostFunctionTbss<TInputImageType>::ShortestPathCostFunctionTbss()
29 template <class TInputImageType>
30 double ShortestPathCostFunctionTbss<TInputImageType>::GetCost(IndexType p1, IndexType p2)
32 // Cost function for tbss tract definition
35 if (this->m_Image->GetPixel(p2) < m_Threshold)
37 c = std::numeric_limits<double>::max();
41 double dxSqt = (p1[0] - p2[0]) * (p1[0] - p2[0]); // * (p1[0]-p2[0]);
42 double dySqt = (p1[1] - p2[1]) * (p1[1] - p2[1]);
43 double dzSqt = (p1[2] - p2[2]) * (p1[2] - p2[2]);
45 double weight = this->m_Image->GetPixel(p2);
47 c = sqrt(dxSqt + dySqt + dzSqt) + 1000 * (1 - weight);
53 template <class TInputImageType>
54 void ShortestPathCostFunctionTbss<TInputImageType>::Initialize()
58 template <class TInputImageType>
59 double ShortestPathCostFunctionTbss<TInputImageType>::GetMinCost()
64 } // end namespace itk
66 #endif // __itkShortestPathCostFunctionSimple_txx