Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Initial support of the arc beam sequence #215

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

MichaelColonel
Copy link
Collaborator

A simple arc beam generator is added to Beam section of External Beam Planning module

By clicking on the "Arc beam sequence" toggle button, the arc beam sequence will be added instead of simple static beam.
image

@cpinter
Copy link
Member

cpinter commented Aug 8, 2022

Another really great contribution!

Can you please squash the commits, at least those that have the same message?

Also it would be useful if you gave more information about how the created sequence is to be used, and in general some documentation about this feature. As detailed as it seems reasonable. Since we don't have anything better yet, please edit this page: https://www.slicer.org/wiki/Documentation/Nightly/Modules/ExternalBeamPlanning

Thank you!

Copy link
Member

@cpinter cpinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as well; all I can do now is a quick read-through. I have found some things to change. Thank you!

@Sunderlandkyl @lassoan


vtkMRMLScene* scene = planNode->GetScene();

vtkMRMLSubjectHierarchyNode* shNode = vtkMRMLSubjectHierarchyNode::GetSubjectHierarchyNode(scene);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scene->GetSubjectHierarchyNode() instead please

// SAD for RTPlan, source to beam limiting devices (Jaws, MLC)
if (beamNode)
{
// beamNode->SetSAD(rtReader->GetBeamSourceAxisDistance(dicomBeamNumber));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these commented out? If you want to keep them there please add a TODO

@@ -60,6 +62,20 @@ class VTK_SLICER_BEAMS_LOGIC_EXPORT vtkSlicerBeamsModuleLogic :
void UpdateTransformForBeam( vtkMRMLScene* beamSequenceScene, vtkMRMLRTBeamNode* beamNode,
vtkMRMLLinearTransformNode* beamTransformNode, double isocenter[3]);

/// Create arc delivery beam sequence
/// @param initialAngle - initial angle in degrees
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the docstring convention that is used everywhere in Slicer and do not introduce another one. Not just here but everywhere and in the other PR as well please.

@@ -317,7 +319,7 @@ class vtkSlicerDicomRtReader::vtkInternal
std::string InstitutionalDepartmentName;
std::string ManufacturerModelName;
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary spaces

proxyBeamNode->SetAndObserveTransformNodeID(proxyTransformNode->GetID());
return proxyBeamNode;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should report an error if creation failed?

@lassoan
Copy link
Member

lassoan commented Aug 8, 2022

Since we don't have anything better yet, please edit this page: https://www.slicer.org/wiki/Documentation/Nightly/Modules/ExternalBeamPlanning

The old Slicer MediaWiki site will be retired (made read-only) at some point. We recommend extensions to store documentation in their repository. We don't need to immediately move the existing documentation, but it would make sense to add new documentation to this repository (a common pattern is to add a Docs subfolder and within this folder add a .md file for each module).

@MichaelColonel
Copy link
Collaborator Author

Initial arc-beam commits were squashed.

Module file description was added

Michael Colonel and others added 19 commits August 10, 2022 16:21
In VTK <= 8.2, unused points weren't used in bounds calculation, while they are used in VTK >= 9.0. This caused issues with the creation of the end cap contour, since the image extent was incorrect. Fixed by removing unused points.

Fixes a number of failing DVH tests.
Fix crash that is caused by the fact that ApplicationLogic is not set for generic tests. The "CopyNode" function is static, so the issue was fixed by using the method statically.
Fix crash by checking if beamsLogic exists before accessing.
The test data was no longer available since "slicer.kitware.com/midas3" was retired in August 2021. Fixed by pointing the URL to the raw files in SlicerRTData.
On Windows, CLI build directories were not added to the list of additional module directories. This resulted in missing CLI modules, causing qSlicerDrrImageComputationModuleGenericTest to fail.
The default source-axis distance and aperture distance was invalid for proton dose calculation.
Fixed by changing the SAD back to the original default.
The isodose surface generated with VTK9 is slightly different around the holes in the bottom of the mesh. This causes a small volume difference between the baseline and generated surface. The surface is the same in all other areas, so there doesn't seem to be an issue. Fixed by updating the baseline.
Due to updates in VTK, TextActorAnchors needs to be initialized in LayoutTicks to not cause a crash.
Update Plastimatch to replace std::auto_ptr with std::unique_ptr.
Change use of std::not1 and std::ptr_fun to use a lambda function instead.

Fix SlicerRt#212
Update plastimatch to remove dynamic exception compile errors.

Re SlicerRt#213
Update plastimatch to remove register storage specifier.

Re SlicerRt#213
1. Logic debug information was removed
2. ExternalBeamPlanning module description file was created
Copy link
Member

@cpinter cpinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more things

// SAD for RTPlan, source to beam limiting devices (Jaws, MLC)
if (beamNode)
{
// TODO: Add beam parameters for each angle step
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be great to add an issue on GitHub for this and explain it in more detail.

// Add beam to beam sequence node
if (beamNode)
{
beamSequenceNode->SetDataNodeAtValue( beamNode, std::to_string(controlPointIndex));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it some new convention that there is a space after the opening parentheses but none before the closing one? If there is on good reason for this please use the style that is used everywhere else in SlicerRT.

@@ -1383,7 +1390,7 @@ void vtkPlanarContourToClosedSurfaceConversionRule::CreateSmoothEndCapContour(vt
static_cast<int>(std::ceil((bounds[3] - bounds[2]) / spacing[1])),
1 };
double origin[3] = { bounds[0], bounds[2], bounds[4] };
int extent[6] = { 0, dimensions[0] - 1, 0, dimensions[1] - 1, 0, 0 };
int extent[6] = { 0, dimensions[0] - 1, 0, dimensions[1] - 1, 0, dimensions[2] - 1 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change fix?

@@ -94,6 +95,15 @@ class VTK_SLICER_DICOMRTIMPORTEXPORT_LOGIC_EXPORT vtkSlicerDicomRtReader : publi
/// Get radiation type (primary particle) for a given beam
const char* GetBeamTreatmentDeliveryType(unsigned int beamNumber);

/// Check if beam control point sequence is an arc beam delivery
/// @param beamNumber - beam number
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix this please as you did the rest. Thanks

@cpinter
Copy link
Member

cpinter commented Sep 5, 2022

Thanks for creating the markdown page! @lassoan how do you think we should make it available? Just link it from the wiki for now?

@lassoan
Copy link
Member

lassoan commented Sep 5, 2022

Thanks for creating the markdown page! @lassoan how do you think we should make it available? Just link it from the wiki for now?

The easiest is to link it from the wiki. It could be also nice (and not too much work) to create a main documentation page in github (just a ti-level RADME.md with about the same content as the wiki main page). Then, page by page, documentation could be moved from the wiki. Whenever a page is moved then the content of the page on the wiki would be replaced by a message that it is moved to Github and the links from the main pages on both wiki ans Github would be updated to the new location.

After a while readthedocs could be set up to generate a nice, versioned rendering of the documentation. (Github pages could be kept for rendering the version-independent part of the documentation, as it is already done now.)

@cpinter
Copy link
Member

cpinter commented Jun 28, 2024

Hi @MichaelColonel I just saw this stale PR. Is this still on your radar? Can we help in anything to get this through?

@MichaelColonel
Copy link
Collaborator Author

I will try to update this PR, so it can be merged.

@MichaelColonel
Copy link
Collaborator Author

I've updated the PR, but the update is still under process...

@cpinter
Copy link
Member

cpinter commented Jul 9, 2024

Thanks a lot @MichaelColonel! I'll wait until you say it's ready. I think I'll merge it after a very quick review, and then check the code in detail when integrating the change we are doing (working on some IEC related refactoring around the Beams and REV modules).

Do you have some (phantom or anonymized) data that I could try this with? I'm not aware of any VMAT data in the SlicerRtData repo, it would be great to upload it there as well.

@MichaelColonel
Copy link
Collaborator Author

This PR is ready for a review and merging. If there is a conflict between commits, let me know.

@cpinter
Copy link
Member

cpinter commented Jul 11, 2024

Do you have some (phantom or anonymized) data that I could try this with? I'm not aware of any VMAT data in the SlicerRtData repo, it would be great to upload it there as well.

@MichaelColonel
Copy link
Collaborator Author

MichaelColonel commented Jul 11, 2024

Do you have some (phantom or anonymized) data that I could try this with? I'm not aware of any VMAT data in the SlicerRtData repo, it would be great to upload it there as well.

No, I don't. I couldn't find any.

@cpinter
Copy link
Member

cpinter commented Jul 11, 2024

No, I don't. I couldn't find any.

Then how do you know the code works? If it has not been tested at all I don't think we can integrate it.

Also, can you please do a rebase so that we can do a meaningful review against today's SlicerRT? Thank you!

@cpinter
Copy link
Member

cpinter commented Jul 16, 2024

@MichaelColonel I'll leave on vacation in two days and we could get this sorted out before that if there was some data to test this with.

Were you able to test this on any VMAT data? How do you know that it works?

@MichaelColonel
Copy link
Collaborator Author

I think it's easier to close this RP for a while. I can try to generate RTPlan file with DCMTK and test the result when all the changes in IEC logic will be settled.

@cpinter
Copy link
Member

cpinter commented Jul 16, 2024

Thanks for the quick answer!

I just integrated the IEC changes, I believe it's all done.

Please be aware that the DRR module may need fixing: #250

About this PR, I'd love to see the arc beam support in soon. On my side I'll try to ask for a VMAT plan from the local hospital we work with (although it won't be fast unfortunately).

Also FYI I'm planning to do some actual work in SlicerRT in the next months, so if you have plans maybe it would be good to coordinate. Do you have any plans to work on SlicerRT in the near future? If so do you want to meet and discuss? (I'll be on vacation from Thursday but all available in August)

Thank you!

@MichaelColonel
Copy link
Collaborator Author

Do you have any plans to work on SlicerRT in the near future?

Nothing in particular, maybe some bug fixes and minor improvements. At least i'm not going to create a new module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants