Exemplo n.º 1
0
 def f_stage3callback(**kwargs):
     str_cwd         =  os.getcwd()
     lst_subj        = []
     for key, val in kwargs.iteritems():
         if key == 'subj':   lst_subj        = val
         if key == 'obj':    stage           = val
     for subj in lst_subj:
         # find the relevant input files in each <subj> dir
         os.chdir(subj)
         l_ADC       = misc.find(_str_adc)
         if not l_ADC: error.fatal(pipe_hypothermia, 'noADC')
         _str_ADCFile = l_ADC[0]
         _str_outDir  = 'outDir'
         misc.mkdir(_str_outDir)
         log = stage.log()
         log('Scheduling masconorm for "%s: ADC"..\n' % (subj))
         str_cmd = 'masconorm.py --input %s --mask %s/b0Brain_mask.nii.gz --outStem %s/adc' % (
                                                     _str_ADCFile,
                                                     _str_outDir,
                                                     _str_outDir)
         cluster = crun.crun()
         cluster.echo(False)
         cluster.echoStdOut(False)
         cluster.detach(False)
         cluster(str_cmd, waitForChild=True, stdoutflush=True, stderrflush=True)
         os.chdir(str_cwd)
     return True
Exemplo n.º 2
0
    def run(self):
        '''
        Runs the DICOM conversion based on internal state.
        '''
        self._log('Converting DICOM image.\n')
        self._log('PatientName:                                %s\n' % self._dcm.PatientName)
        self._log('PatientAge:                                 %s\n' % self._dcm.PatientAge)
        self._log('PatientSex:                                 %s\n' % self._dcm.PatientSex)
        self._log('PatientID:                                  %s\n' % self._dcm.PatientID)
        self._log('SeriesDescription:                          %s\n' % self._dcm.SeriesDescription)
        self._log('ProtocolName:                               %s\n' % self._dcm.ProtocolName)
        if self._b_convertMiddleSlice:
            self._log('Converting middle slice in DICOM series:    %d\n' % self._sliceToConvert)

        l_rot90 = [ True, True, False ]
        misc.mkdir(self._str_outputDir)
        if not self._b_3D:
            str_outputFile = '%s/%s.%s' % (self._str_outputDir,
                                        self._str_outputFileStem,
                                        self._str_outputFileType)
            self.slice_save(str_outputFile)
        if self._b_3D:
            rotCount = 0
            if self._b_reslice:
                for dim in ['x', 'y', 'z']:
                    self.dim_save(dimension = dim, makeSubDir = True, rot90 = l_rot90[rotCount], indexStart = 0, indexStop = -1)
                    rotCount += 1
            else:
                self.dim_save(dimension = 'z', makeSubDir = False, rot90 = False, indexStart = 0, indexStop = -1)
Exemplo n.º 3
0
 def f_stage2callback(**kwargs):
     str_cwd         =  os.getcwd()
     lst_subj        = []
     for key, val in kwargs.iteritems():
         if key == 'subj':   lst_subj        = val
         if key == 'obj':    stage           = val
     for subj in lst_subj:
         # find the relevant input files in each <subj> dir
         os.chdir(subj)
         l_B0        = misc.find(_str_b0)
         l_ASL       = misc.find(_str_asl)
         if not l_B0:  error.fatal(pipe_hypothermia, 'noB0')
         if not l_ASL: error.fatal(pipe_hypothermia, 'noASL')
         _str_B0File  = l_B0[0]
         _str_ASLFile = l_ASL[0]
         _str_outDir  = 'outDir'
         _str_outFile = 'asl2b0.nii'
         misc.mkdir(_str_outDir)
         log = stage.log()
         log('Scheduling masconorm for "%s: ASL"..\n' % (subj))
         str_cmd = 'masconorm.py --input %s/asl2b0.nii.gz --mask %s/b0Brain_mask.nii.gz --outStem %s/asl' % (
                                                     _str_outDir,
                                                     _str_outDir,
                                                     _str_outDir)
         #cluster = crun.crun_mosix()
         cluster = crun.crun()
         cluster.echo(False)
         cluster.echoStdOut(False)
         cluster.detach(False)
         cluster(str_cmd, waitForChild=True, stdoutflush=True, stderrflush=True)
         if cluster.exitCode():
             error.fatal(pipe_hypothermia, 'stageExec', cluster.stderr())
         os.chdir(str_cwd)
     return True
