How to create nii.gz inside LabelsTr directory by using 3D Slicer or python script?

I use nnunet to train skulls. I have collected 50 skull dicom datasets and converted them into nii.gz formats. I was unclear how to create nii.gz inside LabelsTr directory by using 3D Slicer or python script? Thanks a lot!