mobiedantic 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mobiedantic/__init__.py CHANGED
@@ -54,6 +54,26 @@ class Dataset:
54
54
  data_format: str = 'ome.zarr',
55
55
  ) -> None:
56
56
  sources = {}
57
+ self._update_sources(
58
+ sources=sources,
59
+ path_dict=path_dict,
60
+ channel_index=channel_index,
61
+ data_format=data_format,
62
+ )
63
+ views_dict = {'default': {'uiSelectionGroup': 'view', 'isExclusive': True}}
64
+ self.model = DatasetSchema(
65
+ is2D=is2d,
66
+ sources=sources,
67
+ views=views_dict,
68
+ )
69
+
70
+ def _update_sources(
71
+ self,
72
+ sources: dict[str, Source],
73
+ path_dict: dict[str, Path],
74
+ channel_index: int = 0,
75
+ data_format: str = 'ome.zarr',
76
+ ):
57
77
  for name in path_dict:
58
78
  try:
59
79
  source_path = {
@@ -77,11 +97,19 @@ class Dataset:
77
97
  }
78
98
  }
79
99
  sources[name] = Source(**data)
80
- views_dict = {'default': {'uiSelectionGroup': 'view', 'isExclusive': True}}
81
- self.model = DatasetSchema(
82
- is2D=is2d,
83
- sources=sources,
84
- views=views_dict,
100
+
101
+ def add_sources(
102
+ self,
103
+ path_dict: dict[str, Path],
104
+ *,
105
+ channel_index: int = 0,
106
+ data_format: str = 'ome.zarr',
107
+ ):
108
+ self._update_sources(
109
+ sources=self.model.sources,
110
+ path_dict=path_dict,
111
+ channel_index=channel_index,
112
+ data_format=data_format,
85
113
  )
86
114
 
87
115
  def add_merged_grid(
@@ -151,6 +179,15 @@ class Project:
151
179
  self.model.defaultDataset = name
152
180
  return Dataset(path=dataset_folder)
153
181
 
182
+ def load(self):
183
+ project_path = self.path / 'project.json'
184
+ if not project_path.exists():
185
+ message = f'Project file not found: {project_path}'
186
+ raise ValueError(message)
187
+ with open(project_path) as project_file:
188
+ data = json.loads(project_file.read())
189
+ self.model = ProjectSchema(**data)
190
+
154
191
  def save(self, *, create_directory: bool = True):
155
192
  if self.model is None:
156
193
  message = 'Project not initialized.'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mobiedantic
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Project-URL: Documentation, https://github.com/fmi-faim/mobiedantic#readme
5
5
  Project-URL: Issues, https://github.com/fmi-faim/mobiedantic/issues
6
6
  Project-URL: Source, https://github.com/fmi-faim/mobiedantic
@@ -0,0 +1,6 @@
1
+ mobiedantic/__init__.py,sha256=K0jS3QCA5ropk8BjRlB8nIcPH901S3T8_XGcQhrizyw,6863
2
+ mobiedantic/generated.py,sha256=-JO7uJvjE0hpYcXeJrOKiMCayoSWN72vTHh95-I-E5g,42188
3
+ mobiedantic-0.2.0.dist-info/METADATA,sha256=mzA17AtyKupM3eeFvj3DSxiMSDCWR-wmX9XNAXiwpG8,1530
4
+ mobiedantic-0.2.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
5
+ mobiedantic-0.2.0.dist-info/licenses/LICENSE.txt,sha256=Y-HLxetc9ng1nbl4Vpgg7MlEckBFenmRo16hXHxn7tw,1538
6
+ mobiedantic-0.2.0.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- mobiedantic/__init__.py,sha256=rpenqUxecKc9rW5v0jaDQT2p0ICCilMze_kJjt7fXwM,5783
2
- mobiedantic/generated.py,sha256=-JO7uJvjE0hpYcXeJrOKiMCayoSWN72vTHh95-I-E5g,42188
3
- mobiedantic-0.1.0.dist-info/METADATA,sha256=KaGUBkkhkZYIRDblIu2WW5TBvMzZzGQar2rcqAASTF8,1530
4
- mobiedantic-0.1.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
5
- mobiedantic-0.1.0.dist-info/licenses/LICENSE.txt,sha256=Y-HLxetc9ng1nbl4Vpgg7MlEckBFenmRo16hXHxn7tw,1538
6
- mobiedantic-0.1.0.dist-info/RECORD,,