diff --git a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.h b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.h index 3604a34a533..a9193b3eb54 100644 --- a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.h +++ b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.h @@ -121,6 +121,10 @@ class ITK_EXPORT MaskFeaturePointSelectionFilter: public ImageToMeshFilter< TIma itkSetMacro(BlockRadius, SizeType); itkGetConstReferenceMacro(BlockRadius, SizeType); + /** set/get half size of the block for the connectivity */ + itkSetMacro(ConnectivityRadius, SizeType); + itkGetConstReferenceMacro(ConnectivityRadius, SizeType); + /** enable/disable tensor computations */ itkSetMacro(ComputeStructureTensors, bool); itkGetMacro(ComputeStructureTensors, bool); @@ -162,6 +166,7 @@ class ITK_EXPORT MaskFeaturePointSelectionFilter: public ImageToMeshFilter< TIma unsigned m_NonConnectivity; std::vector< OffsetType > m_NonConnectivityOffsets; SizeType m_BlockRadius; + SizeType m_ConnectivityRadius; double m_SelectFraction; bool m_ComputeStructureTensors; }; diff --git a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx index c288faca370..391e085799d 100644 --- a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx @@ -38,6 +38,7 @@ MaskFeaturePointSelectionFilter< TImage, TMask, TFeatures > m_NonConnectivity = Self::VERTEX_CONNECTIVITY; m_SelectFraction = 0.1; m_BlockRadius.Fill( 2 ); + m_ConnectivityRadius.Fill( 1 ); m_ComputeStructureTensors = true; } @@ -70,6 +71,7 @@ MaskFeaturePointSelectionFilter< TImage, TMask, TFeatures > } os << std::endl << indent << "m_BlockRadius: " << m_BlockRadius << std::endl + << indent << "m_ConnectivityRadius: " << m_ConnectivityRadius << std::endl << indent << "m_ComputeStructureTensors: " << ( m_ComputeStructureTensors ? "yes" : "no" ) << std::endl << indent << "m_SelectFraction: " << m_SelectFraction << std::endl; } @@ -84,7 +86,7 @@ MaskFeaturePointSelectionFilter< TImage, TMask, TFeatures > m_NonConnectivityOffsets.clear(); // use Neighbourhood to compute all offsets in radius 1 Neighborhood< unsigned, ImageDimension> neighborhood; - neighborhood.SetRadius( NumericTraits< SizeValueType >::One ); + neighborhood.SetRadius( m_ConnectivityRadius ); for ( SizeValueType i = 0, n = neighborhood.Size(); i < n; i++ ) { OffsetType off = neighborhood.GetOffset( i ); diff --git a/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx b/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx index 1835a1d1706..d667deb6a6a 100644 --- a/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx +++ b/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx @@ -257,8 +257,9 @@ BlockMatchingImageFilter< TFixedImage, TMovingImage, TFeatures, TDisplacements, for ( SizeValueType idx = first, last = first + count; idx < last; idx++ ) { FeaturePointsPhysicalCoordinates originalLocation = featurePoints->GetPoint( idx ); - ImageIndexType index; - fixedImage->TransformPhysicalPointToIndex( originalLocation, index ); + ImageIndexType fixedIndex,floatIndex; + fixedImage->TransformPhysicalPointToIndex( originalLocation, fixedIndex ); + floatingImage->TransformPhysicalPointToIndex( originalLocation, floatIndex ); // the block is selected for a minimum similarity metric SimilaritiesValue similarity = NumericTraits< SimilaritiesValue >::Zero; @@ -267,9 +268,9 @@ BlockMatchingImageFilter< TFixedImage, TMovingImage, TFeatures, TDisplacements, DisplacementsVector displacement; // set centers of window and center regions to current location - ImageIndexType start = index - this->m_SearchRadius; + ImageIndexType start = fixedIndex - this->m_SearchRadius; window.SetIndex( start ); - center.SetIndex( index ); + center.SetIndex( floatIndex ); // iterate over neighborhoods in region window, for each neighborhood: iterate over voxels in blockRadius ConstNeighborhoodIterator< FixedImageType > windowIterator( m_BlockRadius, fixedImage, window );