# Algorithms

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

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

**Page:** 8

---

## [Quick Test for "are images in the same space" aka "overalpping" (SimpleITK)?](https://discourse.itk.org/t/quick-test-for-are-images-in-the-same-space-aka-overalpping-simpleitk/5249)

<div class="topic-metadata">

**Author:** [@gdevenyi](https://discourse.itk.org/u/gdevenyi)\
**Replies:** 7\
**Last updated:** [August 8, 2022, 9:10pm UTC](https://discourse.itk.org/t/quick-test-for-are-images-in-the-same-space-aka-overalpping-simpleitk/5249 "2022-08-08T21:10:49Z")

</div>

If I have a collection of images and I’d like to quickly check that they’re “overlapping”, that is, have the same origin, pixel dimensions and direction cosines, is there a filter/test which does this other than comparin…

---

## [SimpleITK, numpy, scipy, and voxel ordering](https://discourse.itk.org/t/simpleitk-numpy-scipy-and-voxel-ordering/5250)

<div class="topic-metadata">

**Author:** [@gdevenyi](https://discourse.itk.org/u/gdevenyi)\
**Replies:** 0\
**Last updated:** [August 8, 2022, 7:14pm UTC](https://discourse.itk.org/t/simpleitk-numpy-scipy-and-voxel-ordering/5250 "2022-08-08T19:14:26Z")

</div>

Following up on Images in physical space in Python Was it decided how x,y,z in SimpleITK, is represented? I can’t find a complete description of the voxel dimension ordering in Fundamental Concepts — SimpleITK 2.0rc2 do…

---

## [changing origin bspline registration](https://discourse.itk.org/t/changing-origin-bspline-registration/5246)

<div class="topic-metadata">

**Author:** [@Ilay\_Kamai](https://discourse.itk.org/u/Ilay_Kamai)\
**Replies:** 1\
**Last updated:** [August 8, 2022, 4:16am UTC](https://discourse.itk.org/t/changing-origin-bspline-registration/5246 "2022-08-08T04:16:55Z")

</div>

hi, i’m trying to change the domain origin of a bspline registration, but it seems to have no effect. this is part of the code: def bspline\_registration(fixed\_image, moving\_image, out\_path, params): """ bspline…

---

## [bspline registration from numpy array doesn't transform point](https://discourse.itk.org/t/bspline-registration-from-numpy-array-doesnt-transform-point/5238)

<div class="topic-metadata">

**Author:** [@Ilay\_Kamai](https://discourse.itk.org/u/Ilay_Kamai)\
**Replies:** 0\
**Last updated:** [August 3, 2022, 7:27pm UTC](https://discourse.itk.org/t/bspline-registration-from-numpy-array-doesnt-transform-point/5238 "2022-08-03T19:27:41Z")

</div>

Hi, i’m registering two DICOM images using affine and Bspline registrations. after registration, I’m using the transformation to transform points (in physical space). I’m creating an interactive interface that enable t…

---

## [Finding the largest physical region (bounding box) across an arbitrary number of input files (SimpleITK)](https://discourse.itk.org/t/finding-the-largest-physical-region-bounding-box-across-an-arbitrary-number-of-input-files-simpleitk/5234)

<div class="topic-metadata">

**Author:** [@gdevenyi](https://discourse.itk.org/u/gdevenyi)\
**Replies:** 5\
**Last updated:** [August 2, 2022, 10:52pm UTC](https://discourse.itk.org/t/finding-the-largest-physical-region-bounding-box-across-an-arbitrary-number-of-input-files-simpleitk/5234 "2022-08-02T22:52:16Z")

</div>

I’m working on an arbitrary image averaging script, where I’d like to assume input images are not guaranteed to overlap (completely, or even partially). As such, I need to construct a “common” space which contains all th…

---

## [DiscreteGaussianImageFilter with RGBPixel](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231)

<div class="topic-metadata">

**Author:** [@Matthieu\_Brucher](https://discourse.itk.org/u/Matthieu_Brucher)\
**Replies:** 4\
**Last updated:** [August 1, 2022, 6:35pm UTC](https://discourse.itk.org/t/discretegaussianimagefilter-with-rgbpixel/5231 "2022-08-01T18:35:46Z")

</div>

Is it possible to natively get an image with RGBPixel\<\> as the internal type filtered with this filter? Looks like there are some issues with ITK 5.2.0, as the intermediate type messes up the setup and stops with: /opt…

---

## [Running ITK-Snap with image and segmentation by Simple ITK Image Viewer Class](https://discourse.itk.org/t/running-itk-snap-with-image-and-segmentation-by-simple-itk-image-viewer-class/5215)

<div class="topic-metadata">

**Author:** [@Oguzcan13](https://discourse.itk.org/u/Oguzcan13)\
**Replies:** 1\
**Last updated:** [July 27, 2022, 7:16pm UTC](https://discourse.itk.org/t/running-itk-snap-with-image-and-segmentation-by-simple-itk-image-viewer-class/5215 "2022-07-27T19:16:51Z")

</div>

Hi there my question is quite basic actually but I couldn’t find the is there any way or not? I have Dicom image series and Prediction of Segmentation with .jpeg files. Basically, I am able to read them by SimpleITK but…

---

## [Are there any image harmonization modules in sitk?](https://discourse.itk.org/t/are-there-any-image-harmonization-modules-in-sitk/5219)

<div class="topic-metadata">

**Author:** [@DushiFdo](https://discourse.itk.org/u/DushiFdo)\
**Replies:** 2\
**Last updated:** [July 26, 2022, 8:14pm UTC](https://discourse.itk.org/t/are-there-any-image-harmonization-modules-in-sitk/5219 "2022-07-26T20:14:42Z")

</div>

Hi, I am working on 3D CT images (128x128x128) where the region of interest is liver. I am trying to apply harmonization methods on 3D volumes where my features are voxel intensities. I first tried neurocombat (GitHub …

---

## [Extract contours from 3D image](https://discourse.itk.org/t/extract-contours-from-3d-image/5209)

<div class="topic-metadata">

**Author:** [@Kap](https://discourse.itk.org/u/Kap)\
**Replies:** 2\
**Last updated:** [July 22, 2022, 6:39pm UTC](https://discourse.itk.org/t/extract-contours-from-3d-image/5209 "2022-07-22T18:39:10Z")

</div>

Dears, I am trying to extract the contour from an object after the procedure of the segmentation. The complie is error free but the output is an empty(black) image. Maybe the output image type is wrong ? Any ideas ? H…

---

## [Wired ResampleImageFilter results after downsampling a 3D image and then upsampling it to the original size](https://discourse.itk.org/t/wired-resampleimagefilter-results-after-downsampling-a-3d-image-and-then-upsampling-it-to-the-original-size/5193)

<div class="topic-metadata">

**Author:** [@Ruoyan](https://discourse.itk.org/u/Ruoyan)\
**Replies:** 6\
**Last updated:** [July 18, 2022, 9:33pm UTC](https://discourse.itk.org/t/wired-resampleimagefilter-results-after-downsampling-a-3d-image-and-then-upsampling-it-to-the-original-size/5193 "2022-07-18T21:33:47Z")

</div>

Hi, I’m trying to downsample an image to 50\*50\*50 and then upsample it back to the original size. After I processed this with two ResampleImageFilter, the new upsampled image has 2\*z\_size\*y\_size black/empty pixels at …

---

## [Strange dependency between GPU & CPU filters](https://discourse.itk.org/t/strange-dependency-between-gpu-cpu-filters/5188)

<div class="topic-metadata">

**Author:** [@Fijoy\_Vadakkumpadan](https://discourse.itk.org/u/Fijoy_Vadakkumpadan)\
**Replies:** 2\
**Last updated:** [July 18, 2022, 5:33am UTC](https://discourse.itk.org/t/strange-dependency-between-gpu-cpu-filters/5188 "2022-07-18T05:33:24Z")

</div>

Do GPU filters in ITK have some hidden dependency on corresponding CPU filters? I’m seeing this unexpected behavior in my application where a GPU filter usage aborts my application with an exception (the kind that canno…

---

## [How to get metric value for a given set of transform parameters in ITK V4?](https://discourse.itk.org/t/how-to-get-metric-value-for-a-given-set-of-transform-parameters-in-itk-v4/1906)

<div class="topic-metadata">

**Author:** [@eewujian](https://discourse.itk.org/u/eewujian)\
**Replies:** 3\
**Last updated:** [July 6, 2022, 7:12am UTC](https://discourse.itk.org/t/how-to-get-metric-value-for-a-given-set-of-transform-parameters-in-itk-v4/1906 "2022-07-06T07:12:08Z")

</div>

I’m trying to plot a profile of cost function (or metric) values for a 3D image registration study. This can be done easily in ITK V3 with the itk::ImageToImageMetric::GetValue(const ParametersType &parameters) function.…

---

## [Spine CT and MRI images registration](https://discourse.itk.org/t/spine-ct-and-mri-images-registration/5146)

<div class="topic-metadata">

**Author:** [@ainor](https://discourse.itk.org/u/ainor)\
**Replies:** 5\
**Last updated:** [July 5, 2022, 9:06am UTC](https://discourse.itk.org/t/spine-ct-and-mri-images-registration/5146 "2022-07-05T09:06:32Z")

</div>

Hello, I am trying to make an automatic registration between CT and MRI images of the spine with ITK, the images are of the same person but they can have different sizes as the example that I show in the attached images. …

---

## [Faster brightness/contrast augmentation?](https://discourse.itk.org/t/faster-brightness-contrast-augmentation/5145)

<div class="topic-metadata">

**Author:** [@Floowey](https://discourse.itk.org/u/Floowey)\
**Replies:** 6\
**Last updated:** [June 30, 2022, 3:40pm UTC](https://discourse.itk.org/t/faster-brightness-contrast-augmentation/5145 "2022-06-30T15:40:46Z")

</div>

Hello, I intend to alter the contrast/brightness of my images in my pytorch Dataset pipeline using the sitk.AdaptiveHistogramEqualization method to make my neural network more robust against such differences. However, I…

---

## [Upsample a mask the same way that Slicer does](https://discourse.itk.org/t/upsample-a-mask-the-same-way-that-slicer-does/5053)

<div class="topic-metadata">

**Author:** [@ibro45](https://discourse.itk.org/u/ibro45)\
**Replies:** 5\
**Last updated:** [June 24, 2022, 10:29pm UTC](https://discourse.itk.org/t/upsample-a-mask-the-same-way-that-slicer-does/5053 "2022-06-24T22:29:30Z")

</div>

Hi all, For each scan, I have a mask that was segmented out on a cropped and downsampled version of that scan. Loading such a mask in Slicer automatically upsamples it and places it correctly in the physical space of th…

---

## [Help with import images from sequential folders ---batch processing using Fiji Macros](https://discourse.itk.org/t/help-with-import-images-from-sequential-folders-batch-processing-using-fiji-macros/5077)

<div class="topic-metadata">

**Author:** [@Duben](https://discourse.itk.org/u/Duben)\
**Replies:** 1\
**Last updated:** [June 9, 2022, 7:51am UTC](https://discourse.itk.org/t/help-with-import-images-from-sequential-folders-batch-processing-using-fiji-macros/5077 "2022-06-09T07:51:33Z")

</div>

Dear all, I am looking for help with batch processing in Fiji. I am new to programming. I’m doing Cyclic-immunofluorescene.I need to combine 4-channel fluorescent images of the same tissue section of 10 cycles. I use H…

---

## [MEASUREMENT LABELS(sphere, polygon, line angle etc)](https://discourse.itk.org/t/measurement-labels-sphere-polygon-line-angle-etc/4979)

<div class="topic-metadata">

**Author:** [@SREERAG\_H](https://discourse.itk.org/u/SREERAG_H)\
**Replies:** 1\
**Last updated:** [June 5, 2022, 7:48pm UTC](https://discourse.itk.org/t/measurement-labels-sphere-polygon-line-angle-etc/4979 "2022-06-05T19:48:58Z")

</div>

Hi, Can anyone help me to know how to use measurement labels(sphere, polygon, angle etc) in itkimagedata.

---

## [3D Pointset to Pointset registration issue](https://discourse.itk.org/t/3d-pointset-to-pointset-registration-issue/5043)

<div class="topic-metadata">

**Author:** [@rfenioux](https://discourse.itk.org/u/rfenioux)\
**Replies:** 5\
**Last updated:** [June 2, 2022, 3:23pm UTC](https://discourse.itk.org/t/3d-pointset-to-pointset-registration-issue/5043 "2022-06-02T15:23:29Z")

</div>

Hi everyone, I’m trying to make this example work with 3D pointsets. I’m using the same methods as the example (AffineTransform, JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4, RegistrationParameterScalesFromPhys…

---

## [Overlaying Segmented mask with color over Input Vtkimagedata 3D (Dicom series)](https://discourse.itk.org/t/overlaying-segmented-mask-with-color-over-input-vtkimagedata-3d-dicom-series/4912)

<div class="topic-metadata">

**Author:** [@SREERAG\_H](https://discourse.itk.org/u/SREERAG_H)\
**Replies:** 14\
**Last updated:** [May 9, 2022, 6:18am UTC](https://discourse.itk.org/t/overlaying-segmented-mask-with-color-over-input-vtkimagedata-3d-dicom-series/4912 "2022-05-09T06:18:51Z")

</div>

Hi all , I am working with ITK Segmentation algorithm’s. My input is a Dicom series and I used VtkDicomReader to get the vtkimagedata and then I converted to itkimage(Short, dmension=3) and I used connected threshold re…

---

## [Image quality after registration](https://discourse.itk.org/t/image-quality-after-registration/4947)

<div class="topic-metadata">

**Author:** [@Moha\_data](https://discourse.itk.org/u/Moha_data)\
**Replies:** 4\
**Last updated:** [May 2, 2022, 5:35pm UTC](https://discourse.itk.org/t/image-quality-after-registration/4947 "2022-05-02T17:35:04Z")

</div>

Hello, I applied affine registration to images, and the result shows that images are successfully registered. However, when I compare the fixed image with the registered moving image, I can see that the fixed image is b…

---

## [Binary Morphological Filter with Padding](https://discourse.itk.org/t/binary-morphological-filter-with-padding/4921)

<div class="topic-metadata">

**Author:** [@Oddone-Scatena](https://discourse.itk.org/u/Oddone-Scatena)\
**Replies:** 6\
**Last updated:** [May 2, 2022, 5:31pm UTC](https://discourse.itk.org/t/binary-morphological-filter-with-padding/4921 "2022-05-02T17:31:52Z")

</div>

I am using binary morphological image filter with large structuring element radius to find the convex hull between the lungs. However I haven’t been able to build a satsfatory convex hull yet as some holes have remai…

---

## [Simple ITK Crop Image](https://discourse.itk.org/t/simple-itk-crop-image/4246)

<div class="topic-metadata">

**Author:** [@machadoL](https://discourse.itk.org/u/machadoL)\
**Replies:** 4\
**Last updated:** [April 28, 2022, 5:31pm UTC](https://discourse.itk.org/t/simple-itk-crop-image/4246 "2022-04-28T17:31:03Z")

</div>

Hey guys: I have a 3D grey-level image (256, 256, 192); I have a 3D label-image binary (1 and 0) to define a segmentation (256, 256, 192); I use LabelShapeStatisticsImageFilter to get a bounding box or region for my l…

---

## [Simple region-growing segmentation of the small intestine is terrible, using many seed points and 3D T2 MRI data](https://discourse.itk.org/t/simple-region-growing-segmentation-of-the-small-intestine-is-terrible-using-many-seed-points-and-3d-t2-mri-data/4942)

<div class="topic-metadata">

**Author:** [@aliabidi](https://discourse.itk.org/u/aliabidi)\
**Replies:** 8\
**Last updated:** [April 28, 2022, 4:55pm UTC](https://discourse.itk.org/t/simple-region-growing-segmentation-of-the-small-intestine-is-terrible-using-many-seed-points-and-3d-t2-mri-data/4942 "2022-04-28T16:55:15Z")

</div>

I am currently trying to apply region growing to 3D T2 MRI scans which I have been given, to segment the end of the small intenstine (i.e. the terminal ileum). I am using several features from SimpleITK. The problem is, …

---

## [How detect missing files in a DICOM series.](https://discourse.itk.org/t/how-detect-missing-files-in-a-dicom-series/4935)

<div class="topic-metadata">

**Author:** [@ainor](https://discourse.itk.org/u/ainor)\
**Replies:** 3\
**Last updated:** [April 26, 2022, 5:50am UTC](https://discourse.itk.org/t/how-detect-missing-files-in-a-dicom-series/4935 "2022-04-26T05:50:39Z")

</div>

Hi, I know that the itk::GDCMSeriesFileNames class allows you to generate an ordering sequence of filenames from a DICOM series. But if I have a series that should consist of, for example, 100 slices and some of those sl…

---

## [How to calculate the reverse 3d affine transform?](https://discourse.itk.org/t/how-to-calculate-the-reverse-3d-affine-transform/4916)

<div class="topic-metadata">

**Author:** [@yding58](https://discourse.itk.org/u/yding58)\
**Replies:** 1\
**Last updated:** [April 15, 2022, 3:14pm UTC](https://discourse.itk.org/t/how-to-calculate-the-reverse-3d-affine-transform/4916 "2022-04-15T15:14:44Z")

</div>

Hi all, I tried to calculate the reverse affine transform matrix and the returned translation vector is always wrong, which bother me a lot. Anyone has any ideas? I appreciate for any suggestions. Thank you! Here are s…

---

## [BinaryFillholeImageFilter: Insight Journal Paper](https://discourse.itk.org/t/binaryfillholeimagefilter-insight-journal-paper/4891)

<div class="topic-metadata">

**Author:** [@Sharada](https://discourse.itk.org/u/Sharada)\
**Replies:** 7\
**Last updated:** [April 1, 2022, 2:02pm UTC](https://discourse.itk.org/t/binaryfillholeimagefilter-insight-journal-paper/4891 "2022-04-01T14:02:09Z")

</div>

Hello, I am trying to access this insight journal article, but it does not load. Unfortunately, I am also not able to access chapter 6 of Pierre Soille’s book “Morphological Image Analysis: Principles and Applications”. …

---

## [Resampling images - LinearInterpolateImageFunction](https://discourse.itk.org/t/resampling-images-linearinterpolateimagefunction/4887)

<div class="topic-metadata">

**Author:** [@tabro](https://discourse.itk.org/u/tabro)\
**Replies:** 1\
**Last updated:** [March 28, 2022, 3:14pm UTC](https://discourse.itk.org/t/resampling-images-linearinterpolateimagefunction/4887 "2022-03-28T15:14:45Z")

</div>

Hi, I’m trying to resample a CT (nifti) of non-isotropic spacing to have isotropic spacing of (0.5, 0.5, 0.5), no rescaling. I’m using the code below. The output is an array of the desired size but consists of almost on…

---

## [Registration repeatability](https://discourse.itk.org/t/registration-repeatability/4883)

<div class="topic-metadata">

**Author:** [@Kyoto\_Love](https://discourse.itk.org/u/Kyoto_Love)\
**Replies:** 3\
**Last updated:** [March 26, 2022, 3:59pm UTC](https://discourse.itk.org/t/registration-repeatability/4883 "2022-03-26T15:59:27Z")

</div>

Hello everyone! I am stuck on one task, I need to register 2 identical images and do: 1.Write a loop for initializing the transformation with different parameters, and start the registration from different places. 2.St…

---

## [Resampling image](https://discourse.itk.org/t/resampling-image/4793)

<div class="topic-metadata">

**Author:** [@tutti](https://discourse.itk.org/u/tutti)\
**Replies:** 7\
**Last updated:** [March 23, 2022, 3:30am UTC](https://discourse.itk.org/t/resampling-image/4793 "2022-03-23T03:30:33Z")

</div>

Hello everyone, I try to resample image 1 (nii) \[128,128,128\], spacing \[1,1,1\] to image2 \[512,512,476\], spacing2 \[0.6,0.6,0.6\], but I got image as following. def resample\_img(itk\_image1, itk\_image2, out\_spacing=\[0.6…

---

## [Is it easy to change the level set function ?](https://discourse.itk.org/t/is-it-easy-to-change-the-level-set-function/4871)

<div class="topic-metadata">

**Author:** [@Oddone-Scatena](https://discourse.itk.org/u/Oddone-Scatena)\
**Replies:** 0\
**Last updated:** [March 18, 2022, 9:33pm UTC](https://discourse.itk.org/t/is-it-easy-to-change-the-level-set-function/4871 "2022-03-18T21:33:37Z")

</div>

Level set methods solve the diferencial equation with the level set function: I am using geodesic active contour: But I wished that A was the solution of the gradient vector flow ( Using anatomical knowledge expres…

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

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