Esempio n. 1
0
 def __init__(self, path):
     super(MultiplicativeH5, self).__init__(path)
     self.nsig = DataSet(Multiplicative.nsig, self)
     self.b = Reference(Multiplicative.b, self)
Esempio n. 2
0
 def __init__(self, path):
     super(TimeSeriesSurfaceH5, self).__init__(path)
     self.surface = Reference(TimeSeriesSurface.surface, self)
     self.labels_ordering = Json(TimeSeriesSurface.labels_ordering, self)
Esempio n. 3
0
 def __init__(self, path):
     super(TimeSeriesSurfaceH5, self).__init__(path)
     self.surface = Reference(TimeSeriesSurface.surface)
     self.labels_ordering = Json(TimeSeriesSurface.labels_ordering)
     self._end_accessor_declarations()
Esempio n. 4
0
 def __init__(self, path):
     super(ConnectivityMeasureH5, self).__init__(path)
     self.array_data = DataSet(ConnectivityMeasure.array_data, self)
     self.connectivity = Reference(ConnectivityMeasure.connectivity, self)
     self.title = Scalar(Attr(str), self, name='title')
Esempio n. 5
0
 def __init__(self, path):
     super(SimulatorH5, self).__init__(path)
     self.connectivity = Reference(Simulator.connectivity, self)
     self.conduction_speed = Scalar(Simulator.conduction_speed, self)
     self.coupling = Reference(Simulator.coupling, self)
     self.surface = Reference(Simulator.surface, self)
     self.stimulus = Reference(Simulator.stimulus, self)
     self.model = Reference(Simulator.model, self)
     self.integrator = Reference(Simulator.integrator, self)
     self.initial_conditions = DataSet(Simulator.initial_conditions, self)
     self.monitors = Json(Simulator.monitors, self)
     self.simulation_length = Scalar(Simulator.simulation_length, self)
     self.simulation_state = Reference(Attr(field_type=uuid.UUID),
                                       self,
                                       name='simulation_state')
Esempio n. 6
0
 def __init__(self, path):
     super(TimeSeriesSEEGH5, self).__init__(path)
     self.sensors = Reference(TimeSeriesSEEG.sensors, self)
     self.labels_order = Json(TimeSeriesSEEG.labels_ordering, self)
Esempio n. 7
0
 def __init__(self, path):
     super(CovarianceH5, self).__init__(path)
     self.array_data = DataSet(Covariance.array_data,
                               self,
                               expand_dimension=2)
     self.source = Reference(Covariance.source, self)
Esempio n. 8
0
 def __init__(self, path):
     super(MEGH5, self).__init__(path)
     self.projection = Reference(MEG.projection, self)
     self.sensors = Reference(MEG.sensors, self)
Esempio n. 9
0
 def __init__(self, path):
     super(iEEGH5, self).__init__(path)
     self.projection = Reference(iEEG.projection, self)
     self.sensors = Reference(iEEG.sensors, self)
     self.sigma = Scalar(iEEG.sigma, self)
Esempio n. 10
0
 def __init__(self, path):
     super(LocalConnectivityH5, self).__init__(path)
     self.surface = Reference(LocalConnectivity.surface, self)
     self.matrix = SparseMatrix(LocalConnectivity.matrix, self)
     self.equation = Scalar(Attr(str), self, name='equation')
     self.cutoff = Scalar(LocalConnectivity.cutoff, self)
Esempio n. 11
0
 def __init__(self, path):
     super(ProjectionH5, self).__init__(path)
     self.region_mapping = Reference(Projection.region_mapping, self)
     self.obnoise = Reference(Projection.obsnoise, self)
Esempio n. 12
0
 def __init__(self, path):
     super(CortexH5, self).__init__(path)
     self.local_connectivity = Reference(Cortex.local_connectivity, self)
     self.region_mapping_data = Reference(Cortex.region_mapping_data, self)
     self.coupling_strength = Scalar(Cortex.coupling_strength, self)
Esempio n. 13
0
 def __init__(self, path):
     super(StimuliRegionH5, self).__init__(path)
     self.spatial = EquationScalar(StimuliRegion.spatial, self)
     self.temporal = EquationScalar(StimuliRegion.temporal, self)
     self.connectivity = Reference(StimuliRegion.connectivity, self)
     self.weight = DataSet(StimuliRegion.weight, self)
Esempio n. 14
0
 def __init__(self, path):
     super(TimeSeriesVolumeH5, self).__init__(path)
     self.volume = Reference(TimeSeriesVolume.volume)
     self.labels_ordering = Json(TimeSeriesVolume.labels_ordering)
     self._end_accessor_declarations()
Esempio n. 15
0
 def __init__(self, path):
     super(TimeSeriesRegionH5, self).__init__(path)
     self.connectivity = Reference(TimeSeriesRegion.connectivity, self)
     self.region_mapping_volume = Reference(TimeSeriesRegion.region_mapping_volume, self)
     self.region_mapping = Reference(TimeSeriesRegion.region_mapping, self)
     self.labels_ordering = Json(TimeSeriesRegion.labels_ordering, self)
