# Algorithms

**URL:** https://discourse.itk.org/c/algorithms/7.md?no_subcategories=false&page=4

[Latest](https://discourse.itk.org/latest.md) · [Categories](https://discourse.itk.org/categories.md) · [Tags](https://discourse.itk.org/tags.md)

**Page:** 5

---

## [LabelStatisticsImageFilter floating point exception](https://discourse.itk.org/t/labelstatisticsimagefilter-floating-point-exception/1395)

<div class="topic-metadata">

**Author:** [@Fijoy\_Vadakkumpadan](https://discourse.itk.org/u/Fijoy_Vadakkumpadan)\
**Replies:** 19\
**Last updated:** [May 29, 2023, 1:53pm UTC](https://discourse.itk.org/t/labelstatisticsimagefilter-floating-point-exception/1395 "2023-05-29T13:53:05Z")

</div>

Hello, Line #170 in LabelStatisticsImageFilter implementation here: is causing a floating point exception and crashing my application. I think the reason is a numerically unstable calculation of variance, resulting …

---

## ['CurvatureRegistrationFilter': is not a member of 'itk'.](https://discourse.itk.org/t/curvatureregistrationfilter-is-not-a-member-of-itk/5190)

<div class="topic-metadata">

**Author:** [@tnayak](https://discourse.itk.org/u/tnayak)\
**Replies:** 4\
**Last updated:** [May 24, 2023, 1:48am UTC](https://discourse.itk.org/t/curvatureregistrationfilter-is-not-a-member-of-itk/5190 "2023-05-24T01:48:18Z")

</div>

Hi all, I am currently try to implement the DeformableRegistration10 example, in that I am getting the following error C2039 ‘CurvatureRegistrationFilter’: is not a member of ‘itk’. Anyone have any idea how to fix this …

---

## [Can itk read RTplan files？](https://discourse.itk.org/t/can-itk-read-rtplan-files/5957)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 5\
**Last updated:** [May 20, 2023, 2:06pm UTC](https://discourse.itk.org/t/can-itk-read-rtplan-files/5957 "2023-05-20T14:06:37Z")

</div>

Can itk read RTplan files？I want get 300a 012c

---

## [Build Simple Functions](https://discourse.itk.org/t/build-simple-functions/5956)

<div class="topic-metadata">

**Author:** [@Oddone-Scatena](https://discourse.itk.org/u/Oddone-Scatena)\
**Replies:** 1\
**Last updated:** [May 19, 2023, 1:45pm UTC](https://discourse.itk.org/t/build-simple-functions/5956 "2023-05-19T13:45:45Z")

</div>

Hi, I would like to know what is wrong with this function: I get : thanks Segment\_Bone(typename TImage::Pointer input, typename TImage::Pointer output,double bone\_threshold\_factor\_percentage) | ^~~~~~~~~~~~ …

---

## [Registration about CT and CBCT](https://discourse.itk.org/t/registration-about-ct-and-cbct/5954)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 6\
**Last updated:** [May 19, 2023, 1:03pm UTC](https://discourse.itk.org/t/registration-about-ct-and-cbct/5954 "2023-05-19T13:03:23Z")

</div>

I have a set of CT images and CTCB images that need to be registered now, but they are not in the same physical space. How can I perform the conversion correctly? I know that CBCT has isocenter points, but CT does not. H…

---

## [DICOM segmentation storage](https://discourse.itk.org/t/dicom-segmentation-storage/538)

<div class="topic-metadata">

**Author:** [@Hrabalski](https://discourse.itk.org/u/Hrabalski)\
**Replies:** 16\
**Last updated:** [May 17, 2023, 1:27pm UTC](https://discourse.itk.org/t/dicom-segmentation-storage/538 "2023-05-17T13:27:06Z")

</div>

Hello, I am investigating possibility and of saving segmentations in correct format. So far I have encountered 3 options: Segmentation storage SOP class (ftp://medical.nema.org/medical/dicom/final/sup111\_ft.pdf) Segme…

---

## [Mattes Mutual Information: SimpleITK and MATLAB yield different results on rotated images](https://discourse.itk.org/t/mattes-mutual-information-simpleitk-and-matlab-yield-different-results-on-rotated-images/5948)

<div class="topic-metadata">

**Author:** [@zihangff](https://discourse.itk.org/u/zihangff)\
**Replies:** 2\
**Last updated:** [May 17, 2023, 12:11am UTC](https://discourse.itk.org/t/mattes-mutual-information-simpleitk-and-matlab-yield-different-results-on-rotated-images/5948 "2023-05-17T00:11:26Z")

</div>

Dear all, Before I get to the question this is the background: I have a registration pipeline that runs Mattes Mutual Information registration (with OnePlusOneEvolutionary as optimizer) using MATLAB and I would like to …

---

## [Concept checking in MultiResolutionPyramidImageFilter](https://discourse.itk.org/t/concept-checking-in-multiresolutionpyramidimagefilter/5929)

<div class="topic-metadata">

**Author:** [@ericrhenry](https://discourse.itk.org/u/ericrhenry)\
**Replies:** 9\
**Last updated:** [May 11, 2023, 2:44am UTC](https://discourse.itk.org/t/concept-checking-in-multiresolutionpyramidimagefilter/5929 "2023-05-11T02:44:38Z")

</div>

I am attempting to use this filter in a registration implementation requiring moving/fixed image pixels which have a vector PixelType (e.g. Itk::Vector\<double,3\>). My first assumption is that this filter should work with…

---

## [Optimizer's stopping condition is rounding error. Registration framework](https://discourse.itk.org/t/optimizers-stopping-condition-is-rounding-error-registration-framework/4603)

<div class="topic-metadata">

**Author:** [@Luciano\_Rivetti](https://discourse.itk.org/u/Luciano_Rivetti)\
**Replies:** 4\
**Last updated:** [May 3, 2023, 8:19pm UTC](https://discourse.itk.org/t/optimizers-stopping-condition-is-rounding-error-registration-framework/4603 "2023-05-03T20:19:11Z")

</div>

Hi everyone, I’m doing B-Spline registration of CT vs CBCT images. The Registration method Im using is: registration\_method = sitk.ImageRegistrationMethod() grid\_physical\_spacing = \[15.0\]\*3 image\_physical\_size …

---

## [Diffeomorphic demons registration algorithms work with vector image types?](https://discourse.itk.org/t/diffeomorphic-demons-registration-algorithms-work-with-vector-image-types/5920)

<div class="topic-metadata">

**Author:** [@ericrhenry](https://discourse.itk.org/u/ericrhenry)\
**Replies:** 0\
**Last updated:** [May 2, 2023, 7:36pm UTC](https://discourse.itk.org/t/diffeomorphic-demons-registration-algorithms-work-with-vector-image-types/5920 "2023-05-02T19:36:14Z")

</div>

I might be able to figure this out by plumbing the internals, or maybe trying to template a filter using a vector image, but I just wanted to see if anybody has the answer “at the ready”. In principle, registration by op…

---

## [Output MRI images have value 0 (almost) everywhere after resampling using SimpleITK](https://discourse.itk.org/t/output-mri-images-have-value-0-almost-everywhere-after-resampling-using-simpleitk/5912)

<div class="topic-metadata">

**Author:** [@bluefire](https://discourse.itk.org/u/bluefire)\
**Replies:** 2\
**Last updated:** [May 2, 2023, 7:40am UTC](https://discourse.itk.org/t/output-mri-images-have-value-0-almost-everywhere-after-resampling-using-simpleitk/5912 "2023-05-02T07:40:28Z")

</div>

Hey! I have 3-dimensional NIfTI MRI images that I would like to resample to uniform voxel size (1, 1, 1). This works fine: img = sitk.ReadImage(img\_path) output\_spacing = \[1.0, 1.0, 1.0\] input\_spacing = img.GetSpacin…

---

## [Explanation of principal axis and principal moments](https://discourse.itk.org/t/explanation-of-principal-axis-and-principal-moments/5882)

<div class="topic-metadata">

**Author:** [@marabuuu](https://discourse.itk.org/u/marabuuu)\
**Replies:** 4\
**Last updated:** [April 25, 2023, 4:57pm UTC](https://discourse.itk.org/t/explanation-of-principal-axis-and-principal-moments/5882 "2023-04-25T16:57:23Z")

</div>

Dear all, I am writing a blog post for biologists about different measurements including the ones provided by simpleITK and have problems to understand the measurements for principal axis and principal moments. I know t…

---

## [Refactor code in a function](https://discourse.itk.org/t/refactor-code-in-a-function/5887)

<div class="topic-metadata">

**Author:** [@cristinamontserrat](https://discourse.itk.org/u/cristinamontserrat)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 1:06pm UTC](https://discourse.itk.org/t/refactor-code-in-a-function/5887 "2023-04-24T13:06:47Z")

</div>

Hi, I’m trying to refactor some code in a function. The function is: ITKImgLabelType2D::Pointer GetLabelImageFilter(const ITKImgLabelType2D::Pointer& labelMap) { using LabelMapToLabelImageFilterType = itk::LabelMapToL…

---

## [FFTNormalizedCrossCorrelation: Edges and Filtering](https://discourse.itk.org/t/fftnormalizedcrosscorrelation-edges-and-filtering/5879)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 2\
**Last updated:** [April 20, 2023, 1:16pm UTC](https://discourse.itk.org/t/fftnormalizedcrosscorrelation-edges-and-filtering/5879 "2023-04-20T13:16:15Z")

</div>

I know that in most FFT based work, users often need to apply some sort of filter (often butterworth) to fade the edges of the image since FFT assumes infinite space. how does SimpleITK FFTNormalizedCrossCorrelation fun…

---

## [Parametric Curve Fitting](https://discourse.itk.org/t/parametric-curve-fitting/5585)

<div class="topic-metadata">

**Author:** [@Oddone-Scatena](https://discourse.itk.org/u/Oddone-Scatena)\
**Replies:** 3\
**Last updated:** [April 11, 2023, 12:12pm UTC](https://discourse.itk.org/t/parametric-curve-fitting/5585 "2023-04-11T12:12:59Z")

</div>

Hello, I must fit a parametric surface, or a curve, in the points of my image data. I was wondering how is the best way to do that? I need the parameters of the fitted curve. Thank you

---

## [MaskedFFTCrossCorrelation: Output is stuck at center](https://discourse.itk.org/t/maskedfftcrosscorrelation-output-is-stuck-at-center/5838)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 3\
**Last updated:** [March 30, 2023, 6:16pm UTC](https://discourse.itk.org/t/maskedfftcrosscorrelation-output-is-stuck-at-center/5838 "2023-03-30T18:16:18Z")

</div>

Hello, I have been working with the MaskedFFTCrossCorrelation() function and it has been great. However, I am now a bit confused by the output that I am getting. The following images are what I have being input into th…

---

## [FFT Correlation: Normalized Sum of Square Difference](https://discourse.itk.org/t/fft-correlation-normalized-sum-of-square-difference/5827)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 1\
**Last updated:** [March 24, 2023, 4:06pm UTC](https://discourse.itk.org/t/fft-correlation-normalized-sum-of-square-difference/5827 "2023-03-24T16:06:45Z")

</div>

Hello, I am wondering if it would be possible to extend the FFTNormalizedCrossCorrelation function to use Normalized Sum of Square Differences instead of Cross Correlation metric? Thank you!

---

## [Extract bone structures](https://discourse.itk.org/t/extract-bone-structures/5826)

<div class="topic-metadata">

**Author:** [@suzume](https://discourse.itk.org/u/suzume)\
**Replies:** 0\
**Last updated:** [March 23, 2023, 2:28pm UTC](https://discourse.itk.org/t/extract-bone-structures/5826 "2023-03-23T14:28:11Z")

</div>

Hi, I want to know is there some method in itk to enhance the bone structures in EPID image? Or is there some method in itk to extract bone structure in EPID image?

---

## [Resampling Image: Finding original point in new resampled Image](https://discourse.itk.org/t/resampling-image-finding-original-point-in-new-resampled-image/5818)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 1\
**Last updated:** [March 22, 2023, 1:04pm UTC](https://discourse.itk.org/t/resampling-image-finding-original-point-in-new-resampled-image/5818 "2023-03-22T13:04:51Z")

</div>

I have a smaller image that is (512x512). I resampled it to a new space (692x512) and am now wondering how I can determine of a point in the smaller image, for example: location 25,25, in the larger image. I tried using…

---

## [How to fix the problem of "Too many samples map outside moving image buffer"](https://discourse.itk.org/t/how-to-fix-the-problem-of-too-many-samples-map-outside-moving-image-buffer/850)

<div class="topic-metadata">

**Author:** [@Jounly](https://discourse.itk.org/u/Jounly)\
**Replies:** 1\
**Last updated:** [March 21, 2023, 3:41am UTC](https://discourse.itk.org/t/how-to-fix-the-problem-of-too-many-samples-map-outside-moving-image-buffer/850 "2023-03-21T03:41:47Z")

</div>

Hi, I am using MattesMutualInformationImageToImageMetricv4 as the metric in the registration frame. However, it always fails and throws the exception of “Too many samples map outside moving image buffer. There are only …

---

## [Passing mask argument in N4BiasFieldCorrection()](https://discourse.itk.org/t/passing-mask-argument-in-n4biasfieldcorrection/5793)

<div class="topic-metadata">

**Author:** [@Thomas\_Jeong](https://discourse.itk.org/u/Thomas_Jeong)\
**Replies:** 3\
**Last updated:** [March 19, 2023, 11:19pm UTC](https://discourse.itk.org/t/passing-mask-argument-in-n4biasfieldcorrection/5793 "2023-03-19T23:19:09Z")

</div>

Hello all, Trying to use the N4BiasFieldCorrection() method to fix the intensity inhomogeneity in Dixon MRI scans. I have used the function with success just passing the image as the only argument, such as below: sitk.…

---

## [Neglecting Edge Errors in FFT Cross Correlation Results](https://discourse.itk.org/t/neglecting-edge-errors-in-fft-cross-correlation-results/5810)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 2\
**Last updated:** [March 17, 2023, 6:54pm UTC](https://discourse.itk.org/t/neglecting-edge-errors-in-fft-cross-correlation-results/5810 "2023-03-17T18:54:46Z")

</div>

I have been using the sitk FFTNormalizedCrossCorrelation function to match the smaller image to its “best” location in the larger image. My results at the moment are indicating that the best match is at the edge (shown …

---

## [Reading .tif images: vector of 8-bit unsigned in vs. 8-bit unsigned int](https://discourse.itk.org/t/reading-tif-images-vector-of-8-bit-unsigned-in-vs-8-bit-unsigned-int/5809)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 4\
**Last updated:** [March 17, 2023, 5:03pm UTC](https://discourse.itk.org/t/reading-tif-images-vector-of-8-bit-unsigned-in-vs-8-bit-unsigned-int/5809 "2023-03-17T17:03:23Z")

</div>

I have come across this issue, where some .tif files that I read into SimpleITK load as “8-but unsigned int”, but others load as “vector of 8-bit unsigned int”. I have been reading in the .tif images using sitk.ReadImag…

---

## [Inconsistent Mattes Mutual Information metric Value.](https://discourse.itk.org/t/inconsistent-mattes-mutual-information-metric-value/5777)

<div class="topic-metadata">

**Author:** [@gaurav\_patel](https://discourse.itk.org/u/gaurav_patel)\
**Replies:** 8\
**Last updated:** [March 14, 2023, 12:33pm UTC](https://discourse.itk.org/t/inconsistent-mattes-mutual-information-metric-value/5777 "2023-03-14T12:33:27Z")

</div>

I am trying to register MRI- CT volumes from " Report of the AAPM Radiation Therapy Committee Task Group No. 132" (dataset). The dataset has CT, MR and PET volumes of geometric and anatomical phantoms. The offsets along …

---

## [Template Matching in SimpleITK](https://discourse.itk.org/t/template-matching-in-simpleitk/5735)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 10\
**Last updated:** [March 8, 2023, 4:35pm UTC](https://discourse.itk.org/t/template-matching-in-simpleitk/5735 "2023-03-08T16:35:45Z")

</div>

I have used template matching in previous code, and was wondering if template matching is available in SimpleITK? Or if there are specific functions that will achieve the same outcome? Thank you!

---

## [Rotation error](https://discourse.itk.org/t/rotation-error/5783)

<div class="topic-metadata">

**Author:** [@suzume](https://discourse.itk.org/u/suzume)\
**Replies:** 1\
**Last updated:** [March 6, 2023, 2:04pm UTC](https://discourse.itk.org/t/rotation-error/5783 "2023-03-06T14:04:08Z")

</div>

Hi, I want to rotate a point in two steps with two different rotation centers. Here is my code: typedef itk::Euler3DTransform\< double \> TransformType; TransformType::Pointer composetrans = TransformType::New(); Transfo…

---

## [Getting Displacement Data for specific points](https://discourse.itk.org/t/getting-displacement-data-for-specific-points/5753)

<div class="topic-metadata">

**Author:** [@elapins](https://discourse.itk.org/u/elapins)\
**Replies:** 11\
**Last updated:** [March 1, 2023, 5:17pm UTC](https://discourse.itk.org/t/getting-displacement-data-for-specific-points/5753 "2023-03-01T17:17:23Z")

</div>

I successfully applied the following type of registration, and would like to query specific points within the image and get the corresponding displacement for each point in the image. I have a composite outTx and can’t …

---

## [On the coordinate transformation of vtk and itk](https://discourse.itk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/5761)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 4\
**Last updated:** [February 28, 2023, 2:39pm UTC](https://discourse.itk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/5761 "2023-02-28T14:39:10Z")

</div>

The program I wrote uses itk image to read dicom image, and uses vtk to display it. What transformation should I make to make vtk display correctly? I know to use 0020 0037 tag to correct it. Can anyone tell me the detai…

---

## [Displacement field transform in 3D](https://discourse.itk.org/t/displacement-field-transform-in-3d/5759)

<div class="topic-metadata">

**Author:** [@mokshagna\_sai\_teja](https://discourse.itk.org/u/mokshagna_sai_teja)\
**Replies:** 6\
**Last updated:** [February 28, 2023, 1:10am UTC](https://discourse.itk.org/t/displacement-field-transform-in-3d/5759 "2023-02-28T01:10:05Z")

</div>

temp is a forward 3D displacement field of size DxMxNx3. displacement\_image = sitk.GetImageFromArray(np.double(temp),sitk.sitkVectorFloat64) tx = sitk.DisplacementFieldTransform(displacement\_image) tx.SetInterpolator(…

---

## [Operator to flatten masks based on an intensity value](https://discourse.itk.org/t/operator-to-flatten-masks-based-on-an-intensity-value/5766)

<div class="topic-metadata">

**Author:** [@Besler](https://discourse.itk.org/u/Besler)\
**Replies:** 2\
**Last updated:** [February 27, 2023, 4:53pm UTC](https://discourse.itk.org/t/operator-to-flatten-masks-based-on-an-intensity-value/5766 "2023-02-27T16:53:11Z")

</div>

I find myself in need of a filter that takes a set of binary masks-real valued image pairs and returns a single mask where the value is the mask index with the largest real value. I use this constantly for flattening log…

[Previous page](https://discourse.itk.org/c/algorithms/7.md?no_subcategories=false&page=3)

[Next page](https://discourse.itk.org/c/algorithms/7.md?no_subcategories=false&page=5)
