| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkImageFunction.txx.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:38 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
DEF |
#ifndef _itkImageFunction_txx |
| 18 |
DEF |
#define _itkImageFunction_txx |
| 19 |
|
|
| 20 |
|
#include "itkImageFunction.h" |
| 21 |
|
|
| 22 |
|
namespace itk |
| 23 |
|
{ |
| 24 |
|
|
| 25 |
|
/** |
| 26 |
|
* Constructor |
| 27 |
|
*/ |
| 28 |
|
template <class TInputImage, class TOutput, class TCoordRep> |
| 29 |
|
ImageFunction<TInputImage, TOutput, TCoordRep> |
| 30 |
|
::ImageFunction() |
| 31 |
|
{ |
| 32 |
|
m_Image = NULL; |
| 33 |
|
m_StartIndex.Fill(0); |
| 34 |
|
m_EndIndex.Fill(0); |
| 35 |
|
m_StartContinuousIndex.Fill(0.0); |
| 36 |
|
m_EndContinuousIndex.Fill(0.0); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
/** |
| 41 |
|
* Standard "PrintSelf" method |
| 42 |
|
*/ |
| 43 |
|
template <class TInputImage, class TOutput, class TCoordRep> |
| 44 |
|
void |
| 45 |
|
ImageFunction<TInputImage, TOutput, TCoordRep> |
| 46 |
|
::PrintSelf( |
| 47 |
|
std::ostream& os, |
| 48 |
|
Indent indent) const |
| 49 |
|
{ |
| 50 |
|
Superclass::PrintSelf( os, indent ); |
| 51 |
|
os << indent << "InputImage: " << m_Image.GetPointer() << std::endl; |
| 52 |
|
os << indent << "StartIndex: " << m_StartIndex << std::endl; |
| 53 |
|
os << indent << "EndIndex: " << m_EndIndex << std::endl; |
| 54 |
LEN |
os << indent << "StartContinuousIndex: " << m_StartContinuousIndex << std::endl; |
| 55 |
|
os << indent << "EndContinuousIndex: " << m_EndContinuousIndex << std::endl; |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
/** |
| 60 |
|
* Initialize by setting the input image |
| 61 |
|
*/ |
| 62 |
|
template <class TInputImage, class TOutput, class TCoordRep> |
| 63 |
|
void |
| 64 |
|
ImageFunction<TInputImage, TOutput, TCoordRep> |
| 65 |
|
::SetInputImage( |
| 66 |
|
const InputImageType * ptr ) |
| 67 |
|
{ |
| 68 |
|
// set the input image |
| 69 |
|
m_Image = ptr; |
| 70 |
|
|
| 71 |
|
if ( ptr ) |
| 72 |
|
{ |
| 73 |
|
typedef typename IndexType::IndexValueType IndexValueType; |
| 74 |
|
typename InputImageType::SizeType size = ptr->GetBufferedRegion().GetSize(); |
| 75 |
|
m_StartIndex = ptr->GetBufferedRegion().GetIndex(); |
| 76 |
|
|
| 77 |
|
for ( unsigned int j = 0; j < ImageDimension; j++ ) |
| 78 |
|
{ |
| 79 |
|
m_EndIndex[j] = m_StartIndex[j] + |
| 80 |
|
static_cast<IndexValueType>( size[j] ) - 1; |
| 81 |
|
m_StartContinuousIndex[j] = static_cast<CoordRepType>( m_StartIndex[j] ); |
| 82 |
|
m_EndContinuousIndex[j] = static_cast<CoordRepType>( m_EndIndex[j] ); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
} |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
|
| 89 |
EML |
|
| 90 |
|
} // end namespace itk |
| 91 |
|
|
| 92 |
|
#endif |
| 93 |
|
|
| 94 |
EOF |
|