Example #1
0
    def read_head(self, path):
        """
        :param path: Path towards a custom head folder
        :return: Head object
        """
        self.logger.info("Starting to read Head from: %s" % path)
        conn = self.read_connectivity(
            os.path.join(path, self.connectivity_filename))
        srf = self.read_surface(
            os.path.join(path, self.cortical_surface_filename))
        rm = self.read_region_mapping(
            os.path.join(path, self.region_mapping_filename))
        vm = self.read_volume_mapping(
            os.path.join(path, self.volume_mapping_filename))
        t1 = self.read_t1(os.path.join(path, self.structural_mri_filename))
        sensorsSEEG, sensorsEEG, sensorsMEG = self.read_sensors(path)

        head = Head(conn,
                    srf,
                    rm,
                    vm,
                    t1,
                    path,
                    sensorsSEEG=sensorsSEEG,
                    sensorsEEG=sensorsEEG,
                    sensorsMEG=sensorsMEG)
        self.logger.info("Successfully read Head from: %s" % path)

        return head
Example #2
0
    def _prepare_dummy_head(self):
        reader = H5Reader()
        connectivity = reader.read_connectivity(
            os.path.join(self.config.input.HEAD, "Connectivity.h5"))
        cort_surface = Surface([], [])
        seeg_sensors = Sensors(numpy.array(["sens1", "sens2"]),
                               numpy.array([[0, 0, 0], [0, 1, 0]]))
        head = Head(connectivity, cort_surface, sensorsSEEG=seeg_sensors)

        return head
Example #3
0
 def read_head(
     self,
     root_folder,
     name='',
     connectivity_file="connectivity.zip",
     surface_file="surface.zip",
     region_mapping_file="region_mapping.txt",
     eeg_sensors_files=[("eeg_brainstorm_65.txt",
                         "gain_matrix_eeg_65_surface_16k.npy")],
     meg_sensors_files=[("meg_brainstorm_276.txt",
                         "gain_matrix_meg_276_surface_16k.npy")],
     seeg_sensors_files=[("seeg_588.txt",
                          "gain_matrix_seeg_588_surface_16k.npy")],
 ):
     conn = self.read_connectivity(
         os.path.join(root_folder, connectivity_file))
     srf = self.read_cortical_surface(
         os.path.join(root_folder, surface_file))
     rm = self.read_region_mapping(
         os.path.join(root_folder, region_mapping_file))
     vm = None
     t1 = None
     sensorsSEEG = []
     for s_files in ensure_list(seeg_sensors_files):
         sensorsSEEG.append(
             self.read_sensors(s_files, root_folder, Sensors.TYPE_SEEG))
     sensorsEEG = []
     for s_files in ensure_list(eeg_sensors_files):
         sensorsEEG.append(
             self.read_sensors(s_files, root_folder, Sensors.TYPE_EEG))
     sensorsMEG = []
     for s_files in ensure_list(meg_sensors_files):
         sensorsMEG.append(
             self.read_sensors(s_files, root_folder, Sensors.TYPE_MEG))
     return Head(conn,
                 srf,
                 rm,
                 vm,
                 t1,
                 name,
                 sensorsSEEG=sensorsSEEG,
                 sensorsEEG=sensorsEEG,
                 sensorsMEG=sensorsMEG)
Example #4
0
 def _prepare_dummy_head_from_dummy_attrs(self):
     return Head(self.dummy_connectivity,
                 self.dummy_surface,
                 sensorsSEEG=[self.dummy_sensors])