Skip to content

Commit c6e291c

Browse files
committed
add create option
1 parent b05ff5b commit c6e291c

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

cellmap_flow/blockwise/blockwise_processor.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ def __init__(self, yaml_config: str, create=True):
5555
if self.workers <= 1:
5656
logger.error("Workers should be greater than 1.")
5757
return
58+
if "create" in self.config:
59+
create = self.config["create"]
60+
if isinstance(create, str):
61+
logger.warning(
62+
f"Type config[create] is str = {create}, better set a bool"
63+
)
64+
create = create.lower() == "true"
5865

5966
task_name = self.config["task_name"]
6067

@@ -124,7 +131,9 @@ def __init__(self, yaml_config: str, create=True):
124131
offset=(0, 0, 0),
125132
)
126133
except Exception as e:
127-
raise Exception(f"Failed to prepare {self.output_path/channel/'s0'} \n try deleting it manually and run again ! {e}")
134+
raise Exception(
135+
f"Failed to prepare {self.output_path/channel/'s0'} \n try deleting it manually and run again ! {e}"
136+
)
128137
else:
129138
try:
130139
array = open_ds(
@@ -147,8 +156,8 @@ def process_fn(self, block):
147156

148157
chunk_data = chunk_data.astype(self.dtype)
149158

150-
# if self.output_arrays[0][block.write_roi].any():
151-
# return
159+
if self.output_arrays[0][block.write_roi].any():
160+
return
152161

153162
for i, array in enumerate(self.output_arrays):
154163

cellmap_flow/globals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __repr__(self):
4848
def __str__(self):
4949
return f"Flow({self.__dict__})"
5050

51-
def get_output_dtype(self,model_output_dtype=None):
51+
def get_output_dtype(self, model_output_dtype=None):
5252
dtype = np.float32
5353

5454
if model_output_dtype is not None:

cellmap_flow/tmp.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# %%
2+
dataset_name = (
3+
"/Users/zouinkhim/Desktop/cellmap/cellmap-flow/tests/script_test/dummy.zarr/raw"
4+
)
5+
from cellmap_flow.image_data_interface import ImageDataInterface
6+
7+
x = ImageDataInterface(dataset_name)

0 commit comments

Comments
 (0)