Exemplo n.º 4
0
    def __init__(self, **kwargs):

        # global settings
        self._log                       = message.Message()

        self._l_subject                 = []
        self._l_hemi                    = []
        self._l_surface                 = []
        self._l_curv                    = []
        
        # Internal tracking vars
        self._str_subj                  = ''
        self._str_hemi                  = ''
        self._str_surface               = ''
        self._str_curv                  = ''

        self._str_workingDir            = os.getcwd()
        
        self._browser                   = webdriver.Chrome()
        self._str_outDir                = _str_outDir
        
        for key, value in kwargs.iteritems():
            if key == 'subjectList':    self._l_subject         = value
            if key == 'hemiList':       self._l_hemi            = value.split(',')
            if key == 'surfaceList':    self._l_surface         = value.split(',')
            if key == 'curvList':       self._l_curv            = value.split(',')
            if key == 'syslog':         self._log.syslog(value)
            if key == 'logTo':          self._log.to(value)
            if key == 'logTee':         self._log.tee(value)
            if key == 'outDir':         self._str_outDir        = value
            
        if not os.path.exists(self._str_outDir):
            self._log('Output image dir not found, creating...\n')
            misc.mkdir(self._str_outDir)
Exemplo n.º 5
0
 def f_stage0callback(**kwargs):
     str_cwd         =  os.getcwd()
     lst_subj        = []
     for key, val in kwargs.iteritems():
         if key == 'subj':   lst_subj        = val
         if key == 'obj':    stage           = val
     for subj in lst_subj:
         # find the relevant input files in each <subj> dir
         os.chdir(subj)
         l_B0        = misc.find(_str_b0)
         if not l_B0: error.fatal(pipe_hypothermia, 'noB0')
         _str_B0File = l_B0[0]
         _str_outDir = '%s/outDir' % os.getcwd()
         _str_outFile = 'b0Brain.nii'
         misc.mkdir(_str_outDir)
         str_prefixCmd = '( cd %s ; ' % (os.getcwd())
         log = stage.log()
         log('Scheduling brain extraction for "%s"...\n' % (subj))
         str_cmd = 'bet.py --input %s --output %s/%s' % (_str_B0File, 
                                                      _str_outDir, _str_outFile)
         #cluster = crun.crun_mosix(cmdPrefix=str_prefixCmd)
         #cluster = crun.crun_mosix()
         cluster = crun.crun()
         #str_ccmd = cluster.echo(True)
         #log(str_ccmd)
         cluster.echo(False)
         cluster.echoStdOut(False)
         cluster.detach(False)
         cluster(str_cmd, waitForChild=True, stdoutflush=True, stderrflush=True)
         if cluster.exitCode():
             error.fatal(pipe_hypothermia, 'stageExec', cluster.stderr())
         os.chdir(str_cwd)
     return True
Exemplo n.º 6
0
    def run(self):
        '''
        Runs the NIfTI conversion based on internal state.
        '''

        self._log('About to perform NifTI to %s conversion...\n' %
                  self._str_outputFileType)

        frames = 1
        frameStart = 0
        frameEnd = 0

        sliceStart = 0
        sliceEnd = 0

        if self._b_4D:
            self._log('4D volume detected.\n')
            frames = self._Vnp_4DVol.shape[3]
        if self._b_3D:
            self._log('3D volume detected.\n')

        if self._b_convertMiddleFrame:
            self._frameToConvert = int(frames / 2)

        if self._frameToConvert == -1:
            frameEnd = frames
        else:
            frameStart = self._frameToConvert
            frameEnd = self._frameToConvert + 1

        for f in range(frameStart, frameEnd):
            if self._b_4D:
                self._Vnp_3DVol = self._Vnp_4DVol[:, :, :, f]
            slices = self._Vnp_3DVol.shape[2]
            if self._b_convertMiddleSlice:
                self._sliceToConvert = int(slices / 2)

            if self._sliceToConvert == -1:
                sliceEnd = -1
            else:
                sliceStart = self._sliceToConvert
                sliceEnd = self._sliceToConvert + 1

            misc.mkdir(self._str_outputDir)
            if self._b_reslice:
                for dim in ['x', 'y', 'z']:
                    self.dim_save(dimension=dim,
                                  makeSubDir=True,
                                  indexStart=sliceStart,
                                  indexStop=sliceEnd,
                                  rot90=True)
            else:
                self.dim_save(dimension='z',
                              makeSubDir=False,
                              indexStart=sliceStart,
                              indexStop=sliceEnd,
                              rot90=True)
