Exemple #1
0
   def set_directories(self):
      """decide on use of top_dir (use it or nothing - no anat_dir)

         ==> if top_dir is set, use $top_dir/short_names
             else just use anat and epi directly
      """
      all_files = [self.uvars.val('dsets_A')]
      more_files = self.uvars.val('dsets_B')
      if more_files: all_files.append(more_files)
      top_dir, parent_dirs, short_dirs, short_names =    \
         UTIL.common_parent_dirs(all_files)

      if self.cvars.verb > 2:
         print '== top_dir = %s\n   parent_dirs = %s\n   short_dirs = %s\n' \
               '   short_names = %s' \
               %(top_dir, parent_dirs, short_dirs, short_names)

      # and store it
      self.LV.top_dir     = top_dir
      self.LV.parent_dirs = parent_dirs
      self.LV.short_dirs  = short_dirs
      self.LV.short_names = short_names

      # if top_dir isn't long enough, do not bother with it
      if self.LV.top_dir.count('/') < 2:
         self.LV.top_dir = ''
         if self.cvars.verb > 2: print '   (top_dir not worth using...)'
Exemple #2
0
    def set_directories(self):
        """decide on use of top_dir (use it or nothing - no anat_dir)

         ==> if top_dir is set, use $top_dir/short_names
             else just use anat and epi directly
      """
        all_files = [self.uvars.val('dsets_A')]
        more_files = self.uvars.val('dsets_B')
        if more_files: all_files.append(more_files)
        top_dir, parent_dirs, short_dirs, short_names =    \
           UTIL.common_parent_dirs(all_files)

        if self.cvars.verb > 2:
            print '== top_dir = %s\n   parent_dirs = %s\n   short_dirs = %s\n' \
                  '   short_names = %s' \
                  %(top_dir, parent_dirs, short_dirs, short_names)

        # and store it
        self.LV.top_dir = top_dir
        self.LV.parent_dirs = parent_dirs
        self.LV.short_dirs = short_dirs
        self.LV.short_names = short_names

        # if top_dir isn't long enough, do not bother with it
        if self.LV.top_dir.count('/') < 2:
            self.LV.top_dir = ''
            if self.cvars.verb > 2: print '   (top_dir not worth using...)'
Exemple #3
0
    def set_directories(self):
        """always use $top_dir with absolute paths to datasets
      """

        inputs = [self.uvars.surf_vol, self.uvars.spec_file]
        if self.cvars.val('on_surface') == 'yes':
            if self.uvars.surf_mask != '': inputs.append(self.uvars.surf_mask)
        else:
            inputs.append(self.uvars.vol_mask)

        # try converting to absolute paths
        try:
            inputs = [os.path.abspath(fname) for fname in inputs]
        except:
            msg = '** cannot convert inputs to asolute path names:\n   %s' % inputs
            self.errors.append(msg)
            return 1

        top_dir, parent_dirs, short_dirs, short_names = \
                  UTIL.common_parent_dirs([inputs])

        self.LV.top_dir = parent_dirs[0]  # common parent dir
        self.LV.short_names = short_names  # if top_dir is used, they are under it

        if self.cvars.verb > 2:
            if self.cvars.val('on_surface') != 'yes':
                print('-- set_dirs: top_dir         = %s\n' \
                      '             short surf_vol  = %s\n' \
                      '             short spec_file = %s\n' \
                      '             short vol_mask  = %s\n' % (self.LV.top_dir,
                         short_names[0][0], short_names[0][1], short_names[0][2]))
            else:  # on surface
                print('-- set_dirs: top_dir         = %s\n' \
                      '             short surf_vol  = %s\n' \
                      '             short spec_file = %s\n' % (self.LV.top_dir,
                         short_names[0][0], short_names[0][1]))
                if len(short_names[0]) > 2:
                    print('             short surf_mask = %s\n' %
                          short_names[0][2])

        # if top_dir isn't long enough, do not bother with it
        if self.LV.top_dir.count('/') < 2:
            self.LV.top_dir = ''
            if self.cvars.verb > 2: print('   (top_dir not worth using...)')

        return 0
