def __convertDwi(self, sequence, session, target): """ Convert a dwi dicom images into nifti the name of the resulting image will be: prefix_subjectName.nii.gz """ dwi = util.buildName(self.__configParser, target, sequence.getPrefix().getValue(), session.getName(),'nii.gz') bEnc = util.buildName(self.__configParser, target, dwi, None, "b") bvals = util.buildName(self.__configParser, target, dwi, None, "bvals") bvecs = util.buildName(self.__configParser, target, dwi, None, "bvecs") cmd = "mrconvert {} {} -force -export_grad_mrtrix {} -export_grad_fsl {} {}"\ .format(sequence.getEscapedDirectory(), dwi, bEnc, bvecs, bvals) if not self.__arguments.noStride: cmd += " -stride 1,2,3,4 " print cmd util.launchCommand(cmd) if not self.__arguments.noConfig: dicoms = glob.glob("{}/*.dcm".format(sequence.getDirectory())) if len(dicoms) > 0: toadinfo = Toadinfo(dicoms.pop()) toadinfo.writeToadConfig( self.__configFilename) util.launchCommand(cmd)
def __convertDwi(self, sequence, session, target): """ Convert a dwi dicomparser images into nifti the name of the resulting image will be: prefix_subjectName.nii.gz """ dwi = util.buildName(self.__configParser, target, sequence.getPrefix().getValue(), session.getName(), 'nii.gz') bEnc = util.buildName(self.__configParser, target, dwi, None, "b") bvals = util.buildName(self.__configParser, target, dwi, None, "bvals") bvecs = util.buildName(self.__configParser, target, dwi, None, "bvecs") cmd = "mrconvert {} {} -force -export_grad_mrtrix {} -export_grad_fsl {} {}"\ .format(sequence.getEscapedDirectory(), dwi, bEnc, bvecs, bvals) if not self.__arguments.noStride: cmd += " -stride 1,2,3,4 " print cmd util.launchCommand(cmd) if not self.__arguments.noConfig: dicoms = glob.glob("{}/*.dcm".format(sequence.getDirectory())) if len(dicoms) > 0: toadinfo = Toadinfo(dicoms.pop()) toadinfo.writeToadConfig(self.__configFilename)
def __convert(self, sequence, session, target): filename = util.buildName(self.__configParser, target, sequence.getPrefix().getValue(), session.getName(), 'nii.gz') cmd = "mrconvert {0} {1} -force ".format(sequence.getEscapedDirectory(), filename) if not self.__arguments.noStride: cmd += " -stride 1,2,3 " if sequence.getPrefix().getName() == 'phase': cmd += " -datatype float32 " print cmd util.launchCommand(cmd) if not self.__arguments.noConfig: dicoms = glob.glob("{}/*.dcm".format(sequence.getDirectory())) if len(dicoms) > 0: toadinfo = Toadinfo(dicoms.pop()) toadinfo.writeToadConfig(self.__configFilename)
def __convert(self, sequence, session, target): filename = util.buildName(self.__configParser, target, sequence.getPrefix().getValue(), session.getName(), 'nii.gz') cmd = "mrconvert {0} {1} -force ".format( sequence.getEscapedDirectory(), filename) if not self.__arguments.noStride: cmd += " -stride 1,2,3 " if sequence.getPrefix().getName() == 'phase': cmd += " -datatype float32 " print cmd util.launchCommand(cmd) if not self.__arguments.noConfig: dicoms = glob.glob("{}/*.dcm".format(sequence.getDirectory())) if len(dicoms) > 0: toadinfo = Toadinfo(dicoms.pop()) toadinfo.writeToadConfig(self.__configFilename)