Exemplo n.º 7
0
    def run(self):
        '''
        Runs the NIfTI conversion based on internal state.
        '''

        self._log('About to perform NifTI to %s conversion...\n' %
                  self._str_outputFileType)

        frames     = 1
        frameStart = 0
        frameEnd   = 0

        sliceStart = 0
        sliceEnd   = 0

        if self._b_4D:
            self._log('4D volume detected.\n')
            frames = self._Vnp_4DVol.shape[3]
        if self._b_3D:
            self._log('3D volume detected.\n')

        if self._b_convertMiddleFrame:
            self._frameToConvert = int(frames/2)

        if self._frameToConvert == -1:
            frameEnd    = frames
        else:
            frameStart  = self._frameToConvert
            frameEnd    = self._frameToConvert + 1

        for f in range(frameStart, frameEnd):
            if self._b_4D:
                self._Vnp_3DVol = self._Vnp_4DVol[:,:,:,f]
            slices     = self._Vnp_3DVol.shape[2]
            if self._b_convertMiddleSlice:
                self._sliceToConvert = int(slices/2)

            if self._sliceToConvert == -1:
                sliceEnd    = -1
            else:
                sliceStart  = self._sliceToConvert
                sliceEnd    = self._sliceToConvert + 1

            misc.mkdir(self._str_outputDir)
            if self._b_reslice:
                for dim in ['x', 'y', 'z']:
                    self.dim_save(dimension = dim, makeSubDir = True, indexStart = sliceStart, indexStop = sliceEnd, rot90 = True)
            else:
                self.dim_save(dimension = 'z', makeSubDir = False, indexStart = sliceStart, indexStop = sliceEnd, rot90 = True)
Exemplo n.º 8
0
    def run(self):
        '''
        Runs the DICOM conversion based on internal state.
        '''
        self._log('Converting DICOM image.\n')
        self._log('PatientName:                                %s\n' %
                  self._dcm.PatientName)
        self._log('PatientAge:                                 %s\n' %
                  self._dcm.PatientAge)
        self._log('PatientSex:                                 %s\n' %
                  self._dcm.PatientSex)
        self._log('PatientID:                                  %s\n' %
                  self._dcm.PatientID)
        self._log('SeriesDescription:                          %s\n' %
                  self._dcm.SeriesDescription)
        self._log('ProtocolName:                               %s\n' %
                  self._dcm.ProtocolName)
        if self._b_convertMiddleSlice:
            self._log('Converting middle slice in DICOM series:    %d\n' %
                      self._sliceToConvert)

        l_rot90 = [True, True, False]
        misc.mkdir(self._str_outputDir)
        if not self._b_3D:
            str_outputFile = '%s/%s.%s' % (self._str_outputDir,
                                           self._str_outputFileStem,
                                           self._str_outputFileType)
            self.slice_save(str_outputFile)
        if self._b_3D:
            rotCount = 0
            if self._b_reslice:
                for dim in ['x', 'y', 'z']:
                    self.dim_save(dimension=dim,
                                  makeSubDir=True,
                                  rot90=l_rot90[rotCount],
                                  indexStart=0,
                                  indexStop=-1)
                    rotCount += 1
            else:
                self.dim_save(dimension='z',
                              makeSubDir=False,
                              rot90=False,
                              indexStart=0,
                              indexStop=-1)
