|
10 | 10 |
|
11 | 11 | from __future__ import annotations |
12 | 12 |
|
13 | | -from pathlib import Path |
14 | 13 | from typing import TYPE_CHECKING, Any, cast |
15 | 14 |
|
16 | 15 | import yaml |
|
30 | 29 | from neuromaps_prime.resources import NEUROMAPSPRIME_GRAPH |
31 | 30 |
|
32 | 31 | if TYPE_CHECKING: |
| 32 | + from pathlib import Path |
| 33 | + |
33 | 34 | import networkx as nx |
34 | 35 |
|
35 | 36 |
|
@@ -201,10 +202,6 @@ def _build_volume_edge( |
201 | 202 | # Generic resource parsers # |
202 | 203 | # ------------------------------------------------------------------ # |
203 | 204 |
|
204 | | - def _resolve_path(self, path: str) -> Path: |
205 | | - """Prepend data_dir to path when set, otherwise return as-is.""" |
206 | | - return (self.data_dir / path) if self.data_dir else Path(path) |
207 | | - |
208 | 205 | def _parse_surface_annotations( |
209 | 206 | self, prefix: str, space: str, density: str, annots: dict[str, Any] |
210 | 207 | ) -> list[SurfaceAnnotation]: |
@@ -402,24 +399,28 @@ def _parse_volume_resources( |
402 | 399 | for vol_type, vol_value in types.items(): |
403 | 400 | if vol_type == "annotation": |
404 | 401 | for annot_key, annot_dict in vol_value.items(): |
| 402 | + name = f"{prefix}_{res}_{annot_key}.nii.gz" |
405 | 403 | annotations.append( |
406 | 404 | VolumeAnnotation( |
407 | | - name=f"{prefix}_{res}_{annot_key}", |
| 405 | + name=name, |
408 | 406 | space=space, |
409 | 407 | label=annot_key, |
410 | 408 | resolution=res, |
411 | | - file_path=self._resolve_path(annot_dict.get("uri")), |
| 409 | + uri=annot_dict.get("uri"), |
| 410 | + file_path=self.data_dir / name, |
412 | 411 | references=annot_dict.get("references"), |
413 | 412 | notes=annot_dict.get("notes"), |
414 | 413 | ) |
415 | 414 | ) |
416 | 415 | continue |
417 | 416 |
|
418 | 417 | extra = {"provider": provider} if is_transform else {} |
| 418 | + name = f"{prefix}_{res}_{vol_type}" |
419 | 419 | result.append( |
420 | 420 | cls( |
421 | | - name=f"{prefix}_{res}_{vol_type}", |
422 | | - file_path=self._resolve_path(vol_value), |
| 421 | + name=name, |
| 422 | + uri=vol_value, |
| 423 | + file_path=self.data_dir / name, |
423 | 424 | resolution=res, |
424 | 425 | resource_type=vol_type, |
425 | 426 | references=transform_refs, |
|
0 commit comments