1 /*=========================================================================
3 * Copyright RTK Consortium
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 *=========================================================================*/
19 #ifndef __rtkImagXRawToAttenuationImageFilter_txx
20 #define __rtkImagXRawToAttenuationImageFilter_txx
22 #include <itkImageFileWriter.h>
27 template<class TInputImage, class TOutputImage>
29 ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
30 ::GenerateInputRequestedRegion()
32 typename Superclass::InputImagePointer inputPtr =
33 const_cast< TInputImage * >( this->GetInput() );
37 m_CropFilter->SetInput(inputPtr); //SR: this is most likely useless
38 m_LookupTableFilter->GetOutput()->SetRequestedRegion(this->GetOutput()->GetRequestedRegion() );
39 m_LookupTableFilter->GetOutput()->PropagateRequestedRegion();
42 template <class TInputImage, class TOutputImage>
43 ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
44 ::ImagXRawToAttenuationImageFilter()
46 m_CropFilter = CropFilterType::New();
47 m_ScatterFilter = ScatterFilterType::New();
48 m_LookupTableFilter = LookupTableFilterType::New();
50 //Permanent internal connections
51 m_ScatterFilter->SetInput( m_CropFilter->GetOutput() );
52 m_LookupTableFilter->SetInput( m_ScatterFilter->GetOutput() );
54 //Default filter parameters
55 typename CropFilterType::SizeType border = m_CropFilter->GetLowerBoundaryCropSize();
58 m_CropFilter->SetBoundaryCropSize(border);
61 template<class TInputImage, class TOutputImage>
63 ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
64 ::GenerateOutputInformation()
66 m_CropFilter->SetInput(this->GetInput() );
67 m_LookupTableFilter->UpdateOutputInformation();
68 this->GetOutput()->SetOrigin( m_LookupTableFilter->GetOutput()->GetOrigin() );
69 this->GetOutput()->SetSpacing( m_LookupTableFilter->GetOutput()->GetSpacing() );
70 this->GetOutput()->SetDirection( m_LookupTableFilter->GetOutput()->GetDirection() );
71 this->GetOutput()->SetLargestPossibleRegion( m_LookupTableFilter->GetOutput()->GetLargestPossibleRegion() );
74 template<class TInputImage, class TOutputImage>
76 ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
79 m_CropFilter->SetInput(this->GetInput() );
80 m_LookupTableFilter->Update();
81 this->GraftOutput( m_LookupTableFilter->GetOutput() );
84 } // end namespace rtk