Two markupsROI (Cropping module)

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.")

The code above looks good, it only creates a single ROI node. I’ve tested it on this snippet created from your code above:

inputVolume  = slicer.mrmlScene.GetFirstNodeByClass("vtkMRMLScalarVolumeNode")
roinode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsROINode")

cropVolume = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLCropVolumeParametersNode")
cropVolume.SetInputVolumeNodeID(inputVolume.GetID())
cropVolume.SetOutputVolumeNodeID(inputVolume.GetID())  
cropVolume.SetROINodeID(roinode.GetID())

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

If you get two ROI nodes that is due to some issues somewhere else in your module.

I’ve noticed the Polish text in your module. Note that Slicer has an internationalization framework, so you can develop modules that can be translated to any language. You can find more information here.

Thank you for your feedback!
All time when I first time use this function (eg. after restart Slicer) create two MarkupsRoi
First in this part:

   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.")

and second in this part:

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

First of created Markups does not have visualization.
Interesting is that when I create next Roi is only one.

To activate this function I use connection:

self.ui.roiSelector.connect(“nodeAddedByUser(vtkMRMLNode*)”,
self.onCreateNewROI)