diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h index bf3e0ab18a..9f5f0c5948 100644 --- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h +++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h @@ -1,127 +1,127 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ /*=================================================================== This file is based heavily on a corresponding ITK filter. ===================================================================*/ #ifndef __itkDiffusionQballGeneralizedFaImageFilter_h_ #define __itkDiffusionQballGeneralizedFaImageFilter_h_ //#include "MitkDiffusionImagingMBIExports.h" #include "itkImageToImageFilter.h" //#include "vnl/vnl_matrix.h" #include "vnl/vnl_vector_fixed.h" #include "vnl/vnl_matrix.h" #include "vnl/algo/vnl_svd.h" #include "itkVectorContainer.h" #include "itkVectorImage.h" namespace itk{ /** \class DiffusionQballGeneralizedFaImageFilter */ template< class TOdfPixelType, class TGfaPixelType, int NrOdfDirections> class DiffusionQballGeneralizedFaImageFilter : public ImageToImageFilter< Image< Vector< TOdfPixelType, NrOdfDirections >, 3 >, Image< TGfaPixelType, 3 > > { public: enum GfaComputationMethod { GFA_STANDARD, GFA_QUANTILES_HIGH_LOW, GFA_QUANTILE_HIGH, GFA_MAX_ODF_VALUE, GFA_DECONVOLUTION_COEFFS, GFA_MIN_MAX_NORMALIZED_STANDARD, GFA_NORMALIZED_ENTROPY, GFA_NEMATIC_ORDER_PARAMETER, GFA_QUANTILE_LOW, GFA_MIN_ODF_VALUE, GFA_QUANTILES_LOW_HIGH, GFA_STD_BY_MAX, GFA_PRINCIPLE_CURVATURE, GFA_GENERALIZED_GFA }; typedef DiffusionQballGeneralizedFaImageFilter Self; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; typedef ImageToImageFilter< Image< Vector< TOdfPixelType, NrOdfDirections >, 3 >, Image< TGfaPixelType, 3 > > Superclass; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Runtime information support. */ itkTypeMacro(DiffusionQballGeneralizedFaImageFilter, ImageToImageFilter); typedef TOdfPixelType OdfComponentType; typedef TGfaPixelType DirectionPixelType; typedef typename Superclass::InputImageType InputImageType; typedef typename Superclass::OutputImageType OutputImageType; typedef typename Superclass::OutputImageRegionType OutputImageRegionType; itkStaticConstMacro(NOdfDirections,int,NrOdfDirections); void SetOdfImage( const InputImageType *image ); itkGetMacro(ComputationMethod, GfaComputationMethod); itkSetMacro(ComputationMethod, GfaComputationMethod); itkGetMacro(Param1, double); itkSetMacro(Param1, double); itkGetMacro(Param2, double); itkSetMacro(Param2, double); protected: DiffusionQballGeneralizedFaImageFilter(); ~DiffusionQballGeneralizedFaImageFilter() {}; void PrintSelf(std::ostream& os, Indent indent) const; void BeforeThreadedGenerateData(); void ThreadedGenerateData( const - OutputImageRegionType &outputRegionForThread, int); + OutputImageRegionType &outputRegionForThread, ThreadIdType); GfaComputationMethod m_ComputationMethod; double m_Param1; double m_Param2; }; } #ifndef ITK_MANUAL_INSTANTIATION #include "itkDiffusionQballGeneralizedFaImageFilter.txx" #endif #endif //__itkDiffusionQballGeneralizedFaImageFilter_h_ diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.txx b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.txx index 8b7356a1bb..77dac80f3c 100644 --- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.txx +++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDiffusionQballGeneralizedFaImageFilter.txx @@ -1,222 +1,222 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __itkDiffusionQballGeneralizedFaImageFilter_txx #define __itkDiffusionQballGeneralizedFaImageFilter_txx #include #include #include #define _USE_MATH_DEFINES #include #include "itkImageRegionConstIterator.h" #include "itkImageRegionConstIteratorWithIndex.h" #include "itkImageRegionIterator.h" #include "itkArray.h" #include "vnl/vnl_vector.h" #include "itkOrientationDistributionFunction.h" namespace itk { //#define QBALL_RECON_PI M_PI template< class TOdfPixelType, class TGfaPixelType, int NrOdfDirections> DiffusionQballGeneralizedFaImageFilter< TOdfPixelType, TGfaPixelType, NrOdfDirections> ::DiffusionQballGeneralizedFaImageFilter() : m_ComputationMethod(GFA_STANDARD) { // At least 1 inputs is necessary for a vector image. // For images added one at a time we need at least six this->SetNumberOfRequiredInputs( 1 ); } template< class TOdfPixelType, class TGfaPixelType, int NrOdfDirections> void DiffusionQballGeneralizedFaImageFilter< TOdfPixelType, TGfaPixelType, NrOdfDirections> ::BeforeThreadedGenerateData() { } template< class TOdfPixelType, class TGfaPixelType, int NrOdfDirections> void DiffusionQballGeneralizedFaImageFilter< TOdfPixelType, TGfaPixelType, NrOdfDirections> ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - int ) + ThreadIdType ) { typename OutputImageType::Pointer outputImage = - static_cast< OutputImageType * >(this->ProcessObject::GetOutput()); + static_cast< OutputImageType * >(this->ProcessObject::GetOutput(0)); ImageRegionIterator< OutputImageType > oit(outputImage, outputRegionForThread); oit.GoToBegin(); typedef itk::OrientationDistributionFunction OdfType; typedef ImageRegionConstIterator< InputImageType > InputIteratorType; typedef typename InputImageType::PixelType OdfVectorType; typename InputImageType::Pointer inputImagePointer = NULL; inputImagePointer = static_cast< InputImageType * >( this->ProcessObject::GetInput(0) ); InputIteratorType git(inputImagePointer, outputRegionForThread ); git.GoToBegin(); while( !git.IsAtEnd() ) { OdfVectorType b = git.Get(); TGfaPixelType outval = -1; switch( m_ComputationMethod ) { case GFA_STANDARD: { OdfType odf = b.GetDataPointer(); outval = odf.GetGeneralizedFractionalAnisotropy(); break; } case GFA_QUANTILES_HIGH_LOW: { vnl_vector_fixed sorted; for(int i=0; i sorted; for(int i=0; i sorted; for(int i=0; i sorted; for(int i=0; i void DiffusionQballGeneralizedFaImageFilter< TOdfPixelType, TGfaPixelType, NrOdfDirections> ::PrintSelf(std::ostream& os, Indent indent) const { Superclass::PrintSelf(os,indent); } } #endif // __itkDiffusionQballGeneralizedFaImageFilter_txx