17 #ifndef __itkAnalyticalDiffusionQballReconstructionImageFilter_h_
18 #define __itkAnalyticalDiffusionQballReconstructionImageFilter_h_
20 #include "itkImageToImageFilter.h"
21 #include "vnl/vnl_vector_fixed.h"
22 #include "vnl/vnl_matrix.h"
23 #include "vnl/algo/vnl_svd.h"
24 #include "itkVectorContainer.h"
25 #include "itkVectorImage.h"
86 template<
class TReferenceImagePixelType,
87 class TGradientImagePixelType,
92 public ImageToImageFilter< Image< TReferenceImagePixelType, 3 >,
93 Image< Vector< TOdfPixelType, NrOdfDirections >, 3 > >
112 typedef ImageToImageFilter< Image< TReferenceImagePixelType, 3>,
113 Image< Vector< TOdfPixelType, NrOdfDirections >, 3 > >
Superclass;
116 itkFactorylessNewMacro(Self)
155 typedef vnl_matrix< TOdfPixelType >*
164 typedef VectorContainer<
unsigned int,
174 const GradientImagesType *image);
178 {
return ( static_cast< ReferenceImageType *>(this->ProcessObject::GetInput(0)) ); }
183 if( idx >= m_NumberOfGradientDirections )
184 itkExceptionMacro( <<
"Gradient direction " << idx <<
"does not exist" );
185 return m_GradientDirectionContainer->ElementAt( idx+1 );
188 static void tofile2(vnl_matrix<double> *A, std::string fname);
189 static void Cart2Sph(
double x,
double y,
double z,
double* cart);
190 static double Yj(
int m,
int k,
double theta,
double phi,
bool useMRtrixBasis =
false);
194 vnl_vector<TOdfPixelType>
PreNormalize( vnl_vector<TOdfPixelType> vec,
typename NumericTraits<ReferencePixelType>::AccumulateType b0 );
207 itkGetMacro( ODFSumImage, typename FloatImageType::Pointer)
210 itkSetMacro( BValue, TOdfPixelType)
214 itkGetConstReferenceMacro( BValue, TOdfPixelType)
215 itkSetMacro( Lambda,
double )
216 itkGetMacro( Lambda,
double )
218 itkSetMacro( UseMrtrixBasis,
bool )
220 #ifdef ITK_USE_CONCEPT_CHECKING
222 itkConceptMacro(ReferenceEqualityComparableCheck,
223 (Concept::EqualityComparable<ReferencePixelType>));
224 itkConceptMacro(TensorEqualityComparableCheck,
225 (Concept::EqualityComparable<OdfPixelType>));
226 itkConceptMacro(GradientConvertibleToDoubleCheck,
227 (Concept::Convertible<GradientPixelType, double>));
228 itkConceptMacro(DoubleConvertibleToTensorCheck,
229 (Concept::Convertible<double, OdfPixelType>));
230 itkConceptMacro(GradientReferenceAdditiveOperatorsCheck,
233 itkConceptMacro(ReferenceOStreamWritableCheck,
234 (Concept::OStreamWritable<ReferencePixelType>));
235 itkConceptMacro(TensorOStreamWritableCheck,
236 (Concept::OStreamWritable<OdfPixelType>));
243 void PrintSelf(std::ostream& os, Indent indent)
const;
258 unsigned int m_NumberOfGradientDirections;
260 unsigned int m_NumberOfBaselineImages;
264 TOdfPixelType m_BValue;
267 bool m_DirectionsDuplicated;
269 int m_NumberCoefficients;
270 vnl_matrix<double>* m_B_t;
271 vnl_vector<double>* m_LP;
274 TOdfPixelType m_Delta1;
275 TOdfPixelType m_Delta2;
276 bool m_UseMrtrixBasis;
281 #ifndef ITK_MANUAL_INSTANTIATION
285 #endif //__itkAnalyticalDiffusionQballReconstructionImageFilter_h_
Image< BZeroPixelType, 3 > BZeroImageType
vnl_vector_fixed< double, 3 > GradientDirectionType
static void tofile2(vnl_matrix< double > *A, std::string fname)
itk::SmartPointer< Self > Pointer
VectorContainer< unsigned int, GradientDirectionType > GradientDirectionContainerType
Image< Vector< TOdfPixelType,(NOrderL *NOrderL+NOrderL+2)/2+NOrderL >, 3 > CoefficientImageType
vnl_matrix< TOdfPixelType > * OdfReconstructionMatrixType
Vector< TOdfPixelType, NrOdfDirections > OdfPixelType
ImageToImageFilter< Image< TReferenceImagePixelType, 3 >, Image< Vector< TOdfPixelType, NrOdfDirections >, 3 > > Superclass
static double Yj(int m, int k, double theta, double phi, bool useMRtrixBasis=false)
virtual GradientDirectionType GetGradientDirection(unsigned int idx) const
void SetGradientImage(const GradientDirectionContainerType *, const GradientImagesType *image)
~AnalyticalDiffusionQballReconstructionImageFilter()
TOdfPixelType BZeroPixelType
void PrintSelf(std::ostream &os, Indent indent) const
vnl_vector< TOdfPixelType > PreNormalize(vnl_vector< TOdfPixelType > vec, typename NumericTraits< ReferencePixelType >::AccumulateType b0)
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType)
This class takes as input one or more reference image (acquired in the absence of diffusion sensitizi...
SmartPointer< Self > Pointer
TGradientImagePixelType GradientPixelType
itk::Image< double, 3 > InputImageType
TReferenceImagePixelType ReferencePixelType
virtual ReferenceImageType * GetReferenceImage()
void BeforeThreadedGenerateData()
void ComputeReconstructionMatrix()
static void Cart2Sph(double x, double y, double z, double *cart)
Image< OdfPixelType, 3 > OdfImageType
Superclass::OutputImageRegionType OutputImageRegionType
Superclass::InputImageType ReferenceImageType
AnalyticalDiffusionQballReconstructionImageFilter()
OdfPixelType Normalize(OdfPixelType odf, typename NumericTraits< ReferencePixelType >::AccumulateType b0)
Image< GradientPixelType, 3 > GradientImageType
SmartPointer< const Self > ConstPointer
AnalyticalDiffusionQballReconstructionImageFilter Self
Image< float, 3 > FloatImageType
VectorImage< GradientPixelType, 3 > GradientImagesType
vnl_matrix< double > CoefficientMatrixType
OdfImageType OutputImageType