Exemplo n.º 9
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).

        '''

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)

        # Set absolute dir specs for topDir and outDir
        log = self.log()
        log('Setting dir specs...\n')
        os.chdir(self.topDir())
        self.topDir(os.path.abspath(self.topDir()))
        if os.path.isdir(self.outDir()):
            log('Existing output directory found. Deleting and recreating...\n')
            shutil.rmtree(self.outDir())
        misc.mkdir(self.outDir())
        os.chdir(self.outDir())
        self.outDir(os.getcwd())
        os.chdir(self.topDir())

        # check dirs for each subsample dir
        # print(os.getcwd())
        # print(self._l_subsample)
        for directory in self._l_subsample:
            if os.path.isdir(os.path.join(self.topDir(), directory)):
                os.chdir(directory)
                self._l_subsampleDir.append(os.path.abspath(os.getcwd()))
                os.chdir(self.topDir())
            else:
                error.fatal(self, 'subsampleDirNotFound')
        self._d_subsampleDir = dict(zip(self._l_subsample, self._l_subsampleDir))
        # print(self._d_subsampleDir)

        self.dtree_build()
        self._dtree.tree_metaData_print(False)
Exemplo n.º 10
0
 def dim_save(self, **kwargs):
     dims            = self._Vnp_3DVol.shape
     self._log('Image volume logical (i, j, k) size: %s\n' % str(dims))
     str_dim         = 'z'
     b_makeSubDir    = False
     b_rot90         = False
     frame           = 0
     indexStart      = -1
     indexStop       = -1
     for key, val in kwargs.iteritems():
         if key == 'dimension':  str_dim         = val
         if key == 'makeSubDir': b_makeSubDir    = val
         if key == 'frame':      frame           = val
         if key == 'indexStart': indexStart      = val 
         if key == 'indexStop':  indexStop       = val
         if key == 'rot90':      b_rot90         = val
     
     str_subDir  = ''
     if b_makeSubDir: 
         str_subDir = str_dim
         misc.mkdir('%s/%s' % (self._str_outputDir, str_subDir))
     if str_dim == 'x':
         if indexStart == 0 and indexStop == -1:
             indexStop  = dims[0]
         for i in range(indexStart, indexStop):
             self._Mnp_2Dslice = self._Vnp_3DVol[i,:,:]
             if b_rot90: self._Mnp_2Dslice = np.rot90(self._Mnp_2Dslice)
             self.dim_sliceSave(index = i, subDir = str_subDir)
     if str_dim == 'y':
         if indexStart == 0 and indexStop == -1:
             indexStop  = dims[1]
         for j in range(indexStart, indexStop):
             self._Mnp_2Dslice = self._Vnp_3DVol[:,j,:]
             if b_rot90: self._Mnp_2Dslice = np.rot90(self._Mnp_2Dslice)
             self.dim_sliceSave(index = j, subDir = str_subDir)
     if str_dim == 'z':
         if indexStart == 0 and indexStop == -1:
             indexStop  = dims[2]
         for k in range(indexStart, indexStop):
             self._Mnp_2Dslice = self._Vnp_3DVol[:,:,k]
             if b_rot90: self._Mnp_2Dslice = np.rot90(self._Mnp_2Dslice)
             self.dim_sliceSave(index = k, subDir = str_subDir)
Exemplo n.º 11
0
    def dim_save(self, **kwargs):
        dims = self._Vnp_3DVol.shape
        self._log('Image volume logical (i, j, k) size: %s\n' % str(dims))
        str_dim = 'z'
        b_makeSubDir = False
        b_rot90 = False
        frame = 0
        indexStart = -1
        indexStop = -1
        for key, val in kwargs.iteritems():
            if key == 'dimension': str_dim = val
            if key == 'makeSubDir': b_makeSubDir = val
            if key == 'frame': frame = val
            if key == 'indexStart': indexStart = val
            if key == 'indexStop': indexStop = val
            if key == 'rot90': b_rot90 = val

        str_subDir = ''
        if b_makeSubDir:
            str_subDir = str_dim
            misc.mkdir('%s/%s' % (self._str_outputDir, str_subDir))
        if str_dim == 'x':
            if indexStart == 0 and indexStop == -1:
                indexStop = dims[0]
            for i in range(indexStart, indexStop):
                self._Mnp_2Dslice = self._Vnp_3DVol[i, :, :]
                if b_rot90: self._Mnp_2Dslice = np.rot90(self._Mnp_2Dslice)
                self.dim_sliceSave(index=i, subDir=str_subDir)
        if str_dim == 'y':
            if indexStart == 0 and indexStop == -1:
                indexStop = dims[1]
            for j in range(indexStart, indexStop):
                self._Mnp_2Dslice = self._Vnp_3DVol[:, j, :]
                if b_rot90: self._Mnp_2Dslice = np.rot90(self._Mnp_2Dslice)
                self.dim_sliceSave(index=j, subDir=str_subDir)
        if str_dim == 'z':
            if indexStart == 0 and indexStop == -1:
                indexStop = dims[2]
            for k in range(indexStart, indexStop):
                self._Mnp_2Dslice = self._Vnp_3DVol[:, :, k]
                if b_rot90: self._Mnp_2Dslice = np.rot90(self._Mnp_2Dslice)
                self.dim_sliceSave(index=k, subDir=str_subDir)
Exemplo n.º 12
0
    def run(self):
        '''
        Runs the DICOM header tag to index.html class.
        '''
        misc.mkdir(self._str_outputDir)
        f = open('%s/%s' % (self._str_outputDir, self._str_outputFile), 'w')

        dicomTag.run(self)
        htmlPage = '''
