-
-
Notifications
You must be signed in to change notification settings - Fork 727
ENH: Ingest ITKTextureFeatures into Modules/Filtering #6238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hjmjohnson
merged 166 commits into
InsightSoftwareConsortium:main
from
hjmjohnson:ingest-TextureFeatures
May 9, 2026
Merged
Changes from all commits
Commits
Show all changes
166 commits
Select commit
Hold shift + click to select a range
5bce10b
ENH: First commit
jbvimort c84c35e
ENH: First version of itkScalarImageToRunLengthFeaturesImageFilter
jbvimort c2afa37
ENH: First working version of itkScalarImageToRunLengthFeaturesImageF…
jbvimort f035b9d
ENH: Adding of concept checking for the input and output
jbvimort 6b75a42
ENH: ENH Implementation of a multi threaded algorythm
jbvimort 974fdce
ENH: Taking the mask into acount
jbvimort 7a47af9
ENH: Adding of variable get/set functions and transmission of those v…
jbvimort d85b0da
ENH: Implementation of a more complete test
jbvimort a8fd290
ENH: First version of the reimplementation of the
jbvimort f7eca29
ENH: The filter now also treat the boundaries
jbvimort b733674
ENH: ENH Adding of tests for ScalarImageToRunLengthFeaturesImageFilter
jbvimort 7f02ba7
STYLE: Cleaning of the code
jbvimort fb84d21
ENH: Digitalisation of the input image as a pre-treatement in order to
jbvimort 15b0484
ENH: Implementation of a new method to comute the lenght of the runs …
jbvimort e0cefe0
STYLE: Adding of the DOXYGEN documentation and KWStyle correction
jbvimort 2af9a05
ENH: Simplification of the code in order to improve the computation time
jbvimort 08da652
STYLE: Modification of the data for the tests
jbvimort 94c4052
ENH: Adding of a progress reporter in the threaded generated data
jbvimort 4f0cace
ENH: Correction of the test parameters
jbvimort 73f844d
ENH: New algorythm without the utilisation of the itkHistogram class …
jbvimort 26978fb
ENH: This filter now accept ITK::VectorImage as an output (in additio…
jbvimort c30cf1d
PERF: Deletion of a useless verification
jbvimort 464b4d4
PERF: Utilisation of std::sqrt intstead of std::pow
jbvimort 3aa4426
BUG: Correction of the VectorImage implementation for
jbvimort d621ae8
BUG: Correction and adding of some tests for ImageVector computation
jbvimort 8b3693b
PERF: Creation of the itkScalarImageToTextureFeaturesImageFilter class
jbvimort 0e75320
PERF: Adding of an intern variable in order to choose if the histogra…
jbvimort bdc656c
ENH: Implementation of the computation part for
jbvimort 0eb9833
ENH: Adding of tests for ScalarImageToTextureFeaturesImageFilter
jbvimort b61025a
STYLE: Creation of the documentation for ScalarImageToTextureFeatures…
jbvimort aee8d62
ENH: Creation of the wrapping
jbvimort 5ead680
BUG: Wrapping required types
fbudin69500 7d8d37b
BUG: Missing methods definition
fbudin69500 27f3b62
ENH: Supretion of an unused variable
jbvimort 8d3724c
ENH: EMH: Adding of tests for every Set function of each filter
jbvimort 41927e2
BUG: Correction of unwanted rounding due to integers
jbvimort ea681c1
ENH: Wrapping of reders/writters able to deal with the output images …
jbvimort a3482ae
STYLE: Correction of the doxygen documentation
jbvimort 290800b
ENH: Add scikit-build configuration
thewtex f263e78
ENH: Merge pull request #2 from thewtex/python-wheels
thewtex badec00
ENH: Move testing data from Data to Input and Baseline folders.
23506b0
BUG: Remove call to FillBuffer on unallocated memory.
f0919a2
ENH: Merge pull request #6 from jhlegarreta/MoveTestDataToInputBaseli…
jbvimort 828d6e7
ENH: Finish PrintSelf methods implementation.
ab6022a
COMP: Use itk::Math::abs instead of std::abs
thewtex 93a5913
ENH: Merge pull request #4 from jhlegarreta/FinishPrintSelfImplementa…
jbvimort edca43b
ENH: Merge pull request #8 from thewtex/VS2008
jbvimort f1fce07
ENH: Increase code coverage.
bdff5b6
ENH: Merge pull request #5 from jhlegarreta/IncreaseCodeCoverage
jbvimort 5e6b6e4
BUG: Fix internal image initialization and type
blowekamp ac6f8ce
BUG: use vnl_matrix over nested array allocation
blowekamp 61c910f
ENH: Merge pull request #11 from blowekamp/FilterImprovements
thewtex 07bab78
STYLE: Renaming itkScalarImageToTextureFeatureImageFilter into
jbvimort 406a7af
STYLE: Renaming itkScalarImageToRunLengthFeaturesImageFilter in
jbvimort 95c49bc
STYLE: Typo correction, Coocurence => Coocurrence
jbvimort d3badb7
STYLE: Remove unnecessary variables from CMakeLists.txt.
e1820b5
ENH: Improve modifiers for method arguments
blowekamp 57adecf
ENH: Remove unneeded const_cast
blowekamp 3bcb886
ENH: prefer vnl_matrix::fill over loop.
blowekamp fcb0dd4
COMP: Merge branch 'master' into CleanUpTestCMakeLists
jbvimort 4fb3af8
COMP: Merge pull request #16 from jhlegarreta/CleanUpTestCMakeLists
jbvimort e9b8ae2
STYLE: Merge pull request #17 from blowekamp/StyleAndPerformanceTweaks
jbvimort b34a38d
ENH: Use BinaryFunctor for "digitializing" input image
blowekamp 0e8828b
BUG: Free digitized image after filter execution
blowekamp 2f815bf
BUG: Use proper GenerateOutputInformation method to set vector length
blowekamp d96a929
ENH: Make the MaskedInput image an optional named input
blowekamp bca9cb2
ENH: Merge pull request #18 from blowekamp/ImprovePreprocessingAndPip…
jbvimort 50fc788
ENH: Import TextureMovingHistogramImageFilter from old repository
blowekamp 6e3aed7
ENH: Adding more documentation and cleaning code
blowekamp b13dcd6
STYLE: Rename filter to FirstOrderTextureFeaturesImageFilter
blowekamp ed12f5e
DOC: enumerate the output pixels components
blowekamp 738bc5e
ENH: Add test from Gaussian distributed samples
blowekamp e01d104
ENH: Prefer explicit division of cached inverse.
blowekamp 16c4df3
ENH: add cthead1.png data to local module
blowekamp 25189f5
COMP: Add missing itkMath header
blowekamp 9730fed
COMP: address warnings about bracket initialization
blowekamp bfd3e94
ENH: Disable Google dependency and tests with ITK version <4.12
blowekamp d562d53
ENH: Merge pull request #12 from blowekamp/AddFirstOrderTextureHistor…
jbvimort 65530a2
BUG: Correction of the binarisation
jbvimort 661f61b
COMP: Address typename outside of template warnings.
thewtex f9fa48b
COMP: RunLength signed / unsigned comparison
thewtex 756ebec
BUG: Spelling Histograme -> Histogram
thewtex 442614c
COMP: Merge pull request #23 from thewtex/warnings
thewtex 0e15427
BUG: Fix build warnings.
1145dc4
DOC: Fix spelling, capitalization mistakes in comments.
8c8bb57
COMP: Merge pull request #24 from jhlegarreta/FixBuildWarnings
thewtex 126b683
DOC: Merge pull request #25 from jhlegarreta/FixOrtographyInComments
thewtex 5245434
BUG: Initialize m_Spacing in RunLengthTextureFeatures
thewtex 7f6da81
STYLE: Add colons / spacing when printing out values
thewtex d5dfbf2
BUG: Address RunLengthTextureFeatures histogram memory leak
thewtex 0c23f7d
BUG: Spelling: curent -> current
thewtex acc760e
BUG: Spelling: DigitalisedInputImageg
thewtex 9d30f07
BUG: Suppretion of unused variable
jbvimort b3473e6
COMP: Run time improvement
jbvimort 9a83122
BUG: Adding of a missing condition in order to remove the run smaller…
jbvimort 0a27240
ENH: Merge pull request #29 from jbvimort/memory-access
thewtex 76f0635
BUG: Use GTest for ITK>=4.13
blowekamp d01ef9e
BUG: Fix typeo for Google Test test case name
blowekamp 916d3c5
BUG: Filling the output image even for voxels outside of the mask
jbvimort 5b905de
ENH: Merge pull request #30 from blowekamp/FixITKVersionForGTest
jbvimort 36665be
ENH: Merge pull request #31 from jbvimort/WindowsFix
thewtex ebd271a
BUG: Rename and replace min/max setter with separate setter methods
blowekamp c61064b
ENH: Make Masked input image an optional named input
blowekamp d5a25ac
ENH: Move PreProcessingFunctor to separate file as Digitizer functor
blowekamp 1b7f20f
BUG: Free digitized image after threaded execution
blowekamp f433afe
BUG: Correct spelling to "Digitized"
blowekamp 5f25e0f
BUG: Use proper GenerateOutputInformation method to set vector length
blowekamp d0205c4
ENH: Use BinaryFunctor for "digitializing" input image
blowekamp 3672d60
ENH: use vnl_matrix over nested array allocation
blowekamp a95c5bb
ENH: Add template parameter to specify the mask image type
blowekamp e7ccb05
ENH: Change default mask template type to be of unsigned char pixel type
blowekamp 9b6f13f
ENH: Merge pull request #41 from blowekamp/AddMaskImageTypeTemplateAr…
thewtex 74a19fc
BUG: Remove duplicate wrapping of itk::ImageIOBase
thewtex b494fbd
COMP: Add missing NumericTraits header to itkDigitizerFunctor
thewtex ecbefa7
ENH: Merge pull request #43 from thewtex/duplicate-wrapping
thewtex f417f21
ENH: Allowing the usage of float as input image
jbvimort 07b53a4
ENH: Modification of the internal typedef to protected for a better API
jbvimort 5ca1d46
BUG: Missing itkMath.h include
aaac7c7
ENH: Merge pull request #49 from fbudin69500/MissingItkMathHeader
thewtex 181b8cf
ENH: ITKv5 override consistency
hjmjohnson c3bf76c
COMP: Use C++11 override directly
hjmjohnson b86542c
COMP: Use C++11 nullptr directly
hjmjohnson d630fce
ENH: Merge pull request #51 from InsightSoftwareConsortium/ITKv5
hjmjohnson eb1150f
STYLE: Modernize to C++11 conventions
hjmjohnson e1a8f97
STYLE: Replace itkStaticConstMacro with static constexpr
hjmjohnson 8ff45e0
STYLE: Prefer C++11 type alias over typedef
hjmjohnson 34570af
STYLE: Prefer constexpr for const numeric literals
hjmjohnson 2048fc6
STYLE: Merge pull request #52 from InsightSoftwareConsortium/ITKv5Style
hjmjohnson d5a1272
STYLE: Use raw pointer inside pipeline methods
blowekamp a430754
BUG: Manually create pixel of proper length
blowekamp d6606d5
COMP: Move ITK_DISALLOW_COPY_AND_ASSIGN calls to public section.
1602c6a
ENH: Merge pull request #53 from blowekamp/FixVariableLengthVectorIni…
thewtex c7fff88
ENH: Merge pull request #54 from jhlegarreta/MoveDISALLOWCOPYANDASSIG…
thewtex c34170e
BUG: Use itk::SimpleFilterWatcher instead of itk::FilterWatcher.
d30337e
BUG: Fix test errors stemming from the new multi-threading mechanism.
990867d
ENH: Merge pull request #60 from dzenanz/FixPoolMultiThreaderErrors
dzenanz d117526
ENH: Wrap VectorImage before Image of Vector
thewtex a0dbadb
COMP: NumberOfThreads -> NumberOfWorkUnits
thewtex fc241be
ENH: Merge pull request #63 from thewtex/WrapVectorImage
thewtex 6ac09c1
STYLE: Prefer error checked std::sto[id] over ato[if].
jhlegarreta e578d29
ENH: Merge pull request #66 from jhlegarreta/PreferStdStoOverAtoStrin…
hjmjohnson 366cbee
BUG: Skip single pixel textures
maekclena ea8c8ff
ENH: Merge pull request #73 from maekclena/nan_values
thewtex 0ad5e68
BUG: Avoid histogram range overflow
maekclena d0ebe4d
STYLE: Add ITK prefix to testing macros
jhlegarreta 907aa24
ENH: Add .gitattributes to allow running ITK clang-formatting scripts
hjmjohnson 3152a8c
STYLE: Prefer = default to explicitly trivial implementations
hjmjohnson 6933cd6
STYLE: Use default member initialization
hjmjohnson 0cefe1b
DOC: Update copyright assignment to NumFOCUS
hjmjohnson a13868d
ENH: This code no longer supports ITK 4.13
hjmjohnson a2db191
STYLE: Rename ITK_DISALLOW_COPY_AND_ASSIGN to ITK_DISALLOW_COPY_AND_MOVE
mseng10 2fb1719
ENH: Bump ITK and change http to https
tbirdso af65ff3
ENH: Remove unused FixedArray wrapping
PranjalSahu 548d0f4
ENH: Merge pull request #98 from PranjalSahu/removefixed
thewtex 86442f6
STYLE: Add itkVirtualGetNameOfClassMacro + itkOverrideGetNameOfClassM…
hjmjohnson ee3f831
STYLE: Replace itkStaticConstMacro with static constexpr
hjmjohnson ee27184
ENH: Merge pull request #104 from InsightSoftwareConsortium/replace-i…
thewtex 8ad923c
ENH: Convert from md5 to .cid tags.
hjmjohnson ecb5ea8
ENH: Add v4 whitelist for TextureFeatures ingest
hjmjohnson b20c5f4
ENH: Ingest ITKTextureFeatures into Modules/Filtering
hjmjohnson 99dd89a
DOC: Add TextureFeatures README pointing at upstream
hjmjohnson 9755347
COMP: Remove TextureFeatures .remote.cmake (in-tree)
hjmjohnson 0078c37
ENH: Enable Module_TextureFeatures in configure-ci
hjmjohnson 8353852
COMP: Address TextureFeatures review concerns
hjmjohnson 813ee16
STYLE: Address Greptile review on TextureFeatures
hjmjohnson 9a16d90
COMP: Inline static DESCRIPTION in itk-module.cmake
hjmjohnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| project(TextureFeatures) | ||
|
|
||
| itk_module_impl() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # TextureFeatures | ||
|
|
||
| In-tree ITK module providing N-dimensional textural feature image | ||
| filters. The flagship classes compute first-order, run-length, and | ||
| co-occurrence (GLCM) texture features over a sliding window for each | ||
| voxel of an input image, producing per-feature output maps suitable | ||
| for radiomics and computer-vision pipelines. | ||
|
|
||
| The flagship filters are | ||
| `itk::CoocurrenceTextureFeaturesImageFilter`, | ||
| `itk::FirstOrderTextureFeaturesImageFilter`, and | ||
| `itk::RunLengthTextureFeaturesImageFilter`, with supporting | ||
| `itk::DigitizerFunctor` and `itk::FirstOrderTextureHistogram` building | ||
| blocks. | ||
|
|
||
| ## Origin | ||
|
|
||
| Ingested from the standalone remote module | ||
| [**InsightSoftwareConsortium/ITKTextureFeatures**](https://github.com/InsightSoftwareConsortium/ITKTextureFeatures) | ||
| on 2026-05-08, following the v4 ingestion guidelines defined in | ||
| InsightSoftwareConsortium/ITK#6204. The upstream repository will be | ||
| archived read-only after this PR merges; it remains reachable at the | ||
| URL above for historical reference (notably the `doc/` and `example/` | ||
| directories, which were intentionally left in the upstream archive). | ||
|
|
||
| ## References | ||
|
|
||
| - Vimort J., McCormick M., Budin F., Paniagua B. | ||
| *Computing Textural Feature Maps for N-Dimensional images.* | ||
| The Insight Journal. January-December. 2017. | ||
| <https://doi.org/10.54294/qy48ty> |
263 changes: 263 additions & 0 deletions
263
Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,263 @@ | ||
| /*========================================================================= | ||
| * | ||
| * Copyright NumFOCUS | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0.txt | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| *=========================================================================*/ | ||
| #ifndef itkCoocurrenceTextureFeaturesImageFilter_h | ||
| #define itkCoocurrenceTextureFeaturesImageFilter_h | ||
|
|
||
| #include "itkImageToImageFilter.h" | ||
| #include "itkConstNeighborhoodIterator.h" | ||
| #include "itkVectorContainer.h" | ||
|
|
||
| namespace itk | ||
| { | ||
| namespace Statistics | ||
| { | ||
| /** \class CoocurrenceTextureFeaturesImageFilter | ||
| * \brief This class computes texture descriptions for each voxel of | ||
| * a given image and a mask image if provided. The output image can then be | ||
| * displayed by using colormaps. | ||
| * | ||
| * This filter computes a N-D image where each voxel will contain | ||
| * a vector of up to 8 scalars representing the texture features | ||
| * (of the specified neighborhood) from a N-D scalar image. | ||
| * The texture features are computed for each spatial | ||
| * direction and averaged afterward. | ||
| * | ||
| * This filter use grey-level co-occurence matrix in order to compute description a la Haralick. (See | ||
| * Haralick, R.M., K. Shanmugam and I. Dinstein. 1973. Textural Features for | ||
| * Image Classification. IEEE Transactions on Systems, Man and Cybernetics. | ||
| * SMC-3(6):610-620. See also Haralick, R.M. 1979. Statistical and Structural | ||
| * Approaches to Texture. Proceedings of the IEEE, 67:786-804.) | ||
| * | ||
| * Template Parameters: | ||
| * -# The input image type: a N dimensional image where the pixel type MUST be integer. | ||
| * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or a | ||
| *VectorImage. | ||
| * | ||
| * Inputs and parameters: | ||
| * -# An image | ||
| * -# A mask defining the region over which texture features will be | ||
| * calculated. (Optional) | ||
| * -# The pixel value that defines the "inside" of the mask. (Optional, defaults | ||
| * to 1 if a mask is set.) | ||
| * -# The number of intensity bins. (Optional, defaults to 256.) | ||
| * -# The set of directions (offsets) to average across. (Optional, defaults to | ||
| * {(-1, 0), (-1, -1), (0, -1), (1, -1)} for 2D images and scales analogously | ||
| * for ND images.) | ||
| * -# The pixel intensity range over which the features will be calculated. | ||
| * (Optional, defaults to the full dynamic range of the pixel type.) | ||
| * -# The size of the neighborhood radius. (Optional, defaults to 2.) | ||
| * | ||
| * Recommendations: | ||
| * -# Input image: To improve the computation time, the useful data should take as much | ||
| * space as possible in the input image. If the useful data is concentrated in one part of | ||
| * the image a crop step should be considered prior to the usage of this filter. | ||
| * -# Mask: Even if optional, the usage of a mask will greatly improve the computation time. | ||
| * -# Number of intensity bins: The number of bins should be adapted to the type of results expected | ||
| * and the intensity range. In addition a high number of bins will increase the | ||
| * computation time. | ||
| * -# Pixel intensity range: For better results the Pixel intensity should be adapted to the input image | ||
| * intensity range. For example they could be the minimum and maximum intensity of the image, or 0 and | ||
| * the maximum intensity (if the negative values are considered as noise). | ||
| * | ||
| * WARNING: This probably won't work for pixels of double or long-double type | ||
| * unless you set the histogram min and max manually. This is because the largest | ||
| * histogram bin by default has max value of the largest possible pixel value | ||
| * plus 1. For double and long-double types, whose "RealType" as defined by the | ||
| * NumericTraits class is the same, and thus cannot hold any larger values, | ||
| * this would cause a float overflow. | ||
| * | ||
| * \sa HistogramToTextureFeaturesFilter | ||
| * \sa ScalarImageToCooccurrenceMatrixFilte | ||
| * \sa ScalarImageToTextureFeaturesFilter | ||
| * | ||
| * \author: Jean-Baptiste Vimort | ||
| * \ingroup TextureFeatures | ||
| **/ | ||
|
|
||
| template <typename TInputImage, | ||
| typename TOutputImage, | ||
| typename TMaskImage = Image<unsigned char, TInputImage::ImageDimension>> | ||
| class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageToImageFilter<TInputImage, TOutputImage> | ||
| { | ||
| public: | ||
| /** Standard type alias */ | ||
| using Self = CoocurrenceTextureFeaturesImageFilter; | ||
| using Superclass = ImageToImageFilter<TInputImage, TOutputImage>; | ||
| using Pointer = SmartPointer<Self>; | ||
| using ConstPointer = SmartPointer<const Self>; | ||
|
|
||
| /** Run-time type information (and related methods). */ | ||
| itkOverrideGetNameOfClassMacro(CoocurrenceTextureFeaturesImageFilter); | ||
|
|
||
| /** standard New() method support */ | ||
| itkNewMacro(Self); | ||
|
|
||
| using InputImageType = TInputImage; | ||
| using OutputImageType = TOutputImage; | ||
| using MaskImageType = TMaskImage; | ||
|
|
||
| using PixelType = typename InputImageType::PixelType; | ||
| using MaskPixelType = typename MaskImageType::PixelType; | ||
| using IndexType = typename InputImageType::IndexType; | ||
| using PointType = typename InputImageType::PointType; | ||
|
|
||
| using OffsetType = typename InputImageType::OffsetType; | ||
| using OffsetVector = VectorContainer<unsigned char, OffsetType>; | ||
| using OffsetVectorPointer = typename OffsetVector::Pointer; | ||
| using OffsetVectorConstPointer = typename OffsetVector::ConstPointer; | ||
|
|
||
| using InputRegionType = typename InputImageType::RegionType; | ||
| using OutputRegionType = typename OutputImageType::RegionType; | ||
|
|
||
| using NeighborhoodRadiusType = typename itk::ConstNeighborhoodIterator<InputImageType>::RadiusType; | ||
|
|
||
| using MeasurementType = typename NumericTraits<PixelType>::RealType; | ||
| using RealType = typename NumericTraits<PixelType>::RealType; | ||
|
|
||
| /** Method to set/get the Neighborhood radius */ | ||
| itkSetMacro(NeighborhoodRadius, NeighborhoodRadiusType); | ||
| itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); | ||
|
|
||
| /** Method to set the mask image */ | ||
| itkSetInputMacro(MaskImage, MaskImageType); | ||
|
|
||
| /** Method to get the mask image */ | ||
| itkGetInputMacro(MaskImage, MaskImageType); | ||
|
|
||
|
|
||
| /** Specify the default number of bins per axis */ | ||
| static constexpr unsigned int DefaultBinsPerAxis = 256; | ||
|
|
||
| /** | ||
| * Set the offsets over which the intensities pairs will be computed. | ||
| * Invoking this function clears the previous offsets. | ||
| * Note: for each individual offset in the OffsetVector, the rightmost non-zero | ||
| * offset element must be positive. For example, in the offset list of a 2D image, | ||
| * (1, 0) means the offset along x-axis. (1, 0) has to be set instead | ||
| * of (-1, 0). This is required from the iterating order of pixel iterator. | ||
| * | ||
| */ | ||
| itkSetObjectMacro(Offsets, OffsetVector); | ||
|
|
||
| /** | ||
| * Set offset over which the intensities pairs will be computed. | ||
| * Invoking this function clears the previous offset(s). | ||
| * Note: for each individual offset, the rightmost non-zero | ||
| * offset element must be positive. For example, in the offset list of a 2D image, | ||
| * (1, 0) means the offset along x-axis. (1, 0) has to be set instead | ||
| * of (-1, 0). This is required from the iterating order of pixel iterator. | ||
| * | ||
| */ | ||
| void | ||
| SetOffset(const OffsetType offset); | ||
|
|
||
| /** | ||
| * Get the current offset(s). | ||
| */ | ||
| itkGetModifiableObjectMacro(Offsets, OffsetVector); | ||
|
|
||
| /** Set number of histogram bins along each axis */ | ||
| itkSetMacro(NumberOfBinsPerAxis, unsigned int); | ||
|
|
||
| /** Get number of histogram bins along each axis */ | ||
| itkGetConstMacro(NumberOfBinsPerAxis, unsigned int); | ||
|
|
||
| /** Get the max pixel value defining one dimension of the joint histogram. */ | ||
| itkGetConstMacro(HistogramMaximum, PixelType); | ||
| itkSetMacro(HistogramMaximum, PixelType); | ||
|
|
||
| /** Get the min pixel value defining one dimension of the joint histogram. */ | ||
| itkGetConstMacro(HistogramMinimum, PixelType); | ||
| itkSetMacro(HistogramMinimum, PixelType); | ||
|
|
||
| /** | ||
| * Set the pixel value of the mask that should be considered "inside" the | ||
| * object. Defaults to 1. | ||
| */ | ||
| itkSetMacro(InsidePixelValue, MaskPixelType); | ||
| itkGetConstMacro(InsidePixelValue, MaskPixelType); | ||
|
|
||
| /** Set the calculator to normalize the histogram (divide all bins by the | ||
| total frequency). Normalization is off by default. */ | ||
| itkSetMacro(Normalize, bool); | ||
| itkGetConstMacro(Normalize, bool); | ||
| itkBooleanMacro(Normalize); | ||
|
|
||
| using OutputPixelType = typename OutputImageType::PixelType; | ||
| using OutputRealType = typename NumericTraits<OutputPixelType>::ScalarRealType; | ||
|
|
||
| #ifdef ITK_USE_CONCEPT_CHECKING | ||
| // Begin concept checking | ||
| itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint<OutputRealType>)); | ||
| // End concept checking | ||
| #endif | ||
|
|
||
| protected: | ||
| using HistogramIndexType = int; | ||
| using DigitizedImageType = itk::Image<HistogramIndexType, TInputImage::ImageDimension>; | ||
| using NeighborhoodIteratorType = typename itk::ConstNeighborhoodIterator<DigitizedImageType>; | ||
| using NeighborIndexType = typename NeighborhoodIteratorType::NeighborIndexType; | ||
|
|
||
| CoocurrenceTextureFeaturesImageFilter(); | ||
| ~CoocurrenceTextureFeaturesImageFilter() override = default; | ||
|
|
||
| bool | ||
| IsInsideNeighborhood(const OffsetType & iteratedOffset); | ||
| void | ||
| ComputeFeatures(const vnl_matrix<unsigned int> & hist, | ||
| const unsigned int totalNumberOfFreq, | ||
| typename TOutputImage::PixelType & outputPixel); | ||
| void | ||
| ComputeMeansAndVariances(const vnl_matrix<unsigned int> & hist, | ||
| const unsigned int totalNumberOfFreq, | ||
| double & pixelMean, | ||
| double & marginalMean, | ||
| double & marginalDevSquared, | ||
| double & pixelVariance); | ||
| void | ||
| PrintSelf(std::ostream & os, Indent indent) const override; | ||
|
|
||
| /** This method causes the filter to generate its output. */ | ||
| void | ||
| BeforeThreadedGenerateData() override; | ||
| void | ||
| AfterThreadedGenerateData() override; | ||
| void | ||
| DynamicThreadedGenerateData(const OutputRegionType & outputRegionForThread) override; | ||
| void | ||
| GenerateOutputInformation() override; | ||
|
|
||
| private: | ||
| typename DigitizedImageType::Pointer m_DigitizedInputImage; | ||
|
|
||
| NeighborhoodRadiusType m_NeighborhoodRadius; | ||
| OffsetVectorPointer m_Offsets; | ||
| unsigned int m_NumberOfBinsPerAxis; | ||
| PixelType m_HistogramMinimum; | ||
| PixelType m_HistogramMaximum; | ||
| MaskPixelType m_InsidePixelValue; | ||
| bool m_Normalize; | ||
| }; | ||
| } // end of namespace Statistics | ||
| } // end of namespace itk | ||
|
|
||
| #ifndef ITK_MANUAL_INSTANTIATION | ||
| # include "itkCoocurrenceTextureFeaturesImageFilter.hxx" | ||
| #endif | ||
|
|
||
| #endif | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.