save and reload custom parameterNodeWrapper

Hi,

I probably have a silly question, but I didn’t manage to find an answer in the forum. I am trying to write a custom module to manage a treatment planning simulation. Part of this module consist in associating segmented volumes to a material. I have now a working QT widget where the user can add this information and the data is managed within the python script with:

@parameterPack
class MaskParameters:
    node: vtkMRMLScalarVolumeNode
    material: str

@parameterNodeWrapper
class GenerateInputParameterNode:

    CT: MaskParameters
    GTV: MaskParameters
    OAR: list[MaskParameters]
    Other: list[MaskParameters]
    AddVolume: vtkMRMLScalarVolumeNode

I would like to save the user generated data with the scene or medical record bundle. Is this possible ? Is there an example I could use as a guideline ?

thanks in advance !

Parameter nodes are saved into the scene (in the .mrml file).

Hi, yes it was indeed a silly question.

My problem was that I didn’t update the GUI after the user loaded the saved scene. That said, things are now working as planned.

For future reference, I managed to understand my problem by printing the content of the _parameterNode once the scene is uploaded:

for attr, value in vars(self._parameterNode).items():  # or obj.__dict__.items()
            print(f"{attr} = {value}")