diff --git a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h index 35991104a2..9247d51f05 100644 --- a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h @@ -1,65 +1,72 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef ITKB0IMAGEEXTRACTIONTOSEPARATEIMAGEFILTER_H #define ITKB0IMAGEEXTRACTIONTOSEPARATEIMAGEFILTER_H #include "itkB0ImageExtractionImageFilter.h" namespace itk { /** \class B0ImageExtractionToSeparateImageFilter \brief This class extends the B0ImageExtractionImageFilter, it returns a time-sliced image containing all available b0 images for given DWI Image */ template< class TInputImagePixelType, class TOutputImagePixelType > class B0ImageExtractionToSeparateImageFilter : public B0ImageExtractionImageFilter< TInputImagePixelType, TOutputImagePixelType > { public: /** basic typedefs */ typedef B0ImageExtractionImageFilter< TInputImagePixelType, TOutputImagePixelType > Superclass; typedef B0ImageExtractionToSeparateImageFilter Self; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; + /** typedefs from superclass */ + typedef typename Superclass::GradientDirectionType GradientDirectionType; + typedef typename Superclass::GradientDirectionContainerType GradientDirectionContainerType; + typedef typename GradientDirectionContainerType::Iterator GradContainerIteratorType; + /** Method for creation through the object factory. */ itkNewMacro(Self); /** Runtime information support. */ itkTypeMacro(B0ImageExtractionToSeparateImageFilter, B0ImageExtractionImageFilter); protected: B0ImageExtractionToSeparateImageFilter(); virtual ~B0ImageExtractionToSeparateImageFilter(){}; void GenerateData(); + + using Superclass::m_Directions; }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkB0ImageExtractionToSeparateImageFilter.txx" #endif #endif // ITKB0IMAGEEXTRACTIONTOSEPARATEIMAGEFILTER_H diff --git a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx index 8e57627dc4..ccf42163b0 100644 --- a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx @@ -1,87 +1,91 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkB0ImageExtractionToSeparateImageFilter_txx #define __itkB0ImageExtractionToSeparateImageFilter_txx #include "itkB0ImageExtractionToSeparateImageFilter.h" template< class TInputImagePixelType, class TOutputImagePixelType> itk::B0ImageExtractionToSeparateImageFilter< TInputImagePixelType, TOutputImagePixelType > ::B0ImageExtractionToSeparateImageFilter() : B0ImageExtractionImageFilter< TInputImagePixelType, TOutputImagePixelType >() { } template< class TInputImagePixelType, class TOutputImagePixelType> void itk::B0ImageExtractionToSeparateImageFilter< TInputImagePixelType, TOutputImagePixelType >::GenerateData() { - typename GradientDirectionContainerType::Iterator begin = m_Directions->Begin(); - typename GradientDirectionContainerType::Iterator end = m_Directions->End(); + GradContainerIteratorType begin = m_Directions->Begin(); + GradContainerIteratorType end = m_Directions->End(); // Find the index of the b0 image std::vector indices; int index = 0; while(begin!=end) { GradientDirectionType grad = begin->Value(); if(grad[0] == 0 && grad[1] == 0 && grad[2] == 0) { indices.push_back(index); } ++index; ++begin; } + // declare the output image typedef itk::Image TempImageType; TempImageType::Pointer tmp = TempImageType::New(); - typename TempImageType::RegionType region = this->GetInput()->GetLargestPossibleRegion(); + + // get the input region + typename Superclass::InputImageType::RegionType inputRegion = + this->GetInput()->GetLargestPossibleRegion(); // allocate image with // - dimension: [DimX, DimY, DimZ, NumOfb0 ] // - spacing: old one, 1.0 time TempImageType::SpacingType spacing; spacing.Fill(1); - TempImageType::OriginType origin; + TempImageType::PointType origin; origin.Fill(0); for (unsigned int i=0; i< 3; i++) { spacing[i] = (this->GetInput()->GetSpacing())[i]; origin[i] = (this->GetInput()->GetOrigin())[i]; } // extract b0 and insert them as a new time step //Sum all images that have zero diffusion weighting (indices stored in vector index) for(std::vector::iterator indexIt = indices.begin(); indexIt != indices.end(); indexIt++) { } } #endif // ifndef __itkB0ImageExtractionToSeparateImageFilter_txx