diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..923763d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.16.3...3.19.7 FATAL_ERROR) + +project(SlicerBoneMorphing) + +#----------------------------------------------------------------------------- +# Extension meta-information +set(EXTENSION_HOMEPAGE "https://www.slicer.org/wiki/Documentation/Nightly/Extensions/SlicerBoneMorphing") +set(EXTENSION_CATEGORY "Examples") +set(EXTENSION_CONTRIBUTORS "Jan Heres (West Bohemian University)") +set(EXTENSION_DESCRIPTION "This extensions allows the user to generate and morph bone meshes based on its CT scans") +set(EXTENSION_ICONURL "https://www.example.com/Slicer/Extensions/SlicerBoneMorphing.png") +set(EXTENSION_SCREENSHOTURLS "https://www.example.com/Slicer/Extensions/SlicerBoneMorphing/Screenshots/1.png") +set(EXTENSION_DEPENDS "NA") # Specified as a list or "NA" if no dependencies + +#----------------------------------------------------------------------------- +# Extension dependencies +find_package(Slicer REQUIRED) +include(${Slicer_USE_FILE}) + +#----------------------------------------------------------------------------- +# Extension modules +add_subdirectory(SlicerBoneMorphing) +## NEXT_MODULE + +#----------------------------------------------------------------------------- +include(${Slicer_EXTENSION_GENERATE_CONFIG}) +include(${Slicer_EXTENSION_CPACK}) diff --git a/SlicerBoneMorphing.png b/SlicerBoneMorphing.png new file mode 100644 index 0000000..6aae6ab Binary files /dev/null and b/SlicerBoneMorphing.png differ diff --git a/SlicerBoneMorphing/CMakeLists.txt b/SlicerBoneMorphing/CMakeLists.txt new file mode 100644 index 0000000..61c8164 --- /dev/null +++ b/SlicerBoneMorphing/CMakeLists.txt @@ -0,0 +1,31 @@ +#----------------------------------------------------------------------------- +set(MODULE_NAME SlicerBoneMorphing) + +#----------------------------------------------------------------------------- +set(MODULE_PYTHON_SCRIPTS + ${MODULE_NAME}.py + ) + +set(MODULE_PYTHON_RESOURCES + Resources/Icons/${MODULE_NAME}.png + Resources/UI/${MODULE_NAME}.ui + ) + +#----------------------------------------------------------------------------- +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() diff --git a/SlicerBoneMorphing/Resources/Icons/SlicerBoneMorhping.png b/SlicerBoneMorphing/Resources/Icons/SlicerBoneMorhping.png new file mode 100644 index 0000000..5d83ab4 Binary files /dev/null and b/SlicerBoneMorphing/Resources/Icons/SlicerBoneMorhping.png differ diff --git a/SlicerBoneMorphing/Resources/UI/SlicerBoneMorphing.ui b/SlicerBoneMorphing/Resources/UI/SlicerBoneMorphing.ui new file mode 100644 index 0000000..385ad94 --- /dev/null +++ b/SlicerBoneMorphing/Resources/UI/SlicerBoneMorphing.ui @@ -0,0 +1,280 @@ + + + UI + + + + 0 + 0 + 279 + 286 + + + + + + + Inputs + + + + + + Input volume: + + + + + + + Pick the input to the algorithm. + + + + vtkMRMLScalarVolumeNode + + + + false + + + false + + + false + + + + + + + Image threshold: + + + + + + + Set threshold value for computing the output image. Voxels that have intensities lower than this value will set to zero. + + + 0.100000000000000 + + + -100.000000000000000 + + + 500.000000000000000 + + + 0.500000000000000 + + + + + + + + + + Outputs + + + + + + Thresholded volume: + + + + + + + Pick the output to the algorithm. + + + + vtkMRMLScalarVolumeNode + + + + false + + + true + + + true + + + true + + + + + + + Inverted volume: + + + + + + + Result with inverted threshold will be written into this volume + + + + vtkMRMLScalarVolumeNode + + + + false + + + true + + + true + + + true + + + + + + + + + + Advanced + + + true + + + + + + Invert threshold: + + + + + + + If checked, values above threshold are set to 0. If unchecked, values below are set to 0. + + + + + + + + + + + + + false + + + Run the algorithm. + + + Apply + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + ctkCollapsibleButton + QWidget +
ctkCollapsibleButton.h
+ 1 +
+ + ctkSliderWidget + QWidget +
ctkSliderWidget.h
+
+ + qMRMLNodeComboBox + QWidget +
qMRMLNodeComboBox.h
+
+ + qMRMLWidget + QWidget +
qMRMLWidget.h
+ 1 +
+
+ + + + UI + mrmlSceneChanged(vtkMRMLScene*) + inputSelector + setMRMLScene(vtkMRMLScene*) + + + 122 + 132 + + + 248 + 61 + + + + + UI + mrmlSceneChanged(vtkMRMLScene*) + outputSelector + setMRMLScene(vtkMRMLScene*) + + + 82 + 135 + + + 220 + 161 + + + + + UI + mrmlSceneChanged(vtkMRMLScene*) + invertedOutputSelector + setMRMLScene(vtkMRMLScene*) + + + 161 + 8 + + + 173 + 176 + + + + +
diff --git a/SlicerBoneMorphing/SlicerBoneMorphing.py b/SlicerBoneMorphing/SlicerBoneMorphing.py new file mode 100644 index 0000000..9b0cc67 --- /dev/null +++ b/SlicerBoneMorphing/SlicerBoneMorphing.py @@ -0,0 +1,21 @@ +from slicer.ScriptedLoadableModule import ScriptedLoadableModule + +from src.main import * + +class SlicerBoneMorphing(ScriptedLoadableModule): + """Uses ScriptedLoadableModule base class, available at: + https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py + """ + + def __init__(self, parent): + ScriptedLoadableModule.__init__(self, parent) + self.parent.title = "Slicer Bone Mesh Module" + self.parent.categories = ["Examples"] + self.parent.dependencies = [] + self.parent.contributors = ["Jan Heres"] + self.parent.helpText = """ + This is a testing module help text. + """ + self.parent.acknowledgementText = """ + Credits: Jan Heres + """ diff --git a/SlicerBoneMorphing/Testing/CMakeLists.txt b/SlicerBoneMorphing/Testing/CMakeLists.txt new file mode 100644 index 0000000..655007a --- /dev/null +++ b/SlicerBoneMorphing/Testing/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(Python) diff --git a/SlicerBoneMorphing/Testing/Python/CMakeLists.txt b/SlicerBoneMorphing/Testing/Python/CMakeLists.txt new file mode 100644 index 0000000..5658d8b --- /dev/null +++ b/SlicerBoneMorphing/Testing/Python/CMakeLists.txt @@ -0,0 +1,2 @@ + +#slicer_add_python_unittest(SCRIPT ${MODULE_NAME}ModuleTest.py) diff --git a/SlicerBoneMorphing/src/CMakeLists.txt b/SlicerBoneMorphing/src/CMakeLists.txt new file mode 100644 index 0000000..1fc302d --- /dev/null +++ b/SlicerBoneMorphing/src/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(logic) +add_subdirectory(widget) diff --git a/SlicerBoneMorphing/src/logic/SlicerBoneMorphingLogic.py b/SlicerBoneMorphing/src/logic/SlicerBoneMorphingLogic.py new file mode 100644 index 0000000..f05d2d9 --- /dev/null +++ b/SlicerBoneMorphing/src/logic/SlicerBoneMorphingLogic.py @@ -0,0 +1,12 @@ +from slicer.ScriptedLoadableModule import ScriptedLoadableModuleLogic + + +class SlicerBoneMorphingLogic(ScriptedLoadableModuleLogic): + """This class should implement all the actual + computation done by your module. The interface + should be such that other python code can import + this class and make use of the functionality without + requiring an instance of the Widget. + Uses ScriptedLoadableModuleLogic base class, available at: + https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py + """ diff --git a/SlicerBoneMorphing/src/main.py b/SlicerBoneMorphing/src/main.py new file mode 100644 index 0000000..dcf7433 --- /dev/null +++ b/SlicerBoneMorphing/src/main.py @@ -0,0 +1,2 @@ +from .widget.SlicerBoneMorphingWidget import SlicerBoneMorphingWidget +from .logic.SlicerBoneMorphingLogic import SlicerBoneMorphingLogic diff --git a/SlicerBoneMorphing/src/widget/SlicerBoneMorphingWidget.py b/SlicerBoneMorphing/src/widget/SlicerBoneMorphingWidget.py new file mode 100644 index 0000000..a0d41ca --- /dev/null +++ b/SlicerBoneMorphing/src/widget/SlicerBoneMorphingWidget.py @@ -0,0 +1,14 @@ +from slicer.ScriptedLoadableModule import ScriptedLoadableModuleWidget +from __main__ import ctk + +class SlicerBoneMorphingWidget(ScriptedLoadableModuleWidget): + """Uses ScriptedLoadableModuleWidget base class, available at: + https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py + """ + + def setup(self): + ScriptedLoadableModuleWidget.setup(self) + + parametersCollapsibleButton = ctk.ctkCollapsibleButton() + parametersCollapsibleButton.text = "Parameters" + self.layout.addWidget(parametersCollapsibleButton)