3 #include <itkImageRegion.h> 5 #include <itkMultiThreaderBase.h> 7 #include <itkVectorImage.h> 13 template <
class PixelType,
unsigned int NDimensions=3>
26 typedef typename ScalarImageType::IndexType
IndexType;
27 typedef typename ScalarImageType::PointType
PointType;
43 itkSetMacro(NumberOfThreads,
unsigned int)
44 itkGetMacro(NumberOfThreads,
unsigned int)
47 itkGetMacro(PercentageKept,
double)
50 itkGetMacro(ScalarVarianceThreshold,
double)
53 itkGetMacro(OrientedModelVarianceThreshold,
double)
56 itkGetMacro(RequestedRegion, ImageRegionType)
61 itkGetMacro(BlockSpacing,
unsigned int)
62 itkGetMacro(BlockSize,
unsigned int)
78 std::vector <ImageRegionType> &
GetOutput();
86 std::vector < std::vector <ImageRegionType> >
tmpOutput;
105 m_NumberOfThreads = itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads();
107 m_ScalarVarianceThreshold = 5.0;
108 m_OrientedModelVarianceThreshold = 0.0;
110 m_PercentageKept = 0.8;
111 m_GenerationMasks.clear();
123 unsigned int threadId);
129 bool ProgressCounter(std::vector <unsigned int> &counter, std::vector <unsigned int> &bounds);
133 bool operator() (
const std::pair<
double, std::pair <PointType, ImageRegionType> > & f,
134 const std::pair<
double, std::pair <PointType, ImageRegionType> > & s)
135 {
return (f.first < s.first); }
140 void operator=(
const Self&);
142 unsigned int m_BlockSize;
143 unsigned int m_BlockSpacing;
144 unsigned int m_NumberOfThreads;
146 double m_ScalarVarianceThreshold;
147 double m_OrientedModelVarianceThreshold;
148 double m_PercentageKept;
152 std::vector <ScalarImagePointer> m_ReferenceScalarImages;
153 std::vector <VectorImagePointer> m_ReferenceVectorImages;
155 std::vector <MaskImagePointer> m_GenerationMasks;
157 std::vector <ImageRegionType> m_Output;
158 std::vector <unsigned int> m_MaskStartingIndexes;
159 std::vector <PointType> m_OutputPositions;
itk::Image< unsigned char, NDimensions > MaskImageType
ScalarImageType * GetReferenceScalarImage(unsigned int i)
std::vector< std::vector< unsigned int > > nb_blocks
std::vector< std::vector< ImageRegionType > > tmpOutput
std::vector< std::vector< unsigned int > > startBlocks
void RegionBlockGenerator(BlockGeneratorThreadStruct *workStr, unsigned int threadId)
virtual bool CheckOrientedModelVariance(unsigned int imageIndex, ImageRegionType ®ion, double &blockVariance, BlockGeneratorThreadStruct *workStr, unsigned int threadId)
ScalarImageType::PointType PointType
virtual ~BlockMatchingInitializer()
virtual void AddReferenceImage(itk::ImageBase< NDimensions > *refImage)
std::vector< unsigned int > totalNumberOfBlocks
void SetBlockSize(unsigned int val)
std::vector< unsigned int > blockStartOffsets
VectorImageType * GetReferenceVectorImage(unsigned int i)
std::vector< PointType > & GetOutputPositions()
void SetRequestedRegion(const ImageRegionType &val)
void clearGenerationMasks()
ScalarImageType::IndexType IndexType
virtual void InitializeThreading(unsigned int maskIndex, BlockGeneratorThreadStruct *&workStr)
virtual ~BlockGeneratorThreadStruct()
To be able to inherit from it.
itk::SmartPointer< const Self > ConstPointer
void SetPercentageKept(double val)
bool CheckScalarVariance(ScalarImageType *refImage, ImageRegionType ®ion, double &blockVariance)
void ComputeBlocksOnGenerationMask(unsigned int maskIndex)
std::vector< std::vector< PointType > > blocks_positions
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreadBlockGenerator(void *arg)
ScalarImageType::RegionType ImageRegionType
void AddGenerationMask(MaskImageType *mask)
BlockMatchingInitializer()
itk::SmartPointer< Self > Pointer
void SetOrientedModelVarianceThreshold(double val)
itk::VectorImage< PixelType, NDimensions > VectorImageType
itk::Image< PixelType, NDimensions > ScalarImageType
std::vector< std::vector< double > > blocks_variances
bool ProgressCounter(std::vector< unsigned int > &counter, std::vector< unsigned int > &bounds)
ScalarImageType::Pointer ScalarImagePointer
VectorImageType::Pointer VectorImagePointer
WeightImageType::Pointer WeightImagePointer
std::vector< unsigned int > & GetMaskStartingIndexes()
bool CheckBlockConditions(ImageRegionType ®ion, double &blockVariance, BlockGeneratorThreadStruct *workStr, unsigned int threadId)
BlockMatchingInitializer< PixelType, NDimensions > Self
itk::Image< double, NDimensions > WeightImageType
void SetBlockSpacing(unsigned int val)
MaskImageType::Pointer MaskImagePointer
void SetScalarVarianceThreshold(double val)
itk::ImageBase< NDimensions > * GetFirstReferenceImage()
std::vector< ImageRegionType > & GetOutput()