17 #ifndef __itkDiffusionMultiShellQballReconstructionImageFilter_h_
18 #define __itkDiffusionMultiShellQballReconstructionImageFilter_h_
20 #include <itkImageToImageFilter.h>
27 template<
class TReferenceImagePixelType,
class TGradientImagePixelType,
class TOdfPixelType,
int NOrderL,
int NrOdfDirections>
36 typedef ImageToImageFilter< Image< TReferenceImagePixelType, 3>, Image< Vector< TOdfPixelType, NrOdfDirections >, 3 > >
Superclass;
63 typedef std::map<unsigned int, std::vector<unsigned int> >
BValueMap;
70 itkFactorylessNewMacro(Self)
77 {
return ( static_cast< typename Superclass::InputImageType *>(this->ProcessObject::GetInput(0)) ); }
85 void SetGradientImage(
const GradientDirectionContainerType * gradientDirectionContainer,
const GradientImagesType *gradientImage ,
float bvalue);
99 itkSetMacro( Threshold, ReferencePixelType )
100 itkGetMacro( Threshold, ReferencePixelType )
104 itkGetMacro( BZeroImage, typename BZeroImageType::Pointer)
107 itkSetMacro( Lambda,
double )
108 itkGetMacro( Lambda,
double )
112 ~DiffusionMultiShellQballReconstructionImageFilter() { }
113 void PrintSelf(std::ostream& os, Indent indent)
const;
115 void ThreadedGenerateData(
const OutputImageRegionType &outputRegionForThread, ThreadIdType NumberOfThreads );
120 enum ReconstructionType
122 Mode_Analytical3Shells,
123 Mode_NumericalNShells,
127 ReconstructionType m_ReconstructionType;
130 bool m_Interpolation_Flag;
131 vnl_matrix< double > * m_Interpolation_SHT1_inv;
132 vnl_matrix< double > * m_Interpolation_SHT2_inv;
133 vnl_matrix< double > * m_Interpolation_SHT3_inv;
134 vnl_matrix< double > * m_TARGET_SH_shell1;
135 vnl_matrix< double > * m_TARGET_SH_shell2;
136 vnl_matrix< double > * m_TARGET_SH_shell3;
137 unsigned int m_MaxDirections;
139 vnl_matrix< double > * m_CoeffReconstructionMatrix;
140 vnl_matrix< double > * m_ODFSphericalHarmonicBasisMatrix;
146 unsigned int m_NumberOfGradientDirections;
149 unsigned int m_NumberOfBaselineImages;
152 ReferencePixelType m_Threshold;
160 BValueMap m_BValueMap;
164 bool m_IsHemisphericalArrangementOfGradientDirections;
166 bool m_IsArithmeticProgession;
168 void ComputeReconstructionMatrix(IndiciesVector
const & refVector);
169 void ComputeODFSHBasis();
170 bool CheckDuplicateDiffusionGradients();
171 bool CheckForDifferingShellDirections();
172 IndiciesVector GetAllDirections();
173 void ComputeSphericalHarmonicsBasis(vnl_matrix<double>* QBallReference, vnl_matrix<double>* SHBasisOutput,
int Lorder , vnl_matrix<double>* LaplaciaBaltramiOutput =0 , vnl_vector<int>* SHOrderAssociation =0 , vnl_matrix<double> * SHEigenvalues =0);
174 void Normalize(OdfPixelType & odf );
175 void S_S0Normalization( vnl_vector<double> & vec,
double b0 = 0 );
176 void DoubleLogarithm(vnl_vector<double> & vec);
177 double CalculateThreashold(
const double value,
const double delta);
178 void Projection1(vnl_vector<double> & vec,
double delta = 0.01);
179 void Projection2( vnl_vector<double> & E1, vnl_vector<double> & E2, vnl_vector<double> & E3,
double delta = 0.01);
180 void Projection3( vnl_vector<double> & A, vnl_vector<double> & alpha, vnl_vector<double> & beta,
double delta = 0.01);
181 void StandardOneShellReconstruction(
const OutputImageRegionType& outputRegionForThread);
182 void AnalyticalThreeShellReconstruction(
const OutputImageRegionType& outputRegionForThread);
183 void NumericalNShellReconstruction(
const OutputImageRegionType& outputRegionForThread);
184 void GenerateAveragedBZeroImage(
const OutputImageRegionType& outputRegionForThread);
185 void ComputeSphericalFromCartesian(vnl_matrix<double> * Q,
const IndiciesVector & refShell);
190 template<
typename CurrentValue,
typename WntValue>
191 vnl_vector< WntValue> element_cast (vnl_vector< CurrentValue>
const& v1)
193 vnl_vector<WntValue> result(v1.size());
195 for(
unsigned int i = 0 ; i < v1.size(); i++)
196 result[i] = static_cast< WntValue>(v1[i]);
201 template<
typename type>
202 double dot (vnl_vector_fixed< type ,3>
const& v1, vnl_vector_fixed< type ,3 >
const& v2 )
204 double result = (v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]) / (v1.two_norm() * v2.two_norm());
215 #ifndef ITK_MANUAL_INSTANTIATION
219 #endif //__itkDiffusionMultiShellQballReconstructionImageFilter_h_
itk::SmartPointer< Self > Pointer
SmartPointer< Self > Pointer
Image< TOdfPixelType, 3 > BZeroImageType
SmartPointer< const Self > ConstPointer
void BeforeThreadedGenerateData()
std::map< unsigned int, std::vector< unsigned int > > BValueMap
virtual Superclass::InputImageType * GetInputImage()
itk::Image< double, 3 > InputImageType
Image< OdfPixelType, 3 > OdfImageType
void PrintSelf(std::ostream &os, Indent indent) const
ImageToImageFilter< Image< TReferenceImagePixelType, 3 >, Image< Vector< TOdfPixelType, NrOdfDirections >, 3 > > Superclass
std::vector< unsigned int > IndiciesVector
DiffusionMultiShellQballReconstructionImageFilter Self
VectorImage< GradientPixelType, 3 > GradientImagesType
Image< Vector< TOdfPixelType,(NOrderL *NOrderL+NOrderL+2)/2+NOrderL >, 3 > CoefficientImageType
TGradientImagePixelType GradientPixelType
TReferenceImagePixelType ReferencePixelType
Vector< TOdfPixelType, NrOdfDirections > OdfPixelType
void SetGradientImage(const GradientDirectionContainerType *gradientDirectionContainer, const GradientImagesType *gradientImage, float bvalue)
MITKMATCHPOINTREGISTRATION_EXPORT ResultImageType::Pointer map(const InputImageType *input, const RegistrationType *registration, bool throwOnOutOfInputAreaError=false, const double &paddingValue=0, const ResultImageGeometryType *resultGeometry=NULL, bool throwOnMappingError=true, const double &errorValue=0, mitk::ImageMappingInterpolator::Type interpolatorType=mitk::ImageMappingInterpolator::Linear)
VectorContainer< unsigned int, vnl_vector_fixed< double, 3 > > GradientDirectionContainerType
void SetBValueMap(BValueMap map)
Superclass::OutputImageRegionType OutputImageRegionType
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType NumberOfThreads)
std::map< unsigned int, std::vector< unsigned int > >::iterator BValueMapIteraotr