Exemple #4
0
   def set_directories(self):
      """always use $top_dir with absolute paths to datasets
      """

      inputs = [self.uvars.surf_vol, self.uvars.spec_file]
      if self.cvars.val('on_surface') == 'yes':
         if self.uvars.surf_mask != '': inputs.append(self.uvars.surf_mask)
      else:
         inputs.append(self.uvars.vol_mask)

      # try converting to absolute paths
      try: inputs = [ os.path.abspath(fname) for fname in inputs ]
      except:
         msg = '** cannot convert inputs to asolute path names:\n   %s' % inputs
         self.errors.append(msg)
         return 1

      top_dir, parent_dirs, short_dirs, short_names = \
                UTIL.common_parent_dirs([inputs])

      self.LV.top_dir     = parent_dirs[0]  # common parent dir
      self.LV.short_names = short_names # if top_dir is used, they are under it

      if self.cvars.verb > 2:
         if self.cvars.val('on_surface') != 'yes':
            print '-- set_dirs: top_dir         = %s\n' \
                  '             short surf_vol  = %s\n' \
                  '             short spec_file = %s\n' \
                  '             short vol_mask  = %s\n' % (self.LV.top_dir,
                     short_names[0][0], short_names[0][1], short_names[0][2])
         else: # on surface
            print '-- set_dirs: top_dir         = %s\n' \
                  '             short surf_vol  = %s\n' \
                  '             short spec_file = %s\n' % (self.LV.top_dir,
                     short_names[0][0], short_names[0][1])
            if len(short_names[0]) > 2:
                print '             short surf_mask = %s\n' % short_names[0][2]

      # if top_dir isn't long enough, do not bother with it
      if self.LV.top_dir.count('/') < 2:
         self.LV.top_dir = ''
         if self.cvars.verb > 2: print '   (top_dir not worth using...)'

      return 0
    def set_directories(self):
        """always use $top_dir with absolute paths to datasets
      """

        inputs = [self.uvars.surf_vol, self.uvars.spec_file]
        if self.cvars.val("on_surface") != "yes":
            inputs.append(self.uvars.vol_mask)

        # try converting to absolute paths
        try:
            inputs = [os.path.abspath(fname) for fname in inputs]
        except:
            msg = "** cannot convert inputs to asolute path names:\n   %s" % inputs
            self.errors.append(msg)
            return 1

        top_dir, parent_dirs, short_dirs, short_names = UTIL.common_parent_dirs([inputs])

        self.LV.top_dir = parent_dirs[0]  # common parent dir
        self.LV.short_names = short_names  # if top_dir is used, they are under it

        if self.cvars.verb > 2:
            if self.cvars.val("on_surface") != "yes":
                print "-- set_dirs: top_dir         = %s\n" "             short surf_vol  = %s\n" "             short spec_file = %s\n" "             short vol_mask  = %s\n" % (
                    self.LV.top_dir,
                    short_names[0][0],
                    short_names[0][1],
                    short_names[0][2],
                )
            else:  # on surface
                print "-- set_dirs: top_dir         = %s\n" "             short surf_vol  = %s\n" "             short spec_file = %s\n" % (
                    self.LV.top_dir,
                    short_names[0][0],
                    short_names[0][1],
                )

        # if top_dir isn't long enough, do not bother with it
        if self.LV.top_dir.count("/") < 2:
            self.LV.top_dir = ""
            if self.cvars.verb > 2:
                print "   (top_dir not worth using...)"

        return 0
Exemple #6
0
    def set_directories(self):
        """decide on use of top_dir (use it or nothing - no anat_dir)

         ==> if top_dir is set, use $top_dir/short_names
             else just use anat and epi directly
      """
        top_dir, parent_dirs, short_dirs, short_names =    \
                  UTIL.common_parent_dirs([[self.uvars.anat, self.uvars.epi]])

        self.LV.top_dir = parent_dirs[0]  # common parent dir
        self.LV.short_names = short_names  # if top_dir is used, they are under it

        if self.uvars.verb > 2:
            print '-- set_dirs: top_dir    = %s\n' \
                  '             short_anat = %s\n' \
                  '             short_epi  = %s\n' \
                  % (self.LV.top_dir, short_names[0][0], short_names[0][1])

        # if top_dir isn't long enough, do not bother with it
        if self.LV.top_dir.count('/') < 2:
            self.LV.top_dir = ''
            if self.uvars.verb > 2: print '   (top_dir not worth using...)'
Exemple #7
0
   def set_directories(self):
      """decide on use of top_dir (use it or nothing - no anat_dir)

         ==> if top_dir is set, use $top_dir/short_names
             else just use anat and epi directly
      """
      top_dir, parent_dirs, short_dirs, short_names =    \
                UTIL.common_parent_dirs([[self.uvars.anat, self.uvars.epi]])

      self.LV.top_dir     = parent_dirs[0]  # common parent dir
      self.LV.short_names = short_names # if top_dir is used, they are under it

      if self.uvars.verb > 2:
         print '-- set_dirs: top_dir    = %s\n' \
               '             short_anat = %s\n' \
               '             short_epi  = %s\n' \
               % (self.LV.top_dir, short_names[0][0], short_names[0][1])

      # if top_dir isn't long enough, do not bother with it
      if self.LV.top_dir.count('/') < 2:
         self.LV.top_dir = ''
         if self.uvars.verb > 2: print '   (top_dir not worth using...)'