mobiedantic 0.1.0__py3-none-any.whl → 0.3.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,14 +54,32 @@ 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 = {
60
80
  'channel': channel_index,
61
81
  'relativePath': str(
62
- Path(path_dict[name]).relative_to(
63
- self.path.parent, walk_up=True
64
- )
82
+ Path(path_dict[name]).relative_to(self.path, walk_up=True)
65
83
  ),
66
84
  }
67
85
  except (ValueError, TypeError):
@@ -77,11 +95,19 @@ class Dataset:
77
95
  }
78
96
  }
79
97
  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,
98
+
99
+ def add_sources(
100
+ self,
101
+ path_dict: dict[str, Path],
102
+ *,
103
+ channel_index: int = 0,
104
+ data_format: str = 'ome.zarr',
105
+ ):
106
+ self._update_sources(
107
+ sources=self.model.sources,
108
+ path_dict=path_dict,
109
+ channel_index=channel_index,
110
+ data_format=data_format,
85
111
  )
86
112
 
87
113
  def add_merged_grid(
@@ -151,6 +177,15 @@ class Project:
151
177
  self.model.defaultDataset = name
152
178
  return Dataset(path=dataset_folder)
153
179
 
180
+ def load(self):
181
+ project_path = self.path / 'project.json'
182
+ if not project_path.exists():
183
+ message = f'Project file not found: {project_path}'
184
+ raise ValueError(message)
185
+ with open(project_path) as project_file:
186
+ data = json.loads(project_file.read())
187
+ self.model = ProjectSchema(**data)
188
+
154
189
  def save(self, *, create_directory: bool = True):
155
190
  if self.model is None:
156
191
  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.3.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=yAnWVfm-SzSK2PpJqgwOqWDMZYEaF0Hk-jN2tn-qA8A,6802
2
+ mobiedantic/generated.py,sha256=-JO7uJvjE0hpYcXeJrOKiMCayoSWN72vTHh95-I-E5g,42188
3
+ mobiedantic-0.3.0.dist-info/METADATA,sha256=Y0MWYGmWVhLWdwxqI4vjpTZmN6wSQmMjvxz9MDEUtOg,1530
4
+ mobiedantic-0.3.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
5
+ mobiedantic-0.3.0.dist-info/licenses/LICENSE.txt,sha256=Y-HLxetc9ng1nbl4Vpgg7MlEckBFenmRo16hXHxn7tw,1538
6
+ mobiedantic-0.3.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,,