18 #ifndef __itkSamplingScheme3D_h 19 #define __itkSamplingScheme3D_h 22 #include "itkVectorContainer.h" 24 #include "itkIntTypes.h" 42 template<
class TPixelType=
double >
43 class ITK_EXPORT
SamplingScheme3D :
public VectorContainer<IdentifierType, Point< TPixelType, 3 > >
50 typedef VectorContainer<IdentifierType, Point< TPixelType, 3 > >
Superclass;
60 typedef VectorContainer<IdentifierType, Point< TPixelType, 3 > >
PointsContainer;
81 MatrixPointer GetOrientationsCartesian(
const bool alwarysReCalculate=
false);
82 MatrixPointer GetOrientationsSpherical(
const bool alwarysReCalculate=
false);
83 void SetOrientationsCartesian(
const MatrixPointer mat);
84 void SetOrientationsSpherical(
const MatrixPointer mat);
85 MatrixPointer GetOrientationsCartesianInShell(
const unsigned int shellIndex)
const;
86 MatrixPointer GetOrientationsSphericalInShell(
const unsigned int shellIndex);
89 void SetRadiusVector(
const STDVectorPointer radiusVec);
90 itkGetMacro(RadiusVector, STDVectorPointer);
91 STDVectorPointer GetRadiusVectorInShell(
unsigned int shellIndex);
93 itkSetMacro(Tau,
double);
94 itkGetMacro(Tau,
double);
96 itkSetMacro(DeltaSmall,
double);
97 itkGetMacro(DeltaSmall,
double);
99 itkSetMacro(DeltaBig,
double);
100 itkGetMacro(DeltaBig,
double);
102 itkSetMacro(RadiusThresholdSingleShell,
double);
103 itkGetMacro(RadiusThresholdSingleShell,
double);
105 itkSetMacro(IndicesInShells, Index2DVectorPointer);
106 itkGetMacro(IndicesInShells, Index2DVectorPointer);
115 if (shellIndex<m_IndicesInShells->size())
116 return (*m_IndicesInShells)[shellIndex].size();
122 return m_IndicesInShells->size();
128 if (m_IndicesInShells->size()==0)
130 num.push_back(GetNumberOfSamples());
133 for (
unsigned int i = 0; i < m_IndicesInShells->size(); i += 1 )
134 num.push_back((*m_IndicesInShells)[i].size());
138 void NormalizeDirections();
143 void RemoveSamplesNotIndexed();
146 void GenerateFromRandomPoints(
const std::vector<int>& numberOfPoints);
149 void ReadOrientationFile(
const std::string& gradFile,
const int NoSymmetricDuple=
DIRECTION_NODUPLICATE,
153 void ReadOrientationFileList(
const std::vector<std::string>& gradFileVec,
const int NoSymmetricDuple=
DIRECTION_NODUPLICATE,
156 std::vector<STDVectorType> GroupRadiusValues();
158 virtual void CorrectRadiusValues();
161 void AppendOrientation(
const double x,
const double y,
const double z,
const int shell=-1);
163 void AppendOrientation(
const PointType& point,
const int shell=-1);
165 void AppendOrientationAndRadiusValue(
const double x,
const double y,
const double z,
const double radius,
const int shell=-1);
169 return this->GetElement(index);
173 return (*m_RadiusVector)[index];
177 MatrixPointer CalculateInnerProductMatrix(
const bool isAbsolute=
true)
const;
179 MatrixPointer CalculateElectrostaticEnergyMatrix(
const double order=2.0)
const;
186 double CalculatePackingDensity(
const bool isSymmetric=
true)
const;
187 double CalculatePackingDensityInShell(
const unsigned int shellIndex,
const bool isSymmetric=
true)
const;
193 double CalculateSphericalCodeEntropy(
const bool isSymmetric=
true)
const;
194 double CalculateSphericalCodeEntropyInShell(
const unsigned int shellIndex,
const bool isSymmetric=
true)
const;
196 static double CalculateVoronoiEntropy(
const MatrixType& grad,
const MatrixType& gradTess,
const bool isSymmetric=
true);
197 double CalculateVoronoiEntropy(
const int tess=7,
const bool isSymmetric=
true);
198 double CalculateVoronoiEntropyInShell(
const unsigned int shellIndex,
const int tess=7,
const bool isSymmetric=
true);
200 double CalculateMaxDot(
const unsigned int index,
const bool isSymmetric=
true)
const;
201 double CalculateMaxDotInShell(
const unsigned int sampleIndex,
const unsigned int shellIndex,
const bool isSymmetric=
true)
const;
204 double CalculateMinDistance(
const unsigned int index,
const bool isSymmetric=
true)
const;
205 double CalculateMinDistanceInShell(
const unsigned int sampleIndex,
const unsigned int shellIndex,
const bool isSymmetric=
true)
const;
207 STDVectorType CalculateMinDistance(
const bool isSymmetric=
true)
const;
209 STDVectorType CalculateMinDistanceInShell(
const unsigned int shellIndex,
const bool isSymmetric=
true)
const;
211 void GetNumbers(
int& numberUniqueSamples,
int& numberAntipodalSamples,
int& numberRepeatedSamples )
const;
214 double CalculateElectrostaticEnergy(
const double order=2.0,
const bool isNormalize=
true,
const bool countHalf=
true )
const;
215 double CalculateElectrostaticEnergyInShell(
const unsigned int shellIndex,
const double order=2.0,
const bool isNormalize=
true,
const bool countHalf=
true )
const;
221 static double CalculateMinDistanceUpperBound(
const unsigned int numberOfPoints,
const bool isSphericalDistance=
true);
227 typename LightObject::Pointer InternalClone()
const ITK_OVERRIDE;
229 void PrintSelf(std::ostream& os, Indent indent)
const ITK_OVERRIDE;
263 void operator=(
const Self &);
265 void InsertElement(IdentifierType, PointType);
266 void SetElement(IdentifierType, PointType);
267 PointType & CreateElementAt(IdentifierType);
272 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkSamplingScheme3D_hxx)
PointType GetOrientation(unsigned int index)
Index2DVectorPointer m_IndicesInShells
double m_RadiusThresholdSingleShell
helper functions specifically used in dmritool
STDVectorPointer m_RadiusVector
PointsContainer::Iterator PointsContainerIterator
PointsContainer::ConstIterator PointsContainerConstIterator
unsigned int GetNumberOfSamplesInShell(const unsigned int shellIndex) const
PointsContainer::Pointer PointsContainerPointer
utl::NDArray< double, 2 > MatrixType
std::vector< IndexVectorType > Index2DVectorType
PointsContainer::ConstPointer PointsContainerConstPointer
unsigned int GetNumberOfSamples() const
std::vector< double > STDVectorType
std::vector< int > IndexVectorType
Point< TPixelType, 3 > PointType
this class describes sampling in a 3D space (Q space or R space).
utl_shared_ptr< MatrixType > MatrixPointer
SmartPointer< Self > Pointer
IndexVectorType GetNumberOfSamplesAtEachShell() const
SmartPointer< const Self > ConstPointer
VectorContainer< IdentifierType, Point< TPixelType, 3 > > Superclass
VectorContainer< IdentifierType, Point< TPixelType, 3 > > PointsContainer
utl_shared_ptr< STDVectorType > STDVectorPointer
MatrixPointer m_OrientationsCartesian
virtual ~SamplingScheme3D()
utl_shared_ptr< Index2DVectorType > Index2DVectorPointer
MatrixPointer m_OrientationsSpherical
double GetRadiusValue(unsigned int index)
unsigned int GetNumberOfShells() const