Esempio n. 16
0
 def __init__(self, path):
     super(HeadH5, self).__init__(path)
     self.title = Scalar(Head.title, self)
     self.path = Scalar(Head.path, self)
     self.connectivity = Reference(Head.connectivity, self)
     self.cortical_surface = Reference(Head.cortical_surface, self)
     self.subcortical_surface = Reference(Head.subcortical_surface, self)
     self.cortical_region_mapping = Reference(Head.cortical_region_mapping, self)
     self.subcortical_region_mapping = Reference(Head.subcortical_region_mapping, self)
     self.region_volume_mapping = Reference(Head.region_volume_mapping, self)
     self.t1 = Reference(Head.t1, self)
     self.t2 = Reference(Head.t2, self)
     self.flair = Reference(Head.flair, self)
     self.b0 = Reference(Head.b0, self)
     self.eeg_sensors = Reference(Head.eeg_sensors, self)
     self.seeg_sensors = Reference(Head.seeg_sensors, self)
     self.meg_sensors = Reference(Head.meg_sensors, self)
     self.eeg_projection = Reference(Head.eeg_projection, self)
     self.meg_projection = Reference(Head.meg_projection, self)
     self.meg_sensors = Reference(Head.meg_sensors, self)
Esempio n. 17
0
 def __init__(self, path):
     super(TimeSeriesVolumeH5, self).__init__(path)
     self.volume = Reference(TimeSeriesVolume.volume, self)
     self.labels_ordering = Json(TimeSeriesVolume.labels_ordering, self)
Esempio n. 18
0
 def __init__(self, path):
     super(StructuralMRIH5, self).__init__(path)
     self.array_data = DataSet(StructuralMRI.array_data, self)
     self.weighting = Scalar(StructuralMRI.weighting, self)
     self.volume = Reference(StructuralMRI.volume, self)
Esempio n. 19
0
 def __init__(self, path):
     super(FooFile, self).__init__(path)
     self.array_float = DataSet(FooDatatype.array_float, self)
     self.array_int = DataSet(FooDatatype.array_int, self)
     self.scalar_int = Scalar(FooDatatype.scalar_int, self)
     self.abaz = Reference(FooDatatype.abaz, self)
Esempio n. 20
0
 def __init__(self, path):
     super(TractsH5, self).__init__(path)
     self.vertices = DataSet(Tracts.vertices, self, expand_dimension=0)
     self.tract_start_idx = DataSet(Tracts.tract_start_idx, self)
     self.tract_region = DataSet(Tracts.tract_region, self)
     self.region_volume_map = Reference(Tracts.region_volume_map, self)
Esempio n. 21
0
 def __init__(self, path):
     super(CorrelationCoefficientsH5, self).__init__(path)
     self.array_data = DataSet(CorrelationCoefficients.array_data, self)
     self.source = Reference(CorrelationCoefficients.source, self)
     self.labels_ordering = Json(CorrelationCoefficients.labels_ordering,
                                 self)
Esempio n. 22
0
 def __init__(self, path):
     super(RegionVolumeMappingH5, self).__init__(path)
     self.array_data = DataSet(RegionVolumeMapping.array_data, self)
     self.connectivity = Reference(RegionVolumeMapping.connectivity, self)
     self.volume = Reference(RegionVolumeMapping.volume, self)
Esempio n. 23
0
class SimulatorH5(SimulatorConfigurationH5):
    def __init__(self, path):
        super(SimulatorH5, self).__init__(path)
        self.connectivity = Reference(Simulator.connectivity, self)
        self.conduction_speed = Scalar(Simulator.conduction_speed, self)
        self.coupling = Reference(Simulator.coupling, self)
        self.surface = Reference(Simulator.surface, self)
        self.stimulus = Reference(Simulator.stimulus, self)
        self.model = Reference(Simulator.model, self)
        self.integrator = Reference(Simulator.integrator, self)
        self.initial_conditions = DataSet(Simulator.initial_conditions, self)
        self.monitors = Json(Simulator.monitors, self)
        self.simulation_length = Scalar(Simulator.simulation_length, self)
        self.simulation_state = Reference(Attr(field_type=uuid.UUID),
                                          self,
                                          name='simulation_state')

    def store(self, datatype, scalars_only=False, store_references=False):
        # type: (Simulator, bool, bool) -> None
        self.gid.store(datatype.gid)
        self.connectivity.store(datatype.connectivity)
        self.conduction_speed.store(datatype.conduction_speed)
        self.initial_conditions.store(datatype.initial_conditions)
        self.simulation_length.store(datatype.simulation_length)

        integrator_gid = self.store_config_as_reference(datatype.integrator)
        self.integrator.store(integrator_gid)

        coupling_gid = self.store_config_as_reference(datatype.coupling)
        self.coupling.store(coupling_gid)

        model_gid = self.store_config_as_reference(datatype.model)
        self.model.store(model_gid)

        # TODO: handle multiple monitors
        monitor_gid = self.store_config_as_reference(datatype.monitors[0])
        self.monitors.store([monitor_gid.hex])

        if datatype.surface:
            cortex_gid = self.store_config_as_reference(datatype.surface)
            self.surface.store(cortex_gid)

        if datatype.stimulus:
            self.stimulus.store(datatype.stimulus)

        self.type.store(self.get_full_class_name(type(datatype)))

    def load_into(self, datatype):
        # type: (Simulator) -> None
        datatype.conduction_speed = self.conduction_speed.load()
        datatype.initial_conditions = self.initial_conditions.load()
        datatype.simulation_length = self.simulation_length.load()
        datatype.integrator = self.load_from_reference(self.integrator.load())
        datatype.coupling = self.load_from_reference(self.coupling.load())
        datatype.model = self.load_from_reference(self.model.load())
        # TODO: handle multiple monitors
        datatype.monitors = [self.load_from_reference(self.monitors.load()[0])]
        if self.surface.load():
            datatype.surface = self.load_from_reference(self.surface.load())
