コード例 #1
0
ファイル: converter.py プロジェクト: sbrambati/toad
    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)
コード例 #2
0
ファイル: converter.py プロジェクト: bpinsard/toad
    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)
コード例 #3
0
ファイル: converter.py プロジェクト: UNFmontreal/toad
    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)
コード例 #4
0
ファイル: converter.py プロジェクト: bpinsard/toad
    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)