DICOM to NRRD conversion in command line (for PyRadiomics)

Hello! I would like to recreate some of the functionality of 3D Slicer in command line for batch analysis of several hundred of patients’ images. I have a set of DICOM images along with their segmentations. For these I want to calculate radiomics features. It is fairly easy to do using GUI for a single case, but not for the entire set of patients.
I noticed, that when running Radiomics feature extraction within Slicer, two NRRD files are being created in the temporary directory, as well as an CSV file and a JSON file with run parameters. I assume these two NRRD files correspond to the image and the mask (segment). I would like to be able to create the same kind of files directly on the command line.
I’ve already tried using different tools/scripts for converting original images and segments to either NII or NRRD (as required by pyradiomics command line tool) but these always seem to be invalid, namely - there is some problem, such as mismatched input’s size:
pyradiomics Image.nii Segmentation.nii
sitk::ERROR: Input "labelImage" for "LabelStatisticsImageFilter" has size of [ 512, 512, 134 ] which does not match the primary input's size of [ 512, 512, 536 ]!

Probably the same answer as this post: radiologist saved segmentations without references -> annotations come out cropped when loading as numpy arrays - #2 by pieper