<!DOCTYPE html>
<html>
<head>
  <title>DCM tags: %s</title>
</head>
<body>
    <pre>
%s
    </pre>
</body>
</html> ''' % (self._str_inputFile, self._strRaw)

        print(htmlPage, file=f)
Exemplo n.º 13
0
    def run(self):
        '''
        Runs the DICOM header tag to index.html class.
        '''
        misc.mkdir(self._str_outputDir)
        f = open('%s/%s' % (self._str_outputDir, self._str_outputFile), 'w')

        dicomTag.run(self)
        htmlPage = '''
<!DOCTYPE html>
<html>
<head>
  <title>DCM tags: %s</title>
</head>
<body>
    <pre>
%s
    </pre>
</body>
</html> ''' % (self._str_inputFile, self._strRaw)

        print(htmlPage, file=f)
Exemplo n.º 14
0
 def f_stage4callback(**kwargs):
     str_cwd         =  os.getcwd()
     lst_subj        = []
     for key, val in kwargs.iteritems():
         if key == 'subj':   lst_subj        = val
         if key == 'obj':    stage           = val
     for subj in lst_subj:
         # find the relevant input files in each <subj> dir
         _str_outDir  = 'outDir'
         misc.mkdir(_str_outDir)
         os.chdir("%s/outDir" % subj)
         log = stage.log()
         log('Scheduling MatLAB basac analysis for subject "%s"...\n' % (subj))
         str_cmd = 'eval "/chb/pices/arch/x86_64-Linux/bin/matlab -nodesktop -nosplash -nojvm -r \\\"c = basac_drive(\'%s\'); exit\\\"" |tee basac_process.log' % (
                     os.getcwd()
                     )
         cluster = crun.crun()
         cluster.echo(False)
         cluster.echoStdOut(False)
         cluster.detach(False)
         cluster(str_cmd, waitForChild=True, stdoutflush=True, stderrflush=True)
         os.chdir(str_cwd)
     return True
Exemplo n.º 15
0
    def f_stage0callback(**kwargs):
        '''
        STAGE 0
        -------

        Build output directory trees for the analysis.

        '''
        str_cwd = os.getcwd()
        for key, val in kwargs.iteritems():
            if key == 'obj': stage = val
            if key == 'pipe': pipeline = val
        log = stage.log()
        b_alreadyResampled = False
        b_outAnnotDirExist = False

        for pipeline._str_annotation in pipeline.l_annotation():
            for pipeline._str_subsample in pipeline.l_subsample():
                b_parentContainsSamples = False
                str_outDir    = "%s%s/groupCurvAnalysis/%s" % \
                    (   pipeline.outDir(),
                        pipeline._str_subsample,
                        pipeline._str_annotation    )
                str_outParentDir = "/".join(str_outDir.split('/')[0:-2])
                log('Building output tree for "%s", annotation "%s"\n' % \
                    (   str_outParentDir,
                        pipeline._str_annotation))

                b_outAnnotDirExist = os.path.isdir(str_outDir)
                if not b_outAnnotDirExist:
                    misc.mkdir(str_outDir)

                # Check if outParentDir contains samples
                l_numer = l_filterNumeric(os.listdir(str_outParentDir))
                if len(l_numer): b_parentContainsSamples = True
        stage.exitCode(0)
        return True
Exemplo n.º 16
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).

        '''

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)

        # Set absolute dir specs for topDir and outDir
        os.chdir(self.topDir())
        self.topDir(os.path.abspath(self.topDir()))
        if os.path.isdir(self.outDir()):
            os.chdir(self.outDir())
            self.outDir(os.path.abspath(self.outDir()))
        else:
            error.warn(self, 'outDirNotFound')
            misc.mkdir(self.outDir())
