# Algorithms

**URL:** https://discourse.itk.org/c/algorithms/7.md

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

---

## [About the Algorithms category](https://discourse.itk.org/t/about-the-algorithms-category/20)

<div class="topic-metadata">

**Author:** [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Replies:** 0

</div>

Image processing theory, algorithm selection, parameter tuning, imaging modalities, etc.

---

## [Writing large multiframe DICOM files via GDCM in ITK](https://discourse.itk.org/t/writing-large-multiframe-dicom-files-via-gdcm-in-itk/7426)

<div class="topic-metadata">

**Author:** [@darrent1974](https://discourse.itk.org/u/darrent1974)\
**Replies:** 8\
**Last updated:** [September 4, 2026, 3:30am UTC](https://discourse.itk.org/t/writing-large-multiframe-dicom-files-via-gdcm-in-itk/7426 "2026-09-04T03:30:30Z")

</div>

Hi, I was hoping to use GDCMImageIO to write large to very large image volumes (~10 -1000GB) as single file, mutiframe DICOM files. I specifically want to avoid writing these images as a set of individual 2D slice files…

---

## [pixel positions in every slice is not uniform](https://discourse.itk.org/t/pixel-positions-in-every-slice-is-not-uniform/7746)

<div class="topic-metadata">

**Author:** [@jsemeda](https://discourse.itk.org/u/jsemeda)\
**Replies:** 1\
**Last updated:** [April 8, 2026, 12:58pm UTC](https://discourse.itk.org/t/pixel-positions-in-every-slice-is-not-uniform/7746 "2026-04-08T12:58:55Z")

</div>

I am getting the 3d position of the pixels in every slice. I use the “TransformIndexToPhysicalPoint” to get the 3d position of pixels. I looked at the corner pixel in every slice, index (0, 0, 0), and the results are not…

---

## [N4 bias field correction of 4D images](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710)

<div class="topic-metadata">

**Author:** [@nolog](https://discourse.itk.org/u/nolog)\
**Replies:** 10\
**Last updated:** [February 12, 2026, 8:52pm UTC](https://discourse.itk.org/t/n4-bias-field-correction-of-4d-images/7710 "2026-02-12T20:52:41Z")

</div>

Hello everyone, I am trying to perform a bias field correction on a 4D echo series that is used for quantitative MRI. There is significant B0 inhomogeneity which, on a single echo basis, I am able to correct for via the…

---

## [Sobel operator extended for 4D, legacy support for 3D, OK?](https://discourse.itk.org/t/sobel-operator-extended-for-4d-legacy-support-for-3d-ok/7699)

<div class="topic-metadata">

**Author:** [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)\
**Replies:** 4\
**Last updated:** [February 4, 2026, 2:24pm UTC](https://discourse.itk.org/t/sobel-operator-extended-for-4d-legacy-support-for-3d-ok/7699 "2026-02-04T14:24:03Z")

</div>

Please have a look at my pull request, which aims to improve our SobelOperator, and add ND support (including 4D): I think it is ready, but there are a few things to consider: The proposed new implementation of Sob…

---

## [Registration fails if the moving image is translated](https://discourse.itk.org/t/registration-fails-if-the-moving-image-is-translated/7701)

<div class="topic-metadata">

**Author:** [@Vasily\_Postnicov](https://discourse.itk.org/u/Vasily_Postnicov)\
**Replies:** 2\
**Last updated:** [February 3, 2026, 3:43am UTC](https://discourse.itk.org/t/registration-fails-if-the-moving-image-is-translated/7701 "2026-02-03T03:43:09Z")

</div>

Hi! I am trying to do different kinds of image registration with ITK (not simpleitk). I attach the code I use (it’s from one of the examples with small modifications). itk.cpp (6.1 KB) I use the Euler3DTransform model …

---

## [LBFGS/LBFGSB optimizerv4 crash in Multi-threaded application](https://discourse.itk.org/t/lbfgs-lbfgsb-optimizerv4-crash-in-multi-threaded-application/7695)

<div class="topic-metadata">

**Author:** [@Liming\_Zhou](https://discourse.itk.org/u/Liming_Zhou)\
**Replies:** 2\
**Last updated:** [January 9, 2026, 2:19am UTC](https://discourse.itk.org/t/lbfgs-lbfgsb-optimizerv4-crash-in-multi-threaded-application/7695 "2026-01-09T02:19:10Z")

</div>

This optimizer is not threading safe, so when I run two(or more) threads simultaneously containing this optimizer, the results are irreproducible, and may even crash at different breakpoints. When I switch to other kind…

---

## [X-ray image file of TIFF format proces](https://discourse.itk.org/t/x-ray-image-file-of-tiff-format-proces/7693)

<div class="topic-metadata">

**Author:** [@wulicheng](https://discourse.itk.org/u/wulicheng)\
**Replies:** 0\
**Last updated:** [January 6, 2026, 6:08am UTC](https://discourse.itk.org/t/x-ray-image-file-of-tiff-format-proces/7693 "2026-01-06T06:08:25Z")

</div>

I have a large x-ray file of TIFF in the link. I want to process it more clarity. Expecially the link line in the image . I have do something. But it is not enough。 Will you give me some sugesstions. Thinks! This is the…

---

## [QVTKNativeWidget: Jagged edges on 2D images](https://discourse.itk.org/t/qvtknativewidget-jagged-edges-on-2d-images/7682)

<div class="topic-metadata">

**Author:** [@Manjunath\_AV](https://discourse.itk.org/u/Manjunath_AV)\
**Replies:** 1\
**Last updated:** [December 17, 2025, 5:53pm UTC](https://discourse.itk.org/t/qvtknativewidget-jagged-edges-on-2d-images/7682 "2025-12-17T17:53:00Z")

</div>

Hi all, I’m displaying 2D images using QVTKNativeWidget and I’m seeing zigzag/jagged edges along high-contrast boundaries. I’ve attached two screenshots: Current issue: edges look stair-stepped/pixelate image670×2…

---

## [Running optimizer in parallel](https://discourse.itk.org/t/running-optimizer-in-parallel/1421)

<div class="topic-metadata">

**Author:** [@Gordian](https://discourse.itk.org/u/Gordian)\
**Replies:** 6\
**Last updated:** [December 3, 2025, 8:42pm UTC](https://discourse.itk.org/t/running-optimizer-in-parallel/1421 "2025-12-03T20:42:34Z")

</div>

Hello, i have a question regarding parallel optimization. The actual setup is more cpmplex. Therefore I try to simplify. I have a reference image and multiple other images. I want to register the other images onto the …

---

## [Conversion of ITK BSpline to knot-vector representation of splinepy](https://discourse.itk.org/t/conversion-of-itk-bspline-to-knot-vector-representation-of-splinepy/7643)

<div class="topic-metadata">

**Author:** [@reox](https://discourse.itk.org/u/reox)\
**Replies:** 12\
**Last updated:** [October 9, 2025, 4:17pm UTC](https://discourse.itk.org/t/conversion-of-itk-bspline-to-knot-vector-representation-of-splinepy/7643 "2025-10-09T16:17:45Z")

</div>

Colleagues of mine use a spline library called splinepy. It has some nice features, I wanted to try out, using some ITK BSplineTransforms I have obtained from image registration. However, I wasn’t able to convert them in…

---

## [volume regularization using ITK](https://discourse.itk.org/t/volume-regularization-using-itk/7594)

<div class="topic-metadata">

**Author:** [@Eva\_Monclus\_Lahoya](https://discourse.itk.org/u/Eva_Monclus_Lahoya)\
**Replies:** 4\
**Last updated:** [September 19, 2025, 8:29pm UTC](https://discourse.itk.org/t/volume-regularization-using-itk/7594 "2025-09-19T20:29:29Z")

</div>

Hello, I’m working on a Python application that uses ITK, and I’m looking for guidance on how to regularize or resample a 3D volume when the slice spacing is not uniform—i.e., the distance between slices varies througho…

---

## [Would like to develop a method to identify cranial openings in surface model via ITK-Snap... must I synthesize a Dicom/Analyze image?](https://discourse.itk.org/t/would-like-to-develop-a-method-to-identify-cranial-openings-in-surface-model-via-itk-snap-must-i-synthesize-a-dicom-analyze-image/7631)

<div class="topic-metadata">

**Author:** [@MichelODU](https://discourse.itk.org/u/MichelODU)\
**Replies:** 4\
**Last updated:** [September 16, 2025, 3:20pm UTC](https://discourse.itk.org/t/would-like-to-develop-a-method-to-identify-cranial-openings-in-surface-model-via-itk-snap-must-i-synthesize-a-dicom-analyze-image/7631 "2025-09-16T15:20:34Z")

</div>

Dear ITK users, I would like to develop a method to identify cranial openings in surface model via ITK-Snap… must I synthesize a Dicom/Analyze image via ITK first? Is there a way to do this in a manner that precisely sp…

---

## [MeanErrorNorm and MaxErrorNorm in InvertDisplacementFieldImageFilter](https://discourse.itk.org/t/meanerrornorm-and-maxerrornorm-in-invertdisplacementfieldimagefilter/7492)

<div class="topic-metadata">

**Author:** [@reox](https://discourse.itk.org/u/reox)\
**Replies:** 15\
**Last updated:** [August 18, 2025, 4:31pm UTC](https://discourse.itk.org/t/meanerrornorm-and-maxerrornorm-in-invertdisplacementfieldimagefilter/7492 "2025-08-18T16:31:06Z")

</div>

I recently started a project where I would need to invert a BSplineTransformation. I dug now a bit into the different algorithms that ITK provides and had a look at the code. For the InvertDisplacementFieldImageFilter I …

---

## [Faster interpolation using sitkLabelGaussian](https://discourse.itk.org/t/faster-interpolation-using-sitklabelgaussian/6183)

<div class="topic-metadata">

**Author:** [@dyoll](https://discourse.itk.org/u/dyoll)\
**Replies:** 11\
**Last updated:** [August 1, 2025, 10:13pm UTC](https://discourse.itk.org/t/faster-interpolation-using-sitklabelgaussian/6183 "2025-08-01T22:13:22Z")

</div>

Hi I am working on a MONAI-based whole head segmentation tool, which predicts close to 30 tissue labels. Currently all post-processing is implemented in Python using SimpleITK. Once we have done some clean-up operation…

---

## [The effect of mutual information rigid registration is extremely poor.](https://discourse.itk.org/t/the-effect-of-mutual-information-rigid-registration-is-extremely-poor/7600)

<div class="topic-metadata">

**Author:** [@wen](https://discourse.itk.org/u/wen)\
**Replies:** 1\
**Last updated:** [July 23, 2025, 8:03am UTC](https://discourse.itk.org/t/the-effect-of-mutual-information-rigid-registration-is-extremely-poor/7600 "2025-07-23T08:03:52Z")

</div>

Using the Mattes Mutual Information Image-to-Image Metric v4 as the similarity measurement for three-dimensional rigid registration, their initial gradient is not equal to zero and the registration results of two comple…

---

## [Multi-resolution registration anomaly](https://discourse.itk.org/t/multi-resolution-registration-anomaly/7591)

<div class="topic-metadata">

**Author:** [@wen](https://discourse.itk.org/u/wen)\
**Replies:** 2\
**Last updated:** [July 23, 2025, 7:18am UTC](https://discourse.itk.org/t/multi-resolution-registration-anomaly/7591 "2025-07-23T07:18:18Z")

</div>

When utilizing the ImageRegistrationMethodv4 for multi-resolution registration, I encountered the following unusual behavior: In cases where the initial positions of the images to be registered were significantly misal…

---

## [Edge cases of DICOMOrient](https://discourse.itk.org/t/edge-cases-of-dicomorient/7559)

<div class="topic-metadata">

**Author:** [@ahulist](https://discourse.itk.org/u/ahulist)\
**Replies:** 2\
**Last updated:** [June 5, 2025, 11:22pm UTC](https://discourse.itk.org/t/edge-cases-of-dicomorient/7559 "2025-06-05T23:22:39Z")

</div>

I’m using SimpleITK’s DICOMOrient to reorient a stack of DICOM slices. When I read files as a simple list (instead of using ImageSeriesReader), SITK only uses the first slice’s Origin/Spacing and infers the rest on the f…

---

## [Jacobian coordinate system in itkDisplacementFieldTransform vs itkDisplacementFieldJacobianDeterminantFilter](https://discourse.itk.org/t/jacobian-coordinate-system-in-itkdisplacementfieldtransform-vs-itkdisplacementfieldjacobiandeterminantfilter/7522)

<div class="topic-metadata">

**Author:** [@cookpa](https://discourse.itk.org/u/cookpa)\
**Replies:** 3\
**Last updated:** [May 21, 2025, 6:56pm UTC](https://discourse.itk.org/t/jacobian-coordinate-system-in-itkdisplacementfieldtransform-vs-itkdisplacementfieldjacobiandeterminantfilter/7522 "2025-05-21T18:56:30Z")

</div>

I’ve been working on fixing problems in ANTs tensor / vector coordinates lately, which has led me to look at the local Jacobian calculations. I am trying to better understand how the coordinate system of Jacobians work i…

---

## [Get Jacobian wrt to Position for BSplineTransform](https://discourse.itk.org/t/get-jacobian-wrt-to-position-for-bsplinetransform/7504)

<div class="topic-metadata">

**Author:** [@reox](https://discourse.itk.org/u/reox)\
**Replies:** 7\
**Last updated:** [May 10, 2025, 12:53am UTC](https://discourse.itk.org/t/get-jacobian-wrt-to-position-for-bsplinetransform/7504 "2025-05-10T00:53:08Z")

</div>

As far as I can tell, the function ComputeJacobianWithRespectToPosition is not implemented for BSplineTransform (as it is for DisplacementFieldTransform) but only ComputeJacobianWithRespectToParameters, for example using…

---

## [Reading in vector volume from NRRD with variable scalar component count](https://discourse.itk.org/t/reading-in-vector-volume-from-nrrd-with-variable-scalar-component-count/7485)

<div class="topic-metadata">

**Author:** [@cpinter](https://discourse.itk.org/u/cpinter)\
**Replies:** 12\
**Last updated:** [April 24, 2025, 12:45pm UTC](https://discourse.itk.org/t/reading-in-vector-volume-from-nrrd-with-variable-scalar-component-count/7485 "2025-04-24T12:45:35Z")

</div>

Hi all, I’d like to read an NRRD volume that looks like this: type: int dimension: 4 space: right-anterior-superior sizes: 26 102 102 61 kinds: list domain domain domain I have this code that is supposed to do the re…

---

## [RTK ProjectionsReader Blank Images](https://discourse.itk.org/t/rtk-projectionsreader-blank-images/7501)

<div class="topic-metadata">

**Author:** [@OwenM](https://discourse.itk.org/u/OwenM)\
**Replies:** 3\
**Last updated:** [April 23, 2025, 10:56pm UTC](https://discourse.itk.org/t/rtk-projectionsreader-blank-images/7501 "2025-04-23T22:56:13Z")

</div>

Hello, Thanks in advance for any help with this issue. I have been trying to reconstruct a series of 2D CBCT projections stored in TIFFs using RTK FDK. I started with the Python first reconstruction example and got it …

---

## [Why Are There Negative Voxel Values in My RTKFDK X-ray Reconstruction?](https://discourse.itk.org/t/why-are-there-negative-voxel-values-in-my-rtkfdk-x-ray-reconstruction/7498)

<div class="topic-metadata">

**Author:** [@zhangxiang](https://discourse.itk.org/u/zhangxiang)\
**Replies:** 8\
**Last updated:** [April 22, 2025, 7:45am UTC](https://discourse.itk.org/t/why-are-there-negative-voxel-values-in-my-rtkfdk-x-ray-reconstruction/7498 "2025-04-22T07:45:47Z")

</div>

I’m working on 3D reconstruction using cone-beam X-ray projection images with the FDK algorithm in RTK (Reconstruction Toolkit). After reconstruction, I noticed that some voxel values in the output volume are negati…

---

## [SetOptimizerWeights in parameter file in SimpleElastix](https://discourse.itk.org/t/setoptimizerweights-in-parameter-file-in-simpleelastix/7488)

<div class="topic-metadata">

**Author:** [@Brynolf](https://discourse.itk.org/u/Brynolf)\
**Replies:** 0\
**Last updated:** [April 1, 2025, 9:37am UTC](https://discourse.itk.org/t/setoptimizerweights-in-parameter-file-in-simpleelastix/7488 "2025-04-01T09:37:53Z")

</div>

Hello! I would like to restrict the registration to some dimensions, and found that you can use SetOptimizerWeights() in python. How can I define this if I setup my registration using a parameter file? I would like to r…

---

## [Unexpected Behaviour in MultiStartOptimizerv4](https://discourse.itk.org/t/unexpected-behaviour-in-multistartoptimizerv4/7466)

<div class="topic-metadata">

**Author:** [@spinicist](https://discourse.itk.org/u/spinicist)\
**Replies:** 15\
**Last updated:** [March 18, 2025, 7:12pm UTC](https://discourse.itk.org/t/unexpected-behaviour-in-multistartoptimizerv4/7466 "2025-03-18T19:12:57Z")

</div>

Hello, I’m trying to use the MultiStartOptimizerv4. My current code is here: riesling/cxx/riesling/merlin.cpp at merlin2 · spinicist/riesling · GitHub, apologies it is a little messy at the moment. The results of the lo…

---

## [Coregistration of two rectangles using SimpleITK](https://discourse.itk.org/t/coregistration-of-two-rectangles-using-simpleitk/7449)

<div class="topic-metadata">

**Author:** [@Andre](https://discourse.itk.org/u/Andre)\
**Replies:** 9\
**Last updated:** [March 10, 2025, 12:57pm UTC](https://discourse.itk.org/t/coregistration-of-two-rectangles-using-simpleitk/7449 "2025-03-10T12:57:27Z")

</div>

Hello, I am trying to co-register two very simple 2D png images of rectangles (white rectangle value 256 on black (0 value) background), but struggling with getting them aligned no matter what metric, optimizer or param…

---

## [Truncation artifact recovery](https://discourse.itk.org/t/truncation-artifact-recovery/7435)

<div class="topic-metadata">

**Author:** [@langzhizhen](https://discourse.itk.org/u/langzhizhen)\
**Replies:** 1\
**Last updated:** [February 22, 2025, 8:33am UTC](https://discourse.itk.org/t/truncation-artifact-recovery/7435 "2025-02-22T08:33:38Z")

</div>

Recently, I was using FDK algorithm for CBCT, but when I used FOV, there were some truncation artifacts at the beginning and end of reconstruction results, which may be caused by insufficient data collection. Then, is th…

---

## [parameter tuning](https://discourse.itk.org/t/parameter-tuning/7442)

<div class="topic-metadata">

**Author:** [@zhangxiang](https://discourse.itk.org/u/zhangxiang)\
**Replies:** 3\
**Last updated:** [February 21, 2025, 12:45am UTC](https://discourse.itk.org/t/parameter-tuning/7442 "2025-02-21T00:45:04Z")

</div>

How can I choose the appropriate parameters of filters, such as Hann hannY multiplier radius. When I run rtkfdk.exe with these parameter input, my CPU go to 100％, I have to close cuda acceleration. subs…

---

## [about the RTK circular projection geometric calibration](https://discourse.itk.org/t/about-the-rtk-circular-projection-geometric-calibration/7195)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 13\
**Last updated:** [February 19, 2025, 5:23am UTC](https://discourse.itk.org/t/about-the-rtk-circular-projection-geometric-calibration/7195 "2025-02-19T05:23:37Z")

</div>

I have a set of images of a phantom with steel balls, and I have extracted the coordinates of the steel balls. In total, there are 845 images, and I have tracked the coordinates of each steel ball. Currently, the known q…

---

## [TensorFractionalAnisotropyImageFilter calculate FA bigger than 1](https://discourse.itk.org/t/tensorfractionalanisotropyimagefilter-calculate-fa-bigger-than-1/7432)

<div class="topic-metadata">

**Author:** [@Pinyu\_Huang](https://discourse.itk.org/u/Pinyu_Huang)\
**Replies:** 4\
**Last updated:** [February 18, 2025, 1:42am UTC](https://discourse.itk.org/t/tensorfractionalanisotropyimagefilter-calculate-fa-bigger-than-1/7432 "2025-02-18T01:42:21Z")

</div>

I use TensorFractionalAnisotropyImageFilter to calculate FA for the DTI image. The code is: using Image3DType = itk::Image\<float, 3\> using FAFilterType = itk::TensorFractionalAnisotropyImageFilter\<TensorReconstructionFi…

[Next page](https://discourse.itk.org/c/algorithms/7.md?page=1)
