# Algorithms

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

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

**Page:** 13

---

## [How to apply composite affine matrix to a volume](https://discourse.itk.org/t/how-to-apply-composite-affine-matrix-to-a-volume/3182)

<div class="topic-metadata">

**Author:** [@prms](https://discourse.itk.org/u/prms)\
**Replies:** 9\
**Last updated:** [June 21, 2020, 6:24pm UTC](https://discourse.itk.org/t/how-to-apply-composite-affine-matrix-to-a-volume/3182 "2020-06-21T18:24:04Z")

</div>

I am performing affine transformation of image and have an affine matrix learned using PyTorch. I want to use the learned matrix to MR image and save the image to disk using SimpleITK. However, I am not able to apply the…

---

## [How to get pixels within a radius from a specific pixel?](https://discourse.itk.org/t/how-to-get-pixels-within-a-radius-from-a-specific-pixel/3243)

<div class="topic-metadata">

**Author:** [@aangelos28](https://discourse.itk.org/u/aangelos28)\
**Replies:** 5\
**Last updated:** [July 11, 2020, 9:29pm UTC](https://discourse.itk.org/t/how-to-get-pixels-within-a-radius-from-a-specific-pixel/3243 "2020-07-11T21:29:16Z")

</div>

Hello, I was wondering if there is a way to get the indices of pixels within a certain radius from a center pixel with a specific ID. itk::NeighborhoodIterator was the closest thing I found to this, but how can I use it…

---

## [Generate Rotational Maximum Intensity Projections](https://discourse.itk.org/t/generate-rotational-maximum-intensity-projections/3226)

<div class="topic-metadata">

**Author:** [@divya\_chou](https://discourse.itk.org/u/divya_chou)\
**Replies:** 11\
**Last updated:** [July 7, 2020, 6:38am UTC](https://discourse.itk.org/t/generate-rotational-maximum-intensity-projections/3226 "2020-07-07T06:38:20Z")

</div>

I am very new to using ITK, and am working using SITK on Python. I have 3D PET scans. From each 3D matrix, I have generated 2 MIPs at 90 degrees - Sagittal and Coronal. This was easily achieved using the sitk.MaximumPro…

---

## [New Insight Toolkit (ITK) module for Structure Preserving Color Normalization](https://discourse.itk.org/t/new-insight-toolkit-itk-module-for-structure-preserving-color-normalization/3255)

<div class="topic-metadata">

**Author:** [@Lee\_Newberg](https://discourse.itk.org/u/Lee_Newberg)\
**Replies:** 0\
**Last updated:** [July 2, 2020, 8:02pm UTC](https://discourse.itk.org/t/new-insight-toolkit-itk-module-for-structure-preserving-color-normalization/3255 "2020-07-02T20:02:23Z")

</div>

Introduction We have added a new module to the Insight Toolkit (ITK) to perform Structure Preserving Color Normalization on an H & E image using a reference image. The software is available in C++ and is also …

---

## [How is computed the Geometric Center of an Image](https://discourse.itk.org/t/how-is-computed-the-geometric-center-of-an-image/3247)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 8:09pm UTC](https://discourse.itk.org/t/how-is-computed-the-geometric-center-of-an-image/3247 "2020-07-01T20:09:14Z")

</div>

Dear All, Just for tuning. How is computed the geometric center of an image? For example, for one of the dimensions: DimX \>\> 1 (integer) float(DIMX -1)/2.0 (float or double) Thanks, Luis Gonçalves

---

## [Registration of two space closed Images](https://discourse.itk.org/t/registration-of-two-space-closed-images/3228)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 8\
**Last updated:** [June 30, 2020, 10:11pm UTC](https://discourse.itk.org/t/registration-of-two-space-closed-images/3228 "2020-06-30T22:11:17Z")

</div>

Dear All, Happens that I take the Region of Interest of two images. Those images are space closed. I apply a Registration in Rotation and Translation (Mutual Information) and with the registration the result is worst t…

---

## [Better positions of the subjects of registration](https://discourse.itk.org/t/better-positions-of-the-subjects-of-registration/3240)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 3\
**Last updated:** [June 30, 2020, 6:17pm UTC](https://discourse.itk.org/t/better-positions-of-the-subjects-of-registration/3240 "2020-06-30T18:17:19Z")

</div>

Dear All, I am using the following example. http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python\_html/60\_Registration\_Introduction.html I have the following doubt. If I want to do the registration of …

---

## [InPlace and Order of the Operations in Transform](https://discourse.itk.org/t/inplace-and-order-of-the-operations-in-transform/3232)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 8\
**Last updated:** [June 29, 2020, 10:25pm UTC](https://discourse.itk.org/t/inplace-and-order-of-the-operations-in-transform/3232 "2020-06-29T22:25:43Z")

</div>

Dear All, By the manual I do not understand the difference between InPlace True and False. Could you please explain? What it is adequate. ##Don’t optimize in-place, we would possibly like to run this cell multiple tim…

---

## [Registration in one Rotation parameters of the transform not doing well](https://discourse.itk.org/t/registration-in-one-rotation-parameters-of-the-transform-not-doing-well/3215)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 9\
**Last updated:** [June 29, 2020, 2:33pm UTC](https://discourse.itk.org/t/registration-in-one-rotation-parameters-of-the-transform-not-doing-well/3215 "2020-06-29T14:33:58Z")

</div>

Dear All, I am using the following example for my own purposes (but with Similarity3DTransform) : http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python\_html/60\_Registration\_Introduction.html When I do …

---

## [How to create binary image from CT image.](https://discourse.itk.org/t/how-to-create-binary-image-from-ct-image/3222)

<div class="topic-metadata">

**Author:** [@unicorn](https://discourse.itk.org/u/unicorn)\
**Replies:** 1\
**Last updated:** [June 24, 2020, 4:14pm UTC](https://discourse.itk.org/t/how-to-create-binary-image-from-ct-image/3222 "2020-06-24T16:14:05Z")

</div>

I applied Sobel edge detector and wanted to apply threshold on it. How do I set these threshold? What are the values to be given here for CT?

---

## [Express AffineTransform as single 4x4 matrix](https://discourse.itk.org/t/express-affinetransform-as-single-4x4-matrix/3193)

<div class="topic-metadata">

**Author:** [@T\_Kirk](https://discourse.itk.org/u/T_Kirk)\
**Replies:** 16\
**Last updated:** [June 23, 2020, 11:36am UTC](https://discourse.itk.org/t/express-affinetransform-as-single-4x4-matrix/3193 "2020-06-23T11:36:19Z")

</div>

I have an AffineTransform ITK object that I would like to use with other registration tools. To do so, I need to express the transform as a single 4x4 matrix in world-world terms - that is, incorporating all the Paramete…

---

## [Are the shift parameters affected by the scale parameter in the Similarity3DTransform](https://discourse.itk.org/t/are-the-shift-parameters-affected-by-the-scale-parameter-in-the-similarity3dtransform/3213)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 3\
**Last updated:** [June 21, 2020, 2:13pm UTC](https://discourse.itk.org/t/are-the-shift-parameters-affected-by-the-scale-parameter-in-the-similarity3dtransform/3213 "2020-06-21T14:13:13Z")

</div>

Dear All, I am using the Similarity3DTransform in SimpleITK. I have a doubt. After I get the transform, the parameters concerning the shift are with the dimensions of the .mhd file or the new ones affected by the scalin…

---

## [Good procedures to get a good registration](https://discourse.itk.org/t/good-procedures-to-get-a-good-registration/3199)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 1\
**Last updated:** [June 17, 2020, 7:23pm UTC](https://discourse.itk.org/t/good-procedures-to-get-a-good-registration/3199 "2020-06-17T19:23:17Z")

</div>

Dear All, I found out that there are some variance in the resulting parameters of the transforms of multiple registrations. How I can procedure to obtain always about the same results? Thanks, Luis Gonçalves

---

## [Derivation of mutual information in EMMA algorithm for image alignment](https://discourse.itk.org/t/derivation-of-mutual-information-in-emma-algorithm-for-image-alignment/3180)

<div class="topic-metadata">

**Author:** [@Amey\_Joshi](https://discourse.itk.org/u/Amey_Joshi)\
**Replies:** 1\
**Last updated:** [June 12, 2020, 1:56pm UTC](https://discourse.itk.org/t/derivation-of-mutual-information-in-emma-algorithm-for-image-alignment/3180 "2020-06-12T13:56:55Z")

</div>

This is a question about the derivative of the mutual information between two images with respect to a transformation between them. It appears in one of Paul Viola’s papers that introduced this concept for the first time…

---

## [Align image along hippocampus axis](https://discourse.itk.org/t/align-image-along-hippocampus-axis/3125)

<div class="topic-metadata">

**Author:** [@Pierrick](https://discourse.itk.org/u/Pierrick)\
**Replies:** 1\
**Last updated:** [June 10, 2020, 6:18pm UTC](https://discourse.itk.org/t/align-image-along-hippocampus-axis/3125 "2020-06-10T18:18:13Z")

</div>

Hi all, I am trying to reorient images along the hippocampus main axis. I can replicate the results of 06\_segmentation\_and\_shape\_analysis.html, but since it centers the image on the corner of the bounding box, it is les…

---

## [N4BiasFieldCorrection issues when re-run (applied through SliceBySlice filter)](https://discourse.itk.org/t/n4biasfieldcorrection-issues-when-re-run-applied-through-slicebyslice-filter/2897)

<div class="topic-metadata">

**Author:** [@grothausmann.roman](https://discourse.itk.org/u/grothausmann.roman)\
**Replies:** 19\
**Last updated:** [June 8, 2020, 9:35am UTC](https://discourse.itk.org/t/n4biasfieldcorrection-issues-when-re-run-applied-through-slicebyslice-filter/2897 "2020-06-08T09:35:00Z")

</div>

Hello! I am wondering what is the current status of streaming when using the SliceBySlice filter to apply another filter slice-wise. I found this communication but it is quite old and have trouble to get my implementati…

---

## [3D MRI IMAGE REGISTRATION](https://discourse.itk.org/t/3d-mri-image-registration/3144)

<div class="topic-metadata">

**Author:** [@Dodox](https://discourse.itk.org/u/Dodox)\
**Replies:** 5\
**Last updated:** [June 5, 2020, 1:10pm UTC](https://discourse.itk.org/t/3d-mri-image-registration/3144 "2020-06-05T13:10:40Z")

</div>

Hello dear community , i need your help !!! I applied this registration code on 3D MRI images, but as you can see in the photo, the images are not perfectly aligned. any solutions ? here is the code fixed\_image\_nam…

---

## [Principal moments](https://discourse.itk.org/t/principal-moments/3142)

<div class="topic-metadata">

**Author:** [@sz20b5](https://discourse.itk.org/u/sz20b5)\
**Replies:** 1\
**Last updated:** [June 3, 2020, 11:04am UTC](https://discourse.itk.org/t/principal-moments/3142 "2020-06-03T11:04:36Z")

</div>

Dear all, where can I found how is exactly computed GetPrincipalMoments() of a ShapeLabelObject? Thanks Jim

---

## [Contrast enhancement method for CT](https://discourse.itk.org/t/contrast-enhancement-method-for-ct/3132)

<div class="topic-metadata">

**Author:** [@EE18D504\_SINDHURA\_C](https://discourse.itk.org/u/EE18D504_SINDHURA_C)\
**Replies:** 3\
**Last updated:** [June 1, 2020, 1:37am UTC](https://discourse.itk.org/t/contrast-enhancement-method-for-ct/3132 "2020-06-01T01:37:29Z")

</div>

I want to know what would be the best method to enhance the contrast of the CT images. What are the best filters available in ITK? Is there any filter that uses a simple contrast stretching method?

---

## [Applying affine transform to label image in ITK](https://discourse.itk.org/t/applying-affine-transform-to-label-image-in-itk/3130)

<div class="topic-metadata">

**Author:** [@EE18D504\_SINDHURA\_C](https://discourse.itk.org/u/EE18D504_SINDHURA_C)\
**Replies:** 1\
**Last updated:** [May 29, 2020, 7:51pm UTC](https://discourse.itk.org/t/applying-affine-transform-to-label-image-in-itk/3130 "2020-05-29T19:51:51Z")

</div>

I did affine transformation between Moving and Fixed images. My moving image has label image too. After finding the transformation, I want to apply it to the label image of moving image and get the label for fixed image. …

---

## [Problems with Registration Fusion](https://discourse.itk.org/t/problems-with-registration-fusion/3118)

<div class="topic-metadata">

**Author:** [@Luis\_Carlos\_Carneiro](https://discourse.itk.org/u/Luis_Carlos_Carneiro)\
**Replies:** 7\
**Last updated:** [May 29, 2020, 12:08pm UTC](https://discourse.itk.org/t/problems-with-registration-fusion/3118 "2020-05-29T12:08:42Z")

</div>

Dear All, I am using the following example for my own purposes: http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python\_html/60\_Registration\_Introduction.html Below is an excerpt of the manual of ITK say…

---

## [Detecting planes in binary images](https://discourse.itk.org/t/detecting-planes-in-binary-images/3115)

<div class="topic-metadata">

**Author:** [@alkamid](https://discourse.itk.org/u/alkamid)\
**Replies:** 3\
**Last updated:** [May 26, 2020, 3:20pm UTC](https://discourse.itk.org/t/detecting-planes-in-binary-images/3115 "2020-05-26T15:20:04Z")

</div>

I’m trying to detect certain type of artifacts in binary volumes I’m working with, namely step-like transitions between 0 and 1, but only in the three orthogonal planes XY/XZ/YZ. Example: The surface is generally roug…

---

## [Problem while resizing an image](https://discourse.itk.org/t/problem-while-resizing-an-image/3104)

<div class="topic-metadata">

**Author:** [@Felippe\_Trigueiro\_An](https://discourse.itk.org/u/Felippe_Trigueiro_An)\
**Replies:** 3\
**Last updated:** [May 25, 2020, 10:32pm UTC](https://discourse.itk.org/t/problem-while-resizing-an-image/3104 "2020-05-25T22:32:07Z")

</div>

Hi, I have two volumes with different size Fixed(240, 240, 180) and Moving(182, 218, 182), and registering them I apply a resizing with the function resample(). But when I visualize the images with an overlay of them, th…

---

## [Jacobian of B-spline coefficients](https://discourse.itk.org/t/jacobian-of-b-spline-coefficients/3070)

<div class="topic-metadata">

**Author:** [@rijobro](https://discourse.itk.org/u/rijobro)\
**Replies:** 2\
**Last updated:** [May 15, 2020, 12:55pm UTC](https://discourse.itk.org/t/jacobian-of-b-spline-coefficients/3070 "2020-05-15T12:55:35Z")

</div>

For a motion-estimation algorithm, we’d like to be able to calculate the Jacboian of b-spline coefficients. Alternatively (and less computationally expensive), we’d like to be able to apply this Jacboian onto a pre-exist…

---

## [Problem creating a mesh](https://discourse.itk.org/t/problem-creating-a-mesh/3046)

<div class="topic-metadata">

**Author:** [@Elli](https://discourse.itk.org/u/Elli)\
**Replies:** 2\
**Last updated:** [May 9, 2020, 4:37am UTC](https://discourse.itk.org/t/problem-creating-a-mesh/3046 "2020-05-09T04:37:51Z")

</div>

Dear all, I have a problem creating a mesh. I have a binary mask containing two (or more) VOIs. I split it up in the different VOIs using the connected component filter and create for each VOI a mesh (see code below). …

---

## [Registration method for two images with different origin and spacing](https://discourse.itk.org/t/registration-method-for-two-images-with-different-origin-and-spacing/3047)

<div class="topic-metadata">

**Author:** [@EE18D504\_SINDHURA\_C](https://discourse.itk.org/u/EE18D504_SINDHURA_C)\
**Replies:** 3\
**Last updated:** [May 9, 2020, 3:50am UTC](https://discourse.itk.org/t/registration-method-for-two-images-with-different-origin-and-spacing/3047 "2020-05-09T03:50:18Z")

</div>

I have an image with slices of 5mm thickness and I want to use deformable registration to register it with an image of 1mm thickness slices. Also, the origin is different for both the images. Is there any method to over…

---

## [How to fill the big holes for further processing of having a Riemannian surface?](https://discourse.itk.org/t/how-to-fill-the-big-holes-for-further-processing-of-having-a-riemannian-surface/2885)

<div class="topic-metadata">

**Author:** [@Sara\_Caffe](https://discourse.itk.org/u/Sara_Caffe)\
**Replies:** 15\
**Last updated:** [April 21, 2020, 1:39am UTC](https://discourse.itk.org/t/how-to-fill-the-big-holes-for-further-processing-of-having-a-riemannian-surface/2885 "2020-04-21T01:39:42Z")

</div>

Hi, I am facing an issue for creating the SimplexMesh from the TriangleMesh. It seems the surface does not have Riemannian geometry. I filled the holes by the following commands typedef itk::BinaryFillholeImageFilter\<I…

---

## [Find cylinder-like sub-regions of a geometric surface or mesh](https://discourse.itk.org/t/find-cylinder-like-sub-regions-of-a-geometric-surface-or-mesh/2956)

<div class="topic-metadata">

**Author:** [@dlrdave](https://discourse.itk.org/u/dlrdave)\
**Replies:** 4\
**Last updated:** [April 17, 2020, 1:39pm UTC](https://discourse.itk.org/t/find-cylinder-like-sub-regions-of-a-geometric-surface-or-mesh/2956 "2020-04-17T13:39:02Z")

</div>

We are creating iso-surfaces, from CT scan data, using thresholds to get regions of higher intensity value and using a connected components filter to split the result into multiple sub-regions. Within these sub-regions,…

---

## [resampling](https://discourse.itk.org/t/resampling/2954)

<div class="topic-metadata">

**Author:** [@Dodox](https://discourse.itk.org/u/Dodox)\
**Replies:** 5\
**Last updated:** [April 16, 2020, 3:38pm UTC](https://discourse.itk.org/t/resampling/2954 "2020-04-16T15:38:45Z")

</div>

hello every one , sorry for my english, i have a question about this part of code (you can find here the complete code ) def resample(image, transform): reference\_image = image interpolator = sitk.sitkCosineWindowedS…

---

## [Calculation of spatial frequency](https://discourse.itk.org/t/calculation-of-spatial-frequency/2874)

<div class="topic-metadata">

**Author:** [@drcjaudet](https://discourse.itk.org/u/drcjaudet)\
**Replies:** 5\
**Last updated:** [March 27, 2020, 4:43pm UTC](https://discourse.itk.org/t/calculation-of-spatial-frequency/2874 "2020-03-27T16:43:18Z")

</div>

Hello ITK, i want to compute “spatial frequency” for wavelet. In these publication (DOI: 10.17694/bajece.24838,H. Boztoprak ) they define it as: with M, N the voxel indice and F his value. So i create a code like th…

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

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