SlicerRt / SlicerRT

Open-source toolkit for radiation therapy research, an extension of 3D Slicer. Features include DICOM-RT import/export, dose volume histogram, dose accumulation, external beam planning (TPS), structure comparison and morphology, isodose line/surface generation, etc.
https://slicerrt.org
127 stars 60 forks source link

ENH: Initial RTIonPlan and multiple control points support #124

Closed MichaelColonel closed 4 years ago

MichaelColonel commented 4 years ago

Greetings,

vtkSlicerDicomRtReader class - RTIonPlan support and control points support, some C-like arrays replaced with std::array for easier copy and assign operations. Scan spot position map inital support for modulated scan type of rt ion beam. Fraction module from DICOM is used to check if beams are available.

vtkSlicerDicomRtImportExportModuleLogic class - each control point is represented as a separate beam. Table nodes are set a children of a corresponding beam nodes.

vtkMRMLRTIonBeamNode class is added for ion beam parameters and visualization.

vtkMRMLRTBeamNode multiple visible sections of MLC opening have been added (corvus-6.2.2-phantom example data control point 10 & 11)

I can split this pull request on several parts if its very big.

MichaelColonel commented 4 years ago

Squashed to 6 commits.

cpinter commented 4 years ago

Thank you very much! I'll take a look shortly and integrate. Please let me know about the automated tests.

MichaelColonel commented 4 years ago

23 failed out of 70

 12 - py_DicomRtImportTest (Failed)
 18 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseProstate_Base (Failed)
 19 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseProstate_CERR (Failed)
 20 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseEnt_CERR (Failed)
 21 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseProstate_Eclipse (Failed)
 22 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseEnt_Eclipse (Failed)
 23 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseProstate_CERR_AutomaticOversampling (Failed)
 24 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseEnt_CERR_AutomaticOversampling (Failed)
 25 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseProstate_Eclipse_AutomaticOversampling (Failed)
 26 - vtkSlicerDoseVolumeHistogramModuleLogicTest_EclipseEnt_Eclipse_AutomaticOversampling (Failed)
 27 - vtkSlicerDoseVolumeHistogramModuleLogicTest_DoseSurfaceHistogram_EclipseEnt_Base_Inside (Failed)
 28 - vtkSlicerDoseVolumeHistogramModuleLogicTest_DoseSurfaceHistogram_EclipseEnt_Base_Outside (Failed)
 29 - vtkSlicerDoseVolumeHistogramModuleLogicTest_DoseSurfaceHistogram_EclipseProstate_Base_Inside (Failed)
 30 - vtkSlicerDoseVolumeHistogramModuleLogicTest_DoseSurfaceHistogram_EclipseProstate_Base_Outside (Failed)
 37 - vtkSlicerSegmentMorphologyModuleLogicTest_EclipseProstate_Expand (Failed)
 38 - vtkSlicerSegmentMorphologyModuleLogicTest_EclipseProstate_Shrink (Failed)
 39 - vtkSlicerSegmentMorphologyModuleLogicTest_EclipseProstate_Union (Failed)
 40 - vtkSlicerSegmentMorphologyModuleLogicTest_EclipseProstate_Intersect (Failed)
 41 - vtkSlicerSegmentMorphologyModuleLogicTest_EclipseProstate_Subtract (Failed)
 42 - vtkSlicerSegmentMorphologyModuleLogicTest_EclipseProstate_Intersect_ApplyTransform (Failed)
 45 - vtkSlicerSegmentComparisonModuleLogicTest_EclipseProstate_Base (Failed)
 46 - vtkSlicerSegmentComparisonModuleLogicTest_EclipseProstate_SameInput (Failed)
 47 - vtkSlicerSegmentComparisonModuleLogicTest_EclipseProstate_Transformed (Failed)
MichaelColonel commented 4 years ago

Offtopic question. If i have been needed a MLC visualization like in XiO, should i create a custom node for MLC model, or i could use a beam node?

From this post

cpinter commented 4 years ago

23 failed out of 70

Well, those will need to be fixed. I see that these failures are the same as what SlicerRT has had since the end of October. It would be great if the tests could be fixed by the developer team so that you can (after a rebase) see if your changes have broken anything or not. I added a ticket for this (https://github.com/SlicerRt/SlicerRT/issues/125) and contacted the team about it. Please stand by for a bit until we see if you can rebase and try it again soon.

cpinter commented 4 years ago

About the XiO question: Is this visualization in the 3D view? If so, then special overlay would be needed to achive the same, which will require substantial work. However, you may not need it in the 3D view, in which case it is a simple slice intersection, which could already work with your changes. Thoughts @gregsharp @lassoan ?

MichaelColonel commented 4 years ago

The picture (part of it) is taken from SlicerRtData.

lassoan commented 4 years ago

About the XiO question: Is this visualization in the 3D view? If so, then special overlay would be needed to achive the same, which will require substantial work. However, you may not need it in the 3D view, in which case it is a simple slice intersection, which could already work with your changes. Thoughts @gregsharp @lassoan ?

Since it is a beam's eye view, the camera position, orientation, and viewing angle has match the beam parameters and cannot be rotated. Since the camera cannot be rotated and viewing angle cannot be changed, it does not matter if you display the grid as a 2D or 3D actor. In 3D views it is very easy to display 3D (using model nodes), so I would just go with that. If you create a model that contains projection of the collimator leaves (their shadow) then you can use the exact same model in 2D views (as slice intersection) and in 3D view. Another advantage of this approach is that if for some reason the camera gets rotated or any way misaligned with the beam's eye view, it will still be correct (but you'll see 3D beams and not just a 2D grid). In beam's eye 3D views you can choose to disable camera rotation similarly to how it is done for slice views here.

cpinter commented 4 years ago

@MichaelColonel The problem that made most of the tests fail has been fixed by @Sunderlandkyl, and the dashboard shows only one failing test. So I think if you can build this branch against the latest Slicer and only the same tests fails (py_DicomRtImportTest, which tests importing/loading DICOM but not ion plan obviously - it may be added to it though), then I'll integrate this. Thanks again!

MichaelColonel commented 4 years ago

All tests have passed except py_DicomRtImportTest. It failed because number of loaded beam nodes, and total number of nodes in hierarchy had increased (each control point is a separated beam node).

After some minor changes:

  1. self.assertEqual( len( slicer.util.getNodes('vtkMRMLModelHierarchyNode*') ), 11 )
  2. self.assertEqual( shNode.GetNumberOfItems(), 42 )

it also passed.

These changes are not in pull request.

cpinter commented 4 years ago

@MichaelColonel you are great :) Now that the tests pass, I'll integrate this change, but not before you give me the green light, because I have seen pushes recently, and not sure if you want to add more improvements.

I'll make the changes in py_DicomRtImportTest and close the related ticket. Thanks again!

MichaelColonel commented 4 years ago

The pull request is ready to be merged, latest pushes were minor API style changes - GetBeamControlPoint instead of GetControlPoint.