Exemplo n.º 17
0
    def f_stage1callback(**kwargs):
        for key, val in kwargs.iteritems():
            if key == 'obj': stage = val
            if key == 'pipe': pipeline = val
        log = stage.log()
        lst_subj = pipeline.l_subj()

        os.chdir(pipeline.outDir())
        misc.mkdir('groupCurvAnalysis')
        os.chdir('groupCurvAnalysis')
        misc.mkdir(pipeline.annotationDir())
        os.chdir(pipeline.dirSpecAnnot(base='orig'))
        for bashFile in glob.glob(r'*.bash'):
            shutil.copy(bashFile, pipeline.dirSpecAnnot(base='rsampled'))
        for lstFile in glob.glob(r'*.lst'):
            shutil.copy(lstFile, pipeline.dirSpecAnnot(base='rsampled'))

        str_CMDoriginalROI = "find . -maxdepth 1 -mindepth 1 -type d | grep -v ROItag | awk -F\/ '{print $2}'"
        pipeline.l_ROI(OSshell(str_CMDoriginalROI)[0].strip().split('\n'))
        lst_ROI = pipeline.l_ROI()
        os.chdir(pipeline.dirSpecAnnot(base='rsampled'))
        # print(os.getcwd())

        total = 0
        for pipeline._str_ROI in lst_ROI:
            os.chdir(pipeline.dirSpecAnnot(base='rsampled'))
            log('Creating ROI dir %s\n' % (pipeline._str_ROI))
            misc.mkdir(pipeline._str_ROI)
            os.chdir(pipeline._str_ROI)
            tagCentroidCMD = 'ls %s/%s/*centroid*txt' % (pipeline.dirSpecAnnot(
                base='orig'), pipeline._str_ROI)
            pipeline.l_centroidTXT(
                OSshell(tagCentroidCMD)[0].strip().split('\n'))
            for pipeline._str_centroidTXT in pipeline.l_centroidTXT():
                log('\tCopying original sample %s\n' %
                    os.path.basename(pipeline._str_centroidTXT))
                shutil.copy(
                    pipeline._str_centroidTXT,
                    os.path.join(pipeline.outDir(), 'groupCurvAnalysis',
                                 pipeline.annotationDir(), pipeline._str_ROI))

            total += 1
        stage.exitCode(0)
        return True
Exemplo n.º 18
0
            else:
                v_ind                           = reltran/v_reltranScale + \
                                                        v_indoffset - v_nonBaseOffset

            M_pval[v_ind[0],v_ind[1]]           = f_pvalMin
            M_pvalmNorm[v_ind[0],v_ind[1]]      = f_pvalmNorm
            M_pvalvNorm[v_ind[0],v_ind[1]]      = f_pvalvNorm
            print("\tmin  p-val for comparison between group '%s' and '%s' is    %f" % \
                (l_cloudFile[g1], l_cloudFile[g2], f_pvalMin))
            print("\tnorm p-val for comparison between group '%s' and '%s' is    %f" % \
                (l_cloudFile[g1], l_cloudFile[g2], f_pvalmNorm))
            print("\tp-val for comparison between normed groups '%s' and '%s' is %f" % \
                (l_cloudFile[g1], l_cloudFile[g2], f_pvalvNorm))
            if Gb_saveFig:
                print("\tsaving figure '%s'..." % _str_title)
                misc.mkdir(_str_title)
                #aspectRatio_square(aspect=1)
                savefig('%s/%s.pdf' % (_str_title, _str_title), bbox_inches=0)
                savefig('%s/%s.png' % (_str_title, _str_title), bbox_inches=0)
                # Save pval matrices on each loop... allows for some data storage
                # even while processing is incomplete.
                np.savetxt('%s/%s-pval.txt'      % (_str_title, _str_title), M_pval,          fmt='%10.7f')
                np.savetxt('%s/%s-pvalmNorm.txt' % (_str_title, _str_title), M_pvalmNorm,     fmt='%10.7f')
                np.savetxt('%s/%s-pvalvNorm.txt' % (_str_title, _str_title), M_pvalvNorm,     fmt='%10.7f')
    else:
            if Gb_saveFig:
                _str_title = '%s' % (
                        os.path.splitext(os.path.basename(l_cloudFile[0]))[0],
                            )
                if Gb_titlePrint: title(_str_title)
                misc.mkdir(_str_title)