SlicerRT icon indicating copy to clipboard operation
SlicerRT copied to clipboard

RTplan loading: unintuitive how to change energy layers (Sequence Browser Toolbar should be auto-enabled) and how to know energy and sigmaXY

Open ferdymercury opened this issue 6 months ago • 19 comments

@cpinter I am trying to load an RTplan with 1000 proton pencil beam spots. Every spot belongs to a different energy layer, there are 10 layers, so 100 spots per layer. Currently, SlicerRT only visualizes the first energy layer and one can not visualize the other 900 spots, there is no way to change the energy via dropdown menu (or at least I can't find it).

Also, the source distance is 2m but SlicerRT shows it as 5m.

I can send you a confidential demonstrator file if needed. Thanks in advance!

ferdymercury avatar Jun 20 '25 16:06 ferdymercury

May I have a look at these files? Without DICOM Conformance Statement from a particular manufacturer, the correct support of ion plans is impossible.

MichaelColonel avatar Jun 22 '25 07:06 MichaelColonel

Sure, find attached. watercube.zip Thanks in advance.

I get:

Warning: In vtkMRMLRTIonBeamNode.cxx, line 386
vtkMRMLRTIonBeamNode (0xa03b3b0): CreateBeamPolyData: Wrong number of leaf pairs in the MLC table node, beam model poly data will be created without MLC
Warning: In vtkMRMLRTIonBeamNode.cxx, line 374
vtkMRMLRTIonBeamNode (0xa03b3b0): CreateBeamPolyData: Invalid or absent table node with scan spot parameters for a node "G000"

And only the first spot is visible in the spot table.

I think the problem is that SlicerRT does not handle well the case where ScanMode DICOM tag is 'MODULATED' (pencil-beam scanning) instead of passive scattering.

Here, every spot has an energy, a sigmaX and a sigmaY, that should be shown in the table, too.

ferdymercury avatar Jun 22 '25 11:06 ferdymercury

In file above all 58 control points contain ScanSponPositionMap with only one point (NumberOfScanSpotPositions) with position (0,0) and scanning spot size 6/6, it's not a array with different (x,y) pairs. What kind of information do you want to display or visualize, and how do you want to use kinetic energy value?

MichaelColonel avatar Jun 24 '25 11:06 MichaelColonel

Well, that was just an example. I have other examples where there are, for each different energy layer, about 200 NumberOfScanSpotPositions with different x,y values.

The table should contain for each spot: x y Energy sigmaX sigmaY Or alternatively, that there is one separate table for each energy, containing x y sigmaX sigmaY

The 3D viewer could show the spot positions as dots or ellipses.

ferdymercury avatar Jun 24 '25 12:06 ferdymercury

Energy, sigmaX, sigmaY are parameters of the control point, not the spot of ScanSpotWeightMap. These parameters will be available in ion beam node, no need to use them within table.

In case of 3D viewer the ScanSpotMap could look like:

https://github.com/SlicerRt/SlicerRT/issues/25#issuecomment-788148029

MichaelColonel avatar Jun 24 '25 13:06 MichaelColonel

In case of 3D viewer the ScanSpotMap could look like:

#25 (comment)

Yes, that looks perfect.

Energy, sigmaX, sigmaY are parameters of the control point, not the spot of ScanSpotWeightMap. These parameters will be available in ion beam node, no need to use them within table.

But then, you need to have as many tables as energies. Otherwise, when you look at the table, you do not know what rows correspond to what energy. Or have a dropdown or checkbox menu to select what energy layers are shown in the table and in the 3D viewer.

ferdymercury avatar Jun 24 '25 13:06 ferdymercury

know what rows correspond to what energy

That's a custom feature, not part of the DICOM standard.

Or have a dropdown or checkbox menu to select what energy layers are shown in the table and in the 3D viewer.

One beam node (control point), one energy, one ScanSpotMap, you can't have multiple maps for each ion control point. Checkbox can be added to GUI, but how it can effect ScanSpotMap visualization?

MichaelColonel avatar Jun 24 '25 13:06 MichaelColonel

I think there is a misunderstanding.

All what I am saying is that in the attached file, the table only shows the first ScanSpotMap (which by chance only contains one spot). How can I show the next beam energy (which will contain a different spotmap)?

ferdymercury avatar Jun 24 '25 14:06 ferdymercury

In other words, the table should have: ION CONTROL POINT 1 (beam energy 100MeV, sigmaX = 6, sigmaY = 6) x y Weight 1 1 1 2 2 2 3 3 1 ION CONTROL POINT 2 (beam energy 120MeV, sigmaX = 12, sigmaY = 10) x y Weight 0 0 5 1 1 1 2 2 2 3 3 1 ... and so forth.

Or alternatively, that there is one separate table for each ion control point.

Or that there is a checkbox/dropdown menu to select which control point you wanna see in the table.

Or alternatively, just one big table with:

X Y Weight ControlPoint BeamEnergy SigmaX SigmaY 1 1 1 1 100 6 6 2 2 2 1 100 6 6 3 3 1 1 100 6 6 0 0 5 2 120 12 10 1 1 1 2 120 12 10 2 2 2 2 120 12 10 3 3 1 2 120 12 10 even if info are repeated.

ferdymercury avatar Jun 24 '25 14:06 ferdymercury

How can I show the next beam energy (which will contain a different spotmap)?

That is implemented by means of SequenceBrowser. Each control point has a specific BeamNode and ScanSpotTable.

In your example Control Point with index 0:

Image

Control Point with index 1 (spots with zero weight are ignored):

Image

Check PR #274. You can get energy, sigmaX, sigmaY for the beam node, and spotX, spotY, weight for table node.

MichaelColonel avatar Jun 25 '25 10:06 MichaelColonel

Thanks a lot Michael for the PR! As well as for the explanation.

My two cents: Is there an option to improve SlicerRT, so that, when loading an RT Ion Plan, it automatically enables the toolbar "Sequence Browser" ? Otherwise it's not very clear if you are not a developer, on how to recover that information.

I also see an issue with your second screenshot, it should not draw a square rectangle since that's not the size of the beam. Ideally it should just draw a line or nothing.

Also, the browser should ideally go in steps of two, since the zero-weight spots have no information. (Just for the machine).

I also see that artefact if a press-and-hold the right arrow for a long time, then sometimes I get a glitch with a frame with a big green rectangle that shouldn't be there, so maybe a race condition or end-of-table reached.

ferdymercury avatar Jun 25 '25 10:06 ferdymercury

I've made a commit that fixes some bugs.

I also see an issue with your second screenshot, it should not draw a square rectangle since that's not the size of the beam. Ideally it should just draw a line or nothing.

For zero weight spots the spot is displayed as a thin line.

I also see that artefact if a press-and-hold the right arrow for a long time, then sometimes I get a glitch with a frame with a big green rectangle that shouldn't be there, so maybe a race condition or end-of-table reached.

Now valid spot with positive weight is displayed as an elliptical cylinder.

MichaelColonel avatar Jun 26 '25 11:06 MichaelColonel

A million thanks @MichaelColonel!

@lassoan Do you think it would be feasible to add a Dropdown button to the 3DSlicer-Sequence-Browser toolbar, so that one can navigate through all (default), just even, or just odd indices ?

ferdymercury avatar Jun 26 '25 11:06 ferdymercury

would be feasible to add a Dropdown button to the 3DSlicer-Sequence-Browser toolbar, so that one can navigate through all (default), just even, or just odd indices ?

It seems like a hack to me. This feature has not come up before in any other use case. Would it be acceptable to have two sequences, one with the zero-weight spots and another for the rest?

About auto-showing the sequence toolbar I'm not sure it is easy from the C++ classes in question (from Python it is, although not nice: slicer.util.mainWindow().findChildren('qMRMLSequenceBrowserToolBar')[0].visible = True). Maybe we could include the sequence controls in the beams module?

cpinter avatar Jul 04 '25 12:07 cpinter

Would it be acceptable to have two sequences, one with the zero-weight spots and another for the rest?

Yes, I am fine if, upon loading into SlicerRt, the even spots are filtered into a separate sequence from the odd spots.

ferdymercury avatar Jul 04 '25 13:07 ferdymercury

Do you think it would be feasible to add a Dropdown button to the 3DSlicer-Sequence-Browser toolbar, so that one can navigate through all (default), just even, or just odd indices ?

I agree with @cpinter.

Skipping odd/even indices would be too special to be added to a node selector. Filtering based on node attributes is already available in node selectors, but even that would be too specific to add to the completely general-purpose sequence browser toolbar.

Having sequence browser toolbar widgets (with any custom logic for filtering that makes sense for the specific RT use cases) may be a good solution.

lassoan avatar Jul 04 '25 18:07 lassoan

One additional observation for the future is the following:

When one loads an RTionplan, all beams are shown in green with a size corresponding to the first item of the ion-control-point-sequence. It would be beneficial to have a checkbox to visualize the aggregate XY contributions from the different items in the sequence (ideally just summing the even indices, since the other are duplicate with zero-weights). To get an overview of the full beam, not just of a given index of the sequence.

Indirectly related: https://github.com/SlicerRt/SlicerRT/issues/119

ferdymercury avatar Jul 09 '25 17:07 ferdymercury

It would be beneficial to have a checkbox to visualize the aggregate XY contributions from the different items in the sequence (ideally just summing the even indices, since the other are duplicate with zero-weights). To get an overview of the full beam, not just of a given index of the sequence.

It could work for a constant beam orientation, but it would be a mess on screen in case of rotation gantry.

MichaelColonel avatar Jul 18 '25 14:07 MichaelColonel

It could work for a constant beam orientation, but it would be a mess on screen in case of rotation gantry.

Thanks! Right, although most proton treatment plans have beams with constant beam orientations (gantry angle).

ferdymercury avatar Jul 18 '25 14:07 ferdymercury