From 6de372c0ae6d2737fbd2799d35757446409300bb Mon Sep 17 00:00:00 2001 From: rhoadesScholar Date: Wed, 24 Apr 2024 16:50:13 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=8E=A8=20Make=20datasplit=20from?= =?UTF-8?q?=20csv=20consistent=20with=20DaCapo=20convention?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cellmap_data/datasplit.py | 9 +++++++-- src/cellmap_data/image.py | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cellmap_data/datasplit.py b/src/cellmap_data/datasplit.py index 78cf221..ae4b9a9 100644 --- a/src/cellmap_data/datasplit.py +++ b/src/cellmap_data/datasplit.py @@ -1,4 +1,5 @@ import csv +import os from typing import Callable, Dict, Iterable, Mapping, Optional, Sequence import tensorstore from .dataset import CellMapDataset @@ -27,7 +28,6 @@ class CellMapDataSplit: force_has_data: bool = False context: Optional[tensorstore.Context] = None # type: ignore - # TODO: may want different transforms for different arrays def __init__( self, input_arrays: dict[str, dict[str, Sequence[int | float]]], @@ -116,7 +116,12 @@ def from_csv(self, csv_path): for row in reader: if row[0] not in dataset_dict: dataset_dict[row[0]] = [] - dataset_dict[row[0]].append({"raw": row[1], "gt": row[2]}) + dataset_dict[row[0]].append( + { + "raw": os.path.join(row[1], row[2]), + "gt": os.path.join(row[3], row[4]), + } + ) self.dataset_dict = dataset_dict self.construct(dataset_dict) diff --git a/src/cellmap_data/image.py b/src/cellmap_data/image.py index 9ff060c..defb898 100644 --- a/src/cellmap_data/image.py +++ b/src/cellmap_data/image.py @@ -31,6 +31,7 @@ def __init__( target_voxel_shape: Sequence[int], axis_order: str | Sequence[str] = "zyx", value_transform: Optional[Callable] = None, + # TODO: Add global grid enforcement to ensure that all images are on the same grid context: Optional[tensorstore.Context] = None, # type: ignore ): """Initializes a CellMapImage object. @@ -98,6 +99,7 @@ def to(self, device: str) -> None: """Sets what device returned image data will be loaded onto.""" self.device = device + # TODO: move into __init__ def construct(self): self._bounding_box = None self._sampling_box = None