示例#1
0
 def _run_interface(self, runtime):
     if isdefined(self.inputs.additional_maps):
         additional_maps = dict( (split_filename(add_map)[1],add_map) for add_map in self.inputs.additional_maps if add_map != '')
     else:
         additional_maps = {}
     
     if self.inputs.probtrackx:
         probtrackx_cmat(voxel_connectivity_files = self.inputs.track_file, roi_volumes=self.inputs.roi_volumes,
             parcellation_scheme=self.inputs.parcellation_scheme, atlas_info=self.inputs.atlas_info,
             output_types = self.inputs.output_types)
     elif len(self.inputs.track_file) > 1:
         prob_cmat(intrk=self.inputs.track_file, roi_volumes=self.inputs.roi_volumes,
          parcellation_scheme=self.inputs.parcellation_scheme,atlas_info = self.inputs.atlas_info,
          output_types=self.inputs.output_types)
     else:
         cmat(intrk=self.inputs.track_file[0], roi_volumes=self.inputs.roi_volumes,
          parcellation_scheme=self.inputs.parcellation_scheme,atlas_info = self.inputs.atlas_info,
          compute_curvature=self.inputs.compute_curvature,
          additional_maps=additional_maps,output_types=self.inputs.output_types)
          
         if 'cff' in self.inputs.output_types:
             cvt = cmtk.CFFConverter()
             cvt.inputs.title = 'Connectome mapper'
             cvt.inputs.nifti_volumes = self.inputs.roi_volumes
             cvt.inputs.tract_files = ['streamline_final.trk']
             cvt.inputs.gpickled_networks = glob.glob(os.path.abspath("connectome_*.gpickle"))
             cvt.run()
          
     return runtime
示例#2
0
    def _run_interface(self, runtime):
        if isdefined(self.inputs.additional_maps):
            additional_maps = dict((split_filename(add_map)[1], add_map)
                                   for add_map in self.inputs.additional_maps
                                   if add_map != '')
        else:
            additional_maps = {}

        if self.inputs.probtrackx:
            probtrackx_cmat(
                voxel_connectivity_files=self.inputs.track_file,
                roi_volumes=self.inputs.roi_volumes,
                parcellation_scheme=self.inputs.parcellation_scheme,
                atlas_info=self.inputs.atlas_info,
                output_types=self.inputs.output_types)
        elif len(self.inputs.track_file) > 1:
            prob_cmat(intrk=self.inputs.track_file,
                      roi_volumes=self.inputs.roi_volumes,
                      parcellation_scheme=self.inputs.parcellation_scheme,
                      atlas_info=self.inputs.atlas_info,
                      output_types=self.inputs.output_types)
        else:
            cmat(intrk=self.inputs.track_file[0],
                 roi_volumes=self.inputs.roi_volumes,
                 parcellation_scheme=self.inputs.parcellation_scheme,
                 atlas_info=self.inputs.atlas_info,
                 compute_curvature=self.inputs.compute_curvature,
                 additional_maps=additional_maps,
                 output_types=self.inputs.output_types)

            if 'cff' in self.inputs.output_types:
                cvt = cmtk.CFFConverter()
                cvt.inputs.title = 'Connectome mapper'
                cvt.inputs.nifti_volumes = self.inputs.roi_volumes
                cvt.inputs.tract_files = ['streamline_final.trk']
                cvt.inputs.gpickled_networks = glob.glob(
                    os.path.abspath("connectome_*.gpickle"))
                cvt.run()

        return runtime
 def build_matrix(self):
     #make sure you output into cmp's connectome folder
     prevdir=os.getcwd()
     os.chdir(self.sub_dir + '/NIPYPE/diffusion_pipeline/connectome_stage/compute_matrice')
     #only prob_cmat has been successfully tested as of 12.18.2015
     #cmat takes extra arguments compute_curvature and additional_maps
     #hard to say if probtrackx will work; if it doesn't, the issue's probably in generate_tracklist
     if self.probtrackx:
         probtrackx_cmat(voxel_connectivity_files = self.track_file, roi_volumes=self.roi_volumes,
          parcellation_scheme=self.parcellation_scheme, atlas_info=self.atlas_info,
          output_types = self.output_types)
     elif len(self.track_file) > 1:
         prob_cmat(intrk=self.track_file, roi_volumes=self.roi_volumes,
          parcellation_scheme=self.parcellation_scheme,atlas_info = self.atlas_info,
          output_types=self.output_types)
     else:
         additional_maps = {}
         cmat(intrk=self.track_file[0], roi_volumes=self.roi_volumes,
          parcellation_scheme=self.parcellation_scheme,atlas_info = self.atlas_info,
          compute_curvature=self.compute_curvature,
          additional_maps=additional_maps,output_types=self.output_types)
     os.chdir(prevdir)