17 #ifndef __itkDiffusionQballPrepareVisualizationImageFilter_cpp
18 #define __itkDiffusionQballPrepareVisualizationImageFilter_cpp
25 #include "itkImageRegionConstIterator.h"
26 #include "itkImageRegionConstIteratorWithIndex.h"
27 #include "itkImageRegionIterator.h"
29 #include "vnl/vnl_vector.h"
32 #define _USE_MATH_DEFINES
39 template<
class TOdfPixelType,
int NrOdfDirections>
50 this->SetNumberOfRequiredInputs( 1 );
53 template<
class TOdfPixelType,
57 ::BeforeThreadedGenerateData()
59 if( m_NormalizationMethod == PV_GLOBAL_MAX )
63 this->ProcessObject::GetInput(0) );
66 filter->SetInput(inputImagePointer);
67 filter->SetNumberOfThreads(4);
68 filter->SetComputationMethod(GfaFilterType::GFA_MAX_ODF_VALUE);
71 typedef typename itk::MinimumMaximumImageCalculator< typename GfaFilterType::OutputImageType >
74 maxFilter->SetImage(filter->GetOutput());
75 maxFilter->ComputeMaximum();
77 m_GlobalInputMaximum = maxFilter->GetMaximum();
84 this->ProcessObject::GetInput(0) );
87 filter->SetInput(inputImagePointer);
88 filter->SetNumberOfThreads(4);
89 filter->SetComputationMethod(m_ScaleByGfaType);
90 filter->SetParam1(m_GfaParam1);
91 filter->SetParam2(m_GfaParam2);
93 m_GfaImage = filter->GetOutput();
97 template<
class TOdfPixelType,
106 ImageRegionIterator< OutputImageType > oit(outputImage, outputRegionForThread);
110 typedef ImageRegionConstIterator< InputImageType > InputIteratorType;
114 this->ProcessObject::GetInput(0) );
115 InputIteratorType git(inputImagePointer, outputRegionForThread );
118 typedef ImageRegionConstIterator< GfaImageType > GfaIteratorType;
119 GfaIteratorType gfaIt(m_GfaImage, outputRegionForThread);
121 while( !git.IsAtEnd() )
123 OdfVectorType b = git.Get();
124 OdfType odf = b.GetDataPointer();
126 switch( m_NormalizationMethod )
134 odf = odf.MaxNormalize();
139 odf = odf.MinMaxNormalize();
144 odf *= 1.0/m_GlobalInputMaximum;
147 case PV_MIN_MAX_INVERT:
149 odf = odf.MinMaxNormalize();
150 for(
int i=0; i<NrOdfDirections; i++)
152 odf[i] = 1.0 - odf[i];
165 oit.Set( odf.GetDataPointer() );
170 std::cout <<
"One Thread finished extraction" << std::endl;
173 template<
class TOdfPixelType,
177 ::PrintSelf(std::ostream& os, Indent indent)
const
179 Superclass::PrintSelf(os,indent);
180 os << indent <<
"m_Threshold: " <<
181 m_Threshold << std::endl;
186 #endif // __itkDiffusionQballPrepareVisualizationImageFilter_cpp
DiffusionQballPrepareVisualizationImageFilter()
itk::SmartPointer< Self > Pointer
Superclass::OutputImageRegionType OutputImageRegionType
Represents an ODF for Q-Ball imaging.
Superclass::OutputImageType OutputImageType
Superclass::InputImageType InputImageType
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.