# Algorithms

**URL:** https://discourse.itk.org/c/algorithms/7.md?page=1

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

**Page:** 2

---

## [Z spacing when saving dicom](https://discourse.itk.org/t/z-spacing-when-saving-dicom/7434)

<div class="topic-metadata">

**Author:** [@ilan](https://discourse.itk.org/u/ilan)\
**Replies:** 1\
**Last updated:** [February 14, 2025, 1:27pm UTC](https://discourse.itk.org/t/z-spacing-when-saving-dicom/7434 "2025-02-14T13:27:06Z")

</div>

Hi, I have image with -let’s say 88 frames. The spacing between frames is changing. It may be 0, 0.04, 0.02 etc. I know to save it correctly with pydicom in python code of course. I need help when savings it with itk. Ho…

---

## [ElastixImageFilter() vs ImageRegistrationMethod()](https://discourse.itk.org/t/elastiximagefilter-vs-imageregistrationmethod/7416)

<div class="topic-metadata">

**Author:** [@Weng\_Yann\_Seow](https://discourse.itk.org/u/Weng_Yann_Seow)\
**Replies:** 3\
**Last updated:** [February 10, 2025, 2:36pm UTC](https://discourse.itk.org/t/elastiximagefilter-vs-imageregistrationmethod/7416 "2025-02-10T14:36:24Z")

</div>

I would like to replace deprecated ElastixImageFilter method with the ImageRegistrationMethod method for registration. I am expecting both of these method can derive a similar resampled images, but in fact, ElastixImageF…

---

## [ConnectedComponentImageFilter vs HardConnectedComponentImageFilter](https://discourse.itk.org/t/connectedcomponentimagefilter-vs-hardconnectedcomponentimagefilter/7379)

<div class="topic-metadata">

**Author:** [@SteveRobbins](https://discourse.itk.org/u/SteveRobbins)\
**Replies:** 2\
**Last updated:** [January 17, 2025, 11:52pm UTC](https://discourse.itk.org/t/connectedcomponentimagefilter-vs-hardconnectedcomponentimagefilter/7379 "2025-01-17T23:52:31Z")

</div>

I’ve got a binary image (a thresholded head MR) for which I want to obtain the connected components. I see there are two filters that look plausible: ITK: itk::ConnectedComponentImageFilter\< TInputImage, TOutputImage,…

---

## [Issue with Importing DICOM Files in Slicer](https://discourse.itk.org/t/issue-with-importing-dicom-files-in-slicer/7345)

<div class="topic-metadata">

**Author:** [@rcabeza](https://discourse.itk.org/u/rcabeza)\
**Replies:** 8\
**Last updated:** [December 20, 2024, 4:25pm UTC](https://discourse.itk.org/t/issue-with-importing-dicom-files-in-slicer/7345 "2024-12-20T16:25:16Z")

</div>

Hello everyone, I am encountering an issue when importing DICOM files. I am working with ITK Python library version 5.4.0 and SimpleITK 2.4.0. I have previously asked this same question in 3DSlicer forum, because we are…

---

## [pyinstaller with RTK+VTK](https://discourse.itk.org/t/pyinstaller-with-rtk-vtk/6556)

<div class="topic-metadata">

**Author:** [@zhangm](https://discourse.itk.org/u/zhangm)\
**Replies:** 8\
**Last updated:** [December 11, 2024, 3:17am UTC](https://discourse.itk.org/t/pyinstaller-with-rtk-vtk/6556 "2024-12-11T03:17:42Z")

</div>

I use pyinstaller to generate a demo that can reconstruction data and show the result. The reconstruction is similar to FirstCudaReconstruction.py. My list of installed package is below. Package Versio…

---

## [itk::LineSpatialObject to itk::Image using itk::SpatialObjectToImageFilter?](https://discourse.itk.org/t/itk-linespatialobject-to-itk-image-using-itk-spatialobjecttoimagefilter/7326)

<div class="topic-metadata">

**Author:** [@constantine](https://discourse.itk.org/u/constantine)\
**Replies:** 4\
**Last updated:** [November 26, 2024, 5:24am UTC](https://discourse.itk.org/t/itk-linespatialobject-to-itk-image-using-itk-spatialobjecttoimagefilter/7326 "2024-11-26T05:24:27Z")

</div>

Hello Everyone, Using itk::SpatialObjectToImageFilter works beautifully, if I have an itk::EllipseSpatialObject, because an ellipse has dimensions in the object space. BTW, full respect to Julien Jomier for using the Co…

---

## [Potential acceleration for registration with BSplineTransform in metric derivative calculation](https://discourse.itk.org/t/potential-acceleration-for-registration-with-bsplinetransform-in-metric-derivative-calculation/7317)

<div class="topic-metadata">

**Author:** [@ljm898](https://discourse.itk.org/u/ljm898)\
**Replies:** 4\
**Last updated:** [November 22, 2024, 2:57am UTC](https://discourse.itk.org/t/potential-acceleration-for-registration-with-bsplinetransform-in-metric-derivative-calculation/7317 "2024-11-22T02:57:07Z")

</div>

Hi All, I believe I’ve identified a potential computational bottleneck when computing registrations involving BSplineTransforms, specifically during derivative calculation in the v3 registration metrics (might also be a…

---

## [How to use filter function (or other types of functions) in RTK to improve the quality of 3D reconstructed images?](https://discourse.itk.org/t/how-to-use-filter-function-or-other-types-of-functions-in-rtk-to-improve-the-quality-of-3d-reconstructed-images/7314)

<div class="topic-metadata">

**Author:** [@zhangxiang](https://discourse.itk.org/u/zhangxiang)\
**Replies:** 8\
**Last updated:** [November 18, 2024, 8:17am UTC](https://discourse.itk.org/t/how-to-use-filter-function-or-other-types-of-functions-in-rtk-to-improve-the-quality-of-3d-reconstructed-images/7314 "2024-11-18T08:17:35Z")

</div>

2d image: 3d image: The stent of this bronchial model can be seen in the 3D image. PARAMETERS: SDD=842mm, SID=455mm. image size=768×768, pixelsize=0.56×0.56. numbers of image=889. The code I use is : .\\rtks…

---

## [How to convert vascular segmentation result to “VascularNetwork.tre” file?](https://discourse.itk.org/t/how-to-convert-vascular-segmentation-result-to-vascularnetwork-tre-file/2949)

<div class="topic-metadata">

**Author:** [@TaoH](https://discourse.itk.org/u/TaoH)\
**Replies:** 4\
**Last updated:** [November 14, 2024, 2:42am UTC](https://discourse.itk.org/t/how-to-convert-vascular-segmentation-result-to-vascularnetwork-tre-file/2949 "2024-11-14T02:42:36Z")

</div>

Hello! I kown that TubeTK can convert “VascularNetwork.tre” file to vascular image. However, I want to convert a vascular segmentation result to the unbranched segments represented by centerline points and radius, like…

---

## [Saving series in any direction](https://discourse.itk.org/t/saving-series-in-any-direction/7300)

<div class="topic-metadata">

**Author:** [@zhangm](https://discourse.itk.org/u/zhangm)\
**Replies:** 3\
**Last updated:** [November 5, 2024, 1:59am UTC](https://discourse.itk.org/t/saving-series-in-any-direction/7300 "2024-11-05T01:59:21Z")

</div>

I have a metaData and a direction matrix, and I want to save the 3D data to a series 2d images according to the matrix. I find there is a function itkImageSeriesWriter to save series. But I didn’t find how to change the …

---

## [BSplineTransform not optimising in 2D-3D registration setting](https://discourse.itk.org/t/bsplinetransform-not-optimising-in-2d-3d-registration-setting/7241)

<div class="topic-metadata">

**Author:** [@ljm898](https://discourse.itk.org/u/ljm898)\
**Replies:** 9\
**Last updated:** [October 23, 2024, 2:04pm UTC](https://discourse.itk.org/t/bsplinetransform-not-optimising-in-2d-3d-registration-setting/7241 "2024-10-23T14:04:06Z")

</div>

Hi All, I’m working on implementing 2D-3D deformable registration in ITK (v5.3.0) using a BSplineTransform to fit deformable motion, but have hit a wall optimising a BSplineTransform. The approach I’ve taken is to compo…

---

## [2D skeletonization?](https://discourse.itk.org/t/2d-skeletonization/7268)

<div class="topic-metadata">

**Author:** [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Replies:** 4\
**Last updated:** [October 21, 2024, 8:12pm UTC](https://discourse.itk.org/t/2d-skeletonization/7268 "2024-10-21T20:12:15Z")

</div>

Are there any algorithms for medial surface implemented in ITK? The Thickness3D module only does 1D skeletonization, useful for vessels, airways, or maybe limbs. There is a CLI module in Slicer called ExtractSkeleton, l…

---

## [Transform from (cone beam) projection to object plane/coordinates?](https://discourse.itk.org/t/transform-from-cone-beam-projection-to-object-plane-coordinates/7246)

<div class="topic-metadata">

**Author:** [@constantine](https://discourse.itk.org/u/constantine)\
**Replies:** 5\
**Last updated:** [October 9, 2024, 1:24am UTC](https://discourse.itk.org/t/transform-from-cone-beam-projection-to-object-plane-coordinates/7246 "2024-10-09T01:24:12Z")

</div>

Hello all, Would you be able to suggest the appropriate transform for this use case? Say, in videofluoroscopy an object is projected onto the sensor plane with a radial distortion pattern in this manner: While near…

---

## [Why does an \`itk::PointSet\` have "PointData"? Any existing use cases?](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235)

<div class="topic-metadata">

**Author:** [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)\
**Replies:** 9\
**Last updated:** [October 8, 2024, 7:15pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235 "2024-10-08T19:15:21Z")

</div>

Obviously, itk::PointSet has a container of points (m\_PointsContainer), but it also may have some extra data, named “PointData”, and stored in its m\_PointDataContainer. As was introduced by @willschroeder, more than 2…

---

## [Misaligned intensity volume and ground truth mask](https://discourse.itk.org/t/misaligned-intensity-volume-and-ground-truth-mask/7245)

<div class="topic-metadata">

**Author:** [@Vojtech\_Benda](https://discourse.itk.org/u/Vojtech_Benda)\
**Replies:** 3\
**Last updated:** [October 2, 2024, 6:41pm UTC](https://discourse.itk.org/t/misaligned-intensity-volume-and-ground-truth-mask/7245 "2024-10-02T18:41:32Z")

</div>

I’m trying to extract volume sizes of a liver and tumors from their ground truth volume masks. I’m using the LabelIntensityStatisticsImageFilter, but for one of the inputs it throws me an error: RuntimeError: Exception …

---

## [itk::RelabelComponentImageFilter::GetSizeOfObjectInPhysicalUnits signature](https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237)

<div class="topic-metadata">

**Author:** [@cg2](https://discourse.itk.org/u/cg2)\
**Replies:** 3\
**Last updated:** [October 1, 2024, 10:43pm UTC](https://discourse.itk.org/t/itk-getsizeofobjectinphysicalunits-signature/7237 "2024-10-01T22:43:51Z")

</div>

Hi, After the detection of of a signedness comparison error during the compilation of RelabelComponentImageFilter: ITK-5.2/itkRelabelComponentImageFilter.h:228:24: error: comparison of integer expressions of different …

---

## [about AddProjection(const HomogeneousProjectionMatrixType & pMat)](https://discourse.itk.org/t/about-addprojection-const-homogeneousprojectionmatrixtype-pmat/7232)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 2\
**Last updated:** [September 24, 2024, 12:18pm UTC](https://discourse.itk.org/t/about-addprojection-const-homogeneousprojectionmatrixtype-pmat/7232 "2024-09-24T12:18:41Z")

</div>

WARNING: In D:\\rtk\\RTK-2.4.1\\src\\rtkThreeDCircularProjectionGeometry.cxx, line 358 DataObject (000001DBC37F0C40): Failed to AddProjection What does this error mean?

---

## [recover CC labeling from CC representatives in binary image](https://discourse.itk.org/t/recover-cc-labeling-from-cc-representatives-in-binary-image/7226)

<div class="topic-metadata">

**Author:** [@cousin](https://discourse.itk.org/u/cousin)\
**Replies:** 3\
**Last updated:** [September 18, 2024, 5:57pm UTC](https://discourse.itk.org/t/recover-cc-labeling-from-cc-representatives-in-binary-image/7226 "2024-09-18T17:57:41Z")

</div>

Dear all, I am considering the processing of a big binary image. A first processing step is to transform it into a second binary image, whose connected components I wish to retain. For lower disk usage and further para…

---

## [Help regarding RTK geometric projection](https://discourse.itk.org/t/help-regarding-rtk-geometric-projection/7225)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 4\
**Last updated:** [September 18, 2024, 3:40pm UTC](https://discourse.itk.org/t/help-regarding-rtk-geometric-projection/7225 "2024-09-18T15:40:58Z")

</div>

I have calculated the projection matrix and verified the re-projection to confirm there are no issues. However, when I tried to add the calculated matrix using AddProjection, I encountered an error: WARNING: In D:\\rtk\\RT…

---

## [about rtk::ParkerShortScanImageFilter\<OutputImageType\>](https://discourse.itk.org/t/about-rtk-parkershortscanimagefilter-outputimagetype/7203)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 2\
**Last updated:** [September 4, 2024, 10:05am UTC](https://discourse.itk.org/t/about-rtk-parkershortscanimagefilter-outputimagetype/7203 "2024-09-04T10:05:35Z")

</div>

What is the purpose of the SetAngularGapThreshold method? Why does the reconstruction quality seem better when it is not set compared to when it is set?

---

## [Is there any relevant content on CBCT system calibration in RTK？](https://discourse.itk.org/t/is-there-any-relevant-content-on-cbct-system-calibration-in-rtk/6125)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 6\
**Last updated:** [August 30, 2024, 6:08am UTC](https://discourse.itk.org/t/is-there-any-relevant-content-on-cbct-system-calibration-in-rtk/6125 "2024-08-30T06:08:27Z")

</div>

Recently, while studying CBCT calibration, I can only calculate the projection matrix from the position of the steel ball in one projection image and the mold. I can calculate a projection matrix for each projection imag…

---

## [Does RTK support parallel beam CT reconstruction?](https://discourse.itk.org/t/does-rtk-support-parallel-beam-ct-reconstruction/7193)

<div class="topic-metadata">

**Author:** [@ma1282029525](https://discourse.itk.org/u/ma1282029525)\
**Replies:** 2\
**Last updated:** [August 29, 2024, 4:15pm UTC](https://discourse.itk.org/t/does-rtk-support-parallel-beam-ct-reconstruction/7193 "2024-08-29T16:15:06Z")

</div>

…1

---

## [Reorienting Images](https://discourse.itk.org/t/reorienting-images/7189)

<div class="topic-metadata">

**Author:** [@dlevy-ph](https://discourse.itk.org/u/dlevy-ph)\
**Replies:** 2\
**Last updated:** [August 22, 2024, 9:05pm UTC](https://discourse.itk.org/t/reorienting-images/7189 "2024-08-22T21:05:57Z")

</div>

Hello, I am trying to achieve the attached process (which I had been doing using nibabel) with SimpleITK. I’m not sure how to interpret the cosine matrix, though, so I’m unclear about how to ensure L-P-S orientation: DE…

---

## [Relabeling components with regard to minimum physical object size](https://discourse.itk.org/t/relabeling-components-with-regard-to-minimum-physical-object-size/7175)

<div class="topic-metadata">

**Author:** [@ibro45](https://discourse.itk.org/u/ibro45)\
**Replies:** 5\
**Last updated:** [August 14, 2024, 6:15pm UTC](https://discourse.itk.org/t/relabeling-components-with-regard-to-minimum-physical-object-size/7175 "2024-08-14T18:15:37Z")

</div>

Hi, I would like to relabel components with regard to physical size rather than the number of voxels. So a hypothetical SetMinimumObjectPhysicalSize rather than SetMinimumObjectSize. What would be the most efficient way…

---

## [Thresholding largest/smallest component in ITK](https://discourse.itk.org/t/thresholding-largest-smallest-component-in-itk/5601)

<div class="topic-metadata">

**Author:** [@Ahmed\_Saleh\_Tolba](https://discourse.itk.org/u/Ahmed_Saleh_Tolba)\
**Replies:** 20\
**Last updated:** [August 14, 2024, 2:45pm UTC](https://discourse.itk.org/t/thresholding-largest-smallest-component-in-itk/5601 "2024-08-14T14:45:26Z")

</div>

Hello, I’m trying to remove the largest island and also the smallest island. I can get the components correctly, and they are sorted using relabel filter. but I want to threshold the smallest components, and keep the l…

---

## [generate rtk wheels](https://discourse.itk.org/t/generate-rtk-wheels/6668)

<div class="topic-metadata">

**Author:** [@zhangm](https://discourse.itk.org/u/zhangm)\
**Replies:** 15\
**Last updated:** [August 2, 2024, 3:12am UTC](https://discourse.itk.org/t/generate-rtk-wheels/6668 "2024-08-02T03:12:41Z")

</div>

In order to reduce the loading time if RTK, I first generate itk wheels by ITKPythonPackage with "-DITK\_WRAP\_IMAGE\_DIMS:STRING=2;3". And then pip install itk-rtk-cuda, but that method will cause the error, so I think I n…

---

## [Variably Spaced DICOM Data Support](https://discourse.itk.org/t/variably-spaced-dicom-data-support/6699)

<div class="topic-metadata">

**Author:** [@Michael\_M](https://discourse.itk.org/u/Michael_M)\
**Replies:** 3\
**Last updated:** [July 19, 2024, 7:30pm UTC](https://discourse.itk.org/t/variably-spaced-dicom-data-support/6699 "2024-07-19T19:30:19Z")

</div>

A not uncommon practice in the medical world involves scanning a patient with different slice thicknesses in different parts of the anatomy, all within the same DICOM series. For example, the patient is imaged with CT o…

---

## [Speed up the reconstruction](https://discourse.itk.org/t/speed-up-the-reconstruction/6599)

<div class="topic-metadata">

**Author:** [@zhangm](https://discourse.itk.org/u/zhangm)\
**Replies:** 24\
**Last updated:** [July 19, 2024, 6:53pm UTC](https://discourse.itk.org/t/speed-up-the-reconstruction/6599 "2024-07-19T18:53:47Z")

</div>

I use CudaFDK to reconstruction my data, the speed is much faster than using CPU. But I still want to try and make this time shorter. I use Profile on pyCharm to print the time spent by the process like below: Is the…

---

## [Registering with only one slice of 3d image](https://discourse.itk.org/t/registering-with-only-one-slice-of-3d-image/7028)

<div class="topic-metadata">

**Author:** [@cadaei](https://discourse.itk.org/u/cadaei)\
**Replies:** 4\
**Last updated:** [July 15, 2024, 9:30am UTC](https://discourse.itk.org/t/registering-with-only-one-slice-of-3d-image/7028 "2024-07-15T09:30:14Z")

</div>

Hi, I want to register 2 dicom images which are of the same examination, but with a slightly different FOV. Each image stack consists of three slices, but their distance is too large, so each slice has to be registered …

---

## [Parker Weighting Reconstruction](https://discourse.itk.org/t/parker-weighting-reconstruction/7043)

<div class="topic-metadata">

**Author:** [@zhangm](https://discourse.itk.org/u/zhangm)\
**Replies:** 6\
**Last updated:** [July 12, 2024, 9:04am UTC](https://discourse.itk.org/t/parker-weighting-reconstruction/7043 "2024-07-12T09:04:40Z")

</div>

I have a set of projections from 0° to 210°, take one image at 1°. And I want use CudaParkerShortScanImageFilter to reconstruction it. But there has artifacts because the warning like this: WARNING: In C:\\runner\\\_work\\…

[Previous page](https://discourse.itk.org/c/algorithms/7.md)

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