Hi,
I load a dicom series and save it as nrrd like this:
img_node = DiskSimulator.load_image(img_dcm_dir, iid)
slicer.util.saveNode(img_node, os.path.join(self.imgs_nii_dir, iid, f"{iid}.nii.gz"))
where load_image method is defined as bellow:
def load_image(img_dicom_path, img_node_name):
originalDicomPlugins = slicer.modules.dicomPlugins
slicer.modules.dicomPlugins = {'DICOMScalarVolumePlugin': originalDicomPlugins['DICOMScalarVolumePlugin']}
loadedNodeIDs = []
with DICOMUtils.TemporaryDICOMDatabase() as db:
DICOMUtils.importDicom(img_dicom_path, db)
patientUIDs = db.patients()
for patientUID in patientUIDs:
loadedNodeIDs.extend(DICOMUtils.loadPatientByUID(patientUID))
volumeNode = slicer.mrmlScene.GetNodeByID(loadedNodeIDs[0])
volumeNode.SetName(img_node_name)
slicer.modules.dicomPlugins = originalDicomPlugins
slicer.app.applicationLogic().GetInteractionNode().SetCurrentInteractionMode(slicer.vtkMRMLInteractionNode.AdjustWindowLevel)
return volumeNode
but when I open dicom image and nii image I see the intensity ranges and volume has some differences.
Here I attach a more detailed statistics of the two images loaded in MevisLab:
I was wondering where the difference comes from? and how can I make them the same.
- I see the nii image is saved as integer data while dicom serie has been unsigned integer data
- Especially in the side by side view it seems like even they are not registered, as they show different views in the same slice
Best regards,
Saeed