Two markupsROI (Cropping module)

Dawid_Szczawinski
Thu, 31 Oct 2024 14:35:54 +0000
Development

Hello everyone!
I try to create my own extension to using nnunetv2 model.
First step is cropping data, because segmentation full file is not necessary and I have too little ram.
So I try to cropp Volume using ROI.
Is it normally that I receive two markups after click Create new ROI?
I guess that vtkMRMLMarkupsROINode both and vtkMRMLCropVolumeParametersNode causes create new markups.
I would like the user to be able to interactively select the area to be cropped.
Code responsible for marking area:

def onCreateNewROI(self):
        if not self._parameterNode.inputVolume:
            slicer.util.errorDisplay("Proszę wybrać obraz wejściowy przed
            utworzeniem ROI.")
            return

        if not self._parameterNode.roinode:
            self._parameterNode.roinode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsROINode")
            slicer.util.infoDisplay("Nowy ROI został utworzony. Możesz teraz edytować ROI na obrazie.")


        if not self._parameterNode.cropVolume:
            self._parameterNode.cropVolume = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLCropVolumeParametersNode")

        self._parameterNode.cropVolume.SetInputVolumeNodeID(self._parameterNode.inputVolume.GetID())
        self._parameterNode.cropVolume.SetOutputVolumeNodeID(self._parameterNode.inputVolume.GetID())
        self._parameterNode.cropVolume.SetROINodeID(self._parameterNode.roinode.GetID())

        slicer.modules.cropvolume.logic().FitROIToInputVolume(self._parameterNode.cropVolume)

        slicer.util.infoDisplay("Nowy ROI został utworzony. Możesz teraz edytować ROI na obrazie.")

3 posts - 2 participants