Esempio n. 24
0
 def __init__(self, path):
     super(DatatypeMeasureH5, self).__init__(path)
     # Actual measure (dictionary Algorithm: single Value)
     self.metrics = Json(Attr(str), self, name='metrics')
     # DataType for which the measure was computed.
     self.analyzed_datatype = Reference(Attr(field_type=TimeSeries), self, "analyzed_datatype")
Esempio n. 25
0
 def __init__(self, path):
     super(ConnectivityAnnotationsH5, self).__init__(path)
     self.region_annotations = DataSet(
         ConnectivityAnnotations.region_annotations, self)
     self.connectivity = Reference(ConnectivityAnnotations.connectivity,
                                   self)
Esempio n. 26
0
 def __init__(self, path):
     super(IntegratorStochasticH5, self).__init__(path)
     self.noise = Reference(IntegratorStochastic.noise, self)
Esempio n. 27
0
class TimeSeriesVolumeH5(TimeSeriesH5):
    def __init__(self, path):
        super(TimeSeriesVolumeH5, self).__init__(path)
        self.volume = Reference(TimeSeriesVolume.volume, self)
        self.labels_ordering = Json(TimeSeriesVolume.labels_ordering, self)

    def store_references(self, ts):
        self.volume.store(ts.volume.gid)

    def get_volume_view(self, from_idx, to_idx, x_plane, y_plane, z_plane,
                        **kwargs):
        """
        Retrieve 3 slices through the Volume TS, at the given X, y and Z coordinates, and in time [from_idx .. to_idx].

        :param from_idx: int This will be the limit on the first dimension (time)
        :param to_idx: int Also limit on the first Dimension (time)
        :param x_plane: int coordinate
        :param y_plane: int coordinate
        :param z_plane: int coordinate

        :return: An array of 3 Matrices 2D, each containing the values to display in planes xy, yz and xy.
        """

        overall_shape = self.data.shape
        from_idx, to_idx, time = preprocess_time_parameters(
            from_idx, to_idx, overall_shape[0])
        x_plane, y_plane, z_plane = preprocess_space_parameters(
            x_plane, y_plane, z_plane, overall_shape[1], overall_shape[2],
            overall_shape[3])

        slices = slice(from_idx, to_idx), slice(overall_shape[1]), slice(
            overall_shape[2]), slice(z_plane, z_plane + 1)
        slicex = self.read_data_slice(slices)[:, :, :, 0].tolist()

        slices = slice(from_idx, to_idx), slice(x_plane, x_plane + 1), slice(
            overall_shape[2]), slice(overall_shape[3])
        slicey = self.read_data_slice(slices)[:, 0, :, :][..., ::-1].tolist()

        slices = slice(from_idx, to_idx), slice(overall_shape[1]), slice(
            y_plane, y_plane + 1), slice(overall_shape[3])
        slicez = self.read_data_slice(slices)[:, :, 0, :][..., ::-1].tolist()

        return [slicex, slicey, slicez]

    def get_voxel_time_series(self, x, y, z, **kwargs):
        """
        Retrieve for a given voxel (x,y,z) the entire timeline.

        :param x: int coordinate
        :param y: int coordinate
        :param z: int coordinate

        :return: A complex dictionary with information about current voxel.
                The main part will be a vector with all the values over time from the x,y,z coordinates.
        """

        overall_shape = self.data.shape
        x, y, z = preprocess_space_parameters(x, y, z, overall_shape[1],
                                              overall_shape[2],
                                              overall_shape[3])

        slices = prepare_time_slice(overall_shape[0]), slice(x, x + 1), slice(
            y, y + 1), slice(z, z + 1)

        result = postprocess_voxel_ts(self, slices)
        return result
Esempio n. 28
0
 def __init__(self, path):
     super(StimuliRegionH5, self).__init__(path)
     self.spatial = Scalar(Attr(str), self, name='spatial')
     self.temporal = Scalar(Attr(str), self, name='temporal')
     self.connectivity = Reference(StimuliRegion.connectivity, self)
     self.weight = DataSet(StimuliRegion.weight, self)