Skip to content

Commit

Permalink
ENH: Hierarchical approach to 3d registration
Browse files Browse the repository at this point in the history
  • Loading branch information
NicerNewerCar committed May 30, 2024
1 parent 1667e43 commit c4bbdf4
Show file tree
Hide file tree
Showing 10 changed files with 822 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(EXTENSION_CONTRIBUTORS "Anthony Lombardi (Kitware), Amy Morton (Brown Univer
set(EXTENSION_DESCRIPTION "SlicerAutoscoperM is an extension for 3D Slicer for 2D-3D image registration integrating with Autoscoper for image-based 3D motion tracking of skeletal structures.")
set(EXTENSION_ICONURL "https://raw.githubusercontent.com/BrownBiomechanics/SlicerAutoscoperM/main/SlicerAutoscoperM.png")
set(EXTENSION_SCREENSHOTURLS "https://github.com/BrownBiomechanics/SlicerAutoscoperM/releases/download/docs-resources/AutoscoperMainWindow.png")
set(EXTENSION_DEPENDS Sandbox SegmentEditorExtraEffects)
set(EXTENSION_DEPENDS Sandbox SegmentEditorExtraEffects SlicerElastix)
set(EXTENSION_BUILD_SUBDIRECTORY inner-build)

set(SUPERBUILD_TOPLEVEL_PROJECT inner)
Expand Down Expand Up @@ -44,6 +44,7 @@ add_subdirectory(AutoscoperM)
add_subdirectory(TrackingEvaluation)
add_subdirectory(CalculateDataIntensityDensity)
add_subdirectory(VirtualRadiographGeneration)
add_subdirectory(Tracking3D)
## NEXT_MODULE

#-----------------------------------------------------------------------------
Expand Down
34 changes: 34 additions & 0 deletions Tracking3D/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#-----------------------------------------------------------------------------
set(MODULE_NAME Tracking3D)

#-----------------------------------------------------------------------------
set(MODULE_PYTHON_SCRIPTS
${MODULE_NAME}.py
${MODULE_NAME}Lib/__init__.py
${MODULE_NAME}Lib/TreeNode.py
)

set(MODULE_PYTHON_RESOURCES
Resources/Icons/${MODULE_NAME}.png
Resources/UI/${MODULE_NAME}.ui
Resources/ParameterFiles/rigid.txt
)

#-----------------------------------------------------------------------------
slicerMacroBuildScriptedModule(
NAME ${MODULE_NAME}
SCRIPTS ${MODULE_PYTHON_SCRIPTS}
RESOURCES ${MODULE_PYTHON_RESOURCES}
WITH_GENERIC_TESTS
)

#-----------------------------------------------------------------------------
if(BUILD_TESTING)

# Register the unittest subclass in the main script as a ctest.
# Note that the test will also be available at runtime.
slicer_add_python_unittest(SCRIPT ${MODULE_NAME}.py)

# Additional build-time testing
add_subdirectory(Testing)
endif()
Binary file added Tracking3D/Resources/Icons/Tracking3D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions Tracking3D/Resources/ParameterFiles/rigid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
(FixedInternalImagePixelType "float")
(MovingInternalImagePixelType "float")

// **************** Main Components **************************

(Registration "MultiResolutionRegistration")
(Interpolator "BSplineInterpolator")
(ResampleInterpolator "FinalBSplineInterpolator")
(Resampler "DefaultResampler")
(FixedImagePyramid "FixedSmoothingImagePyramid")
(MovingImagePyramid "MovingSmoothingImagePyramid")

(Optimizer "AdaptiveStochasticGradientDescent")
(Transform "EulerTransform")
(Metric "AdvancedMattesMutualInformation")

// ***************** Transformation **************************

(AutomaticScalesEstimation "true")
(AutomaticTransformInitialization "true")
(HowToCombineTransforms "Compose")

//Save composite ITK transform
(ITKTransformOutputFileNameExtension "h5")
(WriteITKCompositeTransform "true")

// ******************* Similarity measure *********************

(NumberOfHistogramBins 64)
(ErodeMask "false")

// ******************** Multiresolution **********************

(NumberOfResolutions 3)
(ImagePyramidSchedule 8 8 2 4 4 1 1 1 1 )

// ******************* Optimizer ****************************

(MaximumNumberOfIterations 1000)
(MaximumStepLength 6.0)
(RequiredRatioOfValidSamples 0.01)

// **************** Image sampling **********************

(NumberOfSpatialSamples 2000)
(NewSamplesEveryIteration "true")
(ImageSampler "Random")

// ************* Interpolation and Resampling ****************

(BSplineInterpolationOrder 1)
(FinalBSplineInterpolationOrder 3)

(DefaultPixelValue 0)
(WriteResultImage "true")
(ResultImagePixelType "short")
(ResultImageFormat "mhd")

222 changes: 222 additions & 0 deletions Tracking3D/Resources/UI/Tracking3D.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Tracking3D</class>
<widget class="qMRMLWidget" name="Tracking3D">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>785</width>
<height>561</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="ctkCollapsibleButton" name="inputsCollapsibleButton">
<property name="text">
<string>Registration</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Hierarchy:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Input CT Sequence:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Initial Guess (Transform):</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="qMRMLSubjectHierarchyComboBox" name="SubjectHierarchyComboBox">
<property name="includeItemAttributeNamesFilter">
<stringlist notr="true"/>
</property>
<property name="includeNodeAttributeNamesFilter">
<stringlist notr="true"/>
</property>
<property name="excludeItemAttributeNamesFilter">
<stringlist notr="true"/>
</property>
<property name="excludeNodeAttributeNamesFilter">
<stringlist notr="true"/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="qMRMLNodeComboBox" name="inputSelectorInitGuessTFM">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Pick the input to the algorithm.</string>
</property>
<property name="nodeTypes">
<stringlist notr="true">
<string>vtkMRMLTransformNode</string>
</stringlist>
</property>
<property name="showChildNodeTypes">
<bool>true</bool>
</property>
<property name="addEnabled">
<bool>false</bool>
</property>
<property name="removeEnabled">
<bool>false</bool>
</property>
<property name="SlicerParameterName" stdset="0">
<string>initialGuessTFM</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="qMRMLNodeComboBox" name="inputSelectorCT">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Pick the input to the algorithm.</string>
</property>
<property name="nodeTypes">
<stringlist notr="true">
<string>vtkMRMLScalarVolumeNode</string>
</stringlist>
</property>
<property name="showChildNodeTypes">
<bool>false</bool>
</property>
<property name="addEnabled">
<bool>false</bool>
</property>
<property name="removeEnabled">
<bool>false</bool>
</property>
<property name="SlicerParameterName" stdset="0">
<string>inputVolumeSequence</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="applyButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Run the algorithm.</string>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>qMRMLNodeComboBox</class>
<extends>QWidget</extends>
<header>qMRMLNodeComboBox.h</header>
</customwidget>
<customwidget>
<class>qMRMLWidget</class>
<extends>QWidget</extends>
<header>qMRMLWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>qMRMLSubjectHierarchyComboBox</class>
<extends>ctkComboBox</extends>
<header>qMRMLSubjectHierarchyComboBox.h</header>
</customwidget>
<customwidget>
<class>ctkCollapsibleButton</class>
<extends>QWidget</extends>
<header>ctkCollapsibleButton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ctkComboBox</class>
<extends>QComboBox</extends>
<header>ctkComboBox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>Tracking3D</sender>
<signal>mrmlSceneChanged(vtkMRMLScene*)</signal>
<receiver>inputSelectorCT</receiver>
<slot>setMRMLScene(vtkMRMLScene*)</slot>
<hints>
<hint type="sourcelabel">
<x>392</x>
<y>280</y>
</hint>
<hint type="destinationlabel">
<x>468</x>
<y>89</y>
</hint>
</hints>
</connection>
<connection>
<sender>Tracking3D</sender>
<signal>mrmlSceneChanged(vtkMRMLScene*)</signal>
<receiver>inputSelectorInitGuessTFM</receiver>
<slot>setMRMLScene(vtkMRMLScene*)</slot>
<hints>
<hint type="sourcelabel">
<x>392</x>
<y>280</y>
</hint>
<hint type="destinationlabel">
<x>468</x>
<y>118</y>
</hint>
</hints>
</connection>
<connection>
<sender>Tracking3D</sender>
<signal>mrmlSceneChanged(vtkMRMLScene*)</signal>
<receiver>SubjectHierarchyComboBox</receiver>
<slot>setMRMLScene(vtkMRMLScene*)</slot>
<hints>
<hint type="sourcelabel">
<x>392</x>
<y>280</y>
</hint>
<hint type="destinationlabel">
<x>392</x>
<y>412</y>
</hint>
</hints>
</connection>
</connections>
</ui>
1 change: 1 addition & 0 deletions Tracking3D/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(Python)
2 changes: 2 additions & 0 deletions Tracking3D/Testing/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

#slicer_add_python_unittest(SCRIPT ${MODULE_NAME}ModuleTest.py)
Loading

0 comments on commit c4bbdf4

Please sign in to comment.