Skip to content

Commit

Permalink
ENH: MIP python test is added
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Polkovnikov committed Mar 1, 2024
1 parent 177cdf0 commit d7e3e5a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,5 @@ rtk_add_test(rtkBioscanTest rtkbioscantest.cxx

if(ITK_WRAP_PYTHON)
itk_python_add_test(NAME rtkFirstReconstructionPythonTest COMMAND rtkFirstReconstruction.py ${CMAKE_CURRENT_BINARY_DIR}/rtkFirstReconstruction.mha)
itk_python_add_test(NAME rtkMaximumIntensityPythonTest COMMAND rtkMaximumIntensity.py)
endif()
40 changes: 40 additions & 0 deletions test/rtkMaximumIntensity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python
from __future__ import print_function
import itk
from itk import RTK as rtk
import sys
import os

TImageType = itk.Image[itk.F,3]
# Defines the RTK geometry object
geometry = rtk.ThreeDCircularProjectionGeometry.New()
numberOfProjections = 1
geometry.AddProjection(700, 800, 0)
# Constant image sources
# Create MIP Forward Projector volume
volInput = rtk.ConstantImageSource[TImageType].New()
origin = [ 0., 0., 0. ]
size = [ 64, 64, 64 ]
sizeOutput = [ 200, 200, numberOfProjections ]
spacing = [ 4.0, 4.0, 4.0 ]
spacingOutput = [ 1.0, 1.0, 1.0 ]
volInput.SetOrigin( origin )
volInput.SetSpacing( spacing )
volInput.SetSize( size )
volInput.SetConstant(1.0)
volInput.UpdateOutputInformation()
volInputSource = volInput.GetOutput()
# Initialization Imager volume
projInput = rtk.ConstantImageSource[TImageType].New()
projInput.SetOrigin( origin )
projInput.SetSpacing( spacingOutput )
projInput.SetSize( sizeOutput )
projInput.SetConstant(0.)
projInput.Update()
projInputSource = projInput.GetOutput()
# MIP Forward Projection filter
mip = rtk.MaximumIntensityProjectionImageFilter[TImageType, TImageType].New()
mip.SetGeometry( geometry )
mip.SetInput(volInputSource)
mip.SetInput(1, projInputSource)
mipImage = mip.GetOutput()

0 comments on commit d7e3e5a

Please sign in to comment.