Skip to content

update http_tensorstore #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 123 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
8aa687c
Force script variable definitions to usable type.
rhoadesScholar Jan 29, 2025
8d7ffb5
Change log level from error to info when opening dataset files
rhoadesScholar Jan 29, 2025
16d7b23
Refactor server_check function to accept script path and dataset as a…
rhoadesScholar Jan 29, 2025
c166d9b
Merge branch 'main' into script_type_fix
rhoadesScholar Jan 29, 2025
fb56154
Add confirmation message for successful server check
rhoadesScholar Jan 29, 2025
8104ef1
Add script server check command to CLI for model validation
rhoadesScholar Jan 29, 2025
ebcaa5f
Revert server_check.py to use hardcoded script path and dataset; add …
rhoadesScholar Jan 29, 2025
36842e5
Fix model_setup04.py and server_check.py for improved readability and…
rhoadesScholar Jan 29, 2025
c90fc31
Merge pull request #15 from janelia-cellmap/main
rhoadesScholar Jan 29, 2025
9bc8706
fix typo
mzouink Jan 30, 2025
6a5891f
Merge pull request #17 from janelia-cellmap/norm
mzouink Jan 30, 2025
489162f
Merge pull request #20 from janelia-cellmap/main
rhoadesScholar Jan 30, 2025
9e9d476
Merge pull request #13 from janelia-cellmap/script_type_fix
mzouink Jan 30, 2025
7edcc31
feat: :sparkles: work on embedding a share url in a ui page; starts u…
davidackerman Jan 31, 2025
3a5eec0
fix: :bug: fix which config input_normalizer was assigned to
davidackerman Jan 31, 2025
786f16a
minor fix
mzouink Jan 31, 2025
8afbd44
Merge branch 'main' into postprocessing
davidackerman Jan 31, 2025
b4586d1
support multiscale
mzouink Jan 31, 2025
bd70958
feat: :construction: load in file for configuration so that you can c…
davidackerman Jan 31, 2025
cca3e50
update norm
mzouink Jan 31, 2025
9c75ef7
add needed deps
mzouink Jan 31, 2025
3af671f
organize
mzouink Jan 31, 2025
5068511
styling
mzouink Jan 31, 2025
7edd7c0
inject code
mzouink Jan 31, 2025
22c0ddc
inject code
mzouink Jan 31, 2025
18ce592
import model from yaml
mzouink Feb 1, 2025
7b89a25
merge main
mzouink Feb 3, 2025
3187c0d
globals
mzouink Feb 3, 2025
aaa61e2
globals
mzouink Feb 3, 2025
2d72cae
norm
mzouink Feb 4, 2025
efc99cd
no needs for input norms
mzouink Feb 4, 2025
1ece404
working norm
mzouink Feb 4, 2025
ccc26bc
perf: :zap: add voxel size to bioimage model based on input dataset
davidackerman Feb 5, 2025
ed4fd18
chore: :arrow_up: upgrade bioimage dependency and updates to inferenc…
davidackerman Feb 5, 2025
5c9f6e8
fix: :bug: fix issues where non-uniform block_shapes are used
davidackerman Feb 5, 2025
3d145a2
refactor: :recycle: move stuff around
davidackerman Feb 5, 2025
5cc93b9
Merge pull request #24 from janelia-cellmap/nonuniform_chunkshape_fix
davidackerman Feb 5, 2025
e0c1d23
feat:
davidackerman Feb 6, 2025
2ba5708
Merge branch 'main' into bioimage
davidackerman Feb 6, 2025
70f1fd8
fix: :bug: adjust shape appropriately when input and output resolutio…
davidackerman Feb 6, 2025
df652ef
Merge pull request #25 from janelia-cellmap/input_output_resolution_m…
davidackerman Feb 6, 2025
63a985e
Merge branch 'main' into bioimage
davidackerman Feb 6, 2025
39edac6
lambda functions and others
mzouink Feb 6, 2025
7446b7d
example omnx
mzouink Feb 6, 2025
df2a3d4
support different resolution input/output
mzouink Feb 6, 2025
9ffec8b
Merge branch 'main' into postprocessing
mzouink Feb 7, 2025
83f918e
feat: :sparkles: can now load and run bioimage models
davidackerman Feb 7, 2025
d470830
feat: :sparkles: add command line option to set a desired bioimage ch…
davidackerman Feb 7, 2025
19cfb73
fix: :bug: dont raise warning
davidackerman Feb 10, 2025
944044f
pin cellpose version
davidackerman Feb 20, 2025
ecc23a2
minor fix
mzouink Feb 24, 2025
bf7a688
Merge pull request #23 from janelia-cellmap/postprocessing
mzouink Feb 24, 2025
080cc26
postprocess
mzouink Feb 24, 2025
881c3dd
Merge branch 'main' into postprocessing
mzouink Feb 24, 2025
271b070
working
mzouink Feb 24, 2025
de6e45f
Merge branch 'postprocessing' of https://github.com/janelia-cellmap/c…
mzouink Feb 24, 2025
616d860
postprocess
mzouink Feb 24, 2025
d5deaec
models from yaml
mzouink Feb 25, 2025
af933f9
in progress
mzouink Feb 25, 2025
177ab94
begin implementaiton of affinities task and blockwise merging
davidackerman Feb 26, 2025
ca4163e
working
mzouink Feb 26, 2025
193c8ae
equivalences work, but slow
davidackerman Feb 26, 2025
dfc909d
post equivalences, but commented
davidackerman Feb 26, 2025
cd870f4
feat: :sparkles: equivalence updating works, also now postprocessing …
davidackerman Feb 27, 2025
8252aba
minor fixes
mzouink Feb 28, 2025
4928abf
models readme
mzouink Feb 28, 2025
bc87064
perf: :zap: rather than trying to find a free port, have flask do it …
davidackerman Feb 28, 2025
30247c9
formatting
davidackerman Feb 28, 2025
eeadf87
feat: :sparkles: add output channel selection to save memory usage an…
davidackerman Feb 28, 2025
d5f70de
perf: :zap: finish implementation of equivalences and channel selection
davidackerman Feb 28, 2025
6861259
include pymorton and mwatershed for equivalences in pyproject.toml
davidackerman Feb 28, 2025
50dedd8
revertted changes, and fixed output types and channel issues
davidackerman Mar 1, 2025
6502fc7
Merge branch 'models' into postprocessing_updates
davidackerman Mar 1, 2025
0cbecb4
set default half prediction to true
davidackerman Mar 2, 2025
9cd2355
normalize at run
mzouink Mar 2, 2025
20d338f
feat: :sparkles: add morton relabeling so each set of block segmentat…
davidackerman Mar 2, 2025
4e75f87
feat: :sparkles: include option to thin segmentations add block bound…
davidackerman Mar 2, 2025
6c8a42e
fix: :bug: some hacky fixes for specific n5 attributes and anisotropi…
davidackerman Mar 2, 2025
d844d9c
autosubmit models
mzouink Mar 2, 2025
e81dc2d
submit on enter
mzouink Mar 2, 2025
8e27960
Relative path
mzouink Mar 2, 2025
ab8afdc
feat: :sparkles: add cellpose model
davidackerman Mar 3, 2025
ef25b07
use global queue
mzouink Mar 3, 2025
5552883
begin implementing ability to use uint16s
davidackerman Mar 3, 2025
172fb8f
Merge pull request #33 from janelia-cellmap/postprocessing_updates
mzouink Mar 3, 2025
ad88043
Merge branch 'main' into models
mzouink Mar 3, 2025
13a5daa
Merge pull request #31 from janelia-cellmap/models
mzouink Mar 3, 2025
224d7d8
Merge branch 'main' into cellpose
mzouink Mar 3, 2025
4741133
Merge pull request #32 from janelia-cellmap/cellpose
mzouink Mar 3, 2025
dd6a907
black formatting
mzouink Mar 3, 2025
f8d5b9c
rust
mzouink Mar 3, 2025
6e3fb67
Merge branch 'main' into bioimage
mzouink Mar 3, 2025
9b5545a
Merge pull request #34 from janelia-cellmap/bioimage
mzouink Mar 3, 2025
7a03c3a
minor fix
mzouink Mar 3, 2025
0347d13
Merge branch 'main' of https://github.com/janelia-cellmap/cellmap-flow
mzouink Mar 3, 2025
53ac622
up version
mzouink Mar 4, 2025
7859815
fix: begin fix for updating equivalences for specific dataset
davidackerman Mar 4, 2025
f55e72a
get ip
mzouink Mar 4, 2025
48e0898
url
mzouink Mar 4, 2025
44f44d6
Merge pull request #35 from janelia-cellmap/fix_local
mzouink Mar 4, 2025
d10f713
fix: :bug: equivalences are now posted to the layer they refer to
davidackerman Mar 4, 2025
4b42906
Merge branch 'main' into fix_posting
davidackerman Mar 4, 2025
a9dbba5
include fastremap in pyproject.toml
davidackerman Mar 4, 2025
78c04dc
user models
mzouink Mar 4, 2025
daa33fc
Merge branch 'main' into fix_local
mzouink Mar 4, 2025
51f6914
add time to dataset_name so that it is always unique, fixes some issu…
davidackerman Mar 4, 2025
03ae807
fix: fix n5_block_shape to be updated if num channels changes
davidackerman Mar 5, 2025
a3fff4d
fixes issue when revert channels back
davidackerman Mar 5, 2025
d5f5ddb
Merge pull request #37 from janelia-cellmap/fix_posting
davidackerman Mar 5, 2025
ff39152
add global even no model
mzouink Mar 5, 2025
c557cf3
Merge branch 'fix_local' of https://github.com/janelia-cellmap/cellma…
mzouink Mar 5, 2025
0a1848f
Merge branch 'main' into fix_local
mzouink Mar 5, 2025
fb5a88a
Merge pull request #38 from janelia-cellmap/fix_local
mzouink Mar 5, 2025
0aa6fa6
feat: :sparkles: postprocessing output dtype and segmentation-ness ca…
davidackerman Mar 6, 2025
b01555e
update output layer type
davidackerman Mar 6, 2025
2b70bfa
feat: add back in public data store capabilities
davidackerman Mar 6, 2025
11055d3
Merge pull request #39 from janelia-cellmap/channel_selection_update
davidackerman Mar 6, 2025
ce3dcde
Merge branch 'main' into public_data_stores
davidackerman Mar 6, 2025
6fcbca7
add s3fs to pyproject
davidackerman Mar 6, 2025
ee55504
Merge pull request #40 from janelia-cellmap/public_data_stores
davidackerman Mar 6, 2025
69102fa
Fix config
mzouink Mar 14, 2025
9ca3dc2
Merge pull request #41 from janelia-cellmap/mzouink/Fixconf
mzouink Mar 14, 2025
b9275b6
Merge branch 'http_tensorstore' into main
rhoadesScholar Jun 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To run existing model need to do :
```bash
cellmap_flow cellmap-model -n NAME -f /nrs/cellmap/models/[GROUP]/[MODEL_NAME] -P Billing_group -d DATA_PATH
```

# Existing models:
- Cellmap
- jrc_mus-livers_16nm_to_8nm_mito
- jrc_mus-livers_16nm_to_8nm_peroxisome
- saalfeldlab
- fly_organelles_run07_432000
- fly_organelles_run07_700000
- fly_organelles_run08_438000
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ Please feel free to explore and contribute, but note that there may be frequent

</div>

## Prerequisites

This package requires Rust and Cargo to compile native extensions. Please ensure you have Rust installed before proceeding.

1. **Install Rust:**
Visit [rustup.rs](https://rustup.rs/) and follow the instructions to install Rust. This installation will also include Cargo, Rust’s package manager.

2. **Verify Cargo Installation:**
Open your terminal and run:
```bash
cargo --version
```
You should see the Cargo version output, which confirms that Cargo is installed and accessible.


## Installation

Expand Down
102 changes: 76 additions & 26 deletions cellmap_flow/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
import logging
import click

from cellmap_flow.utils.bsub_utils import start_hosts
from cellmap_flow.utils.neuroglancer_utils import generate_neuroglancer_link
from cellmap_flow.server import CellMapFlowServer
from cellmap_flow.utils.bsub_utils import start_hosts, SERVER_COMMAND
from cellmap_flow.utils.data import ScriptModelConfig
from cellmap_flow.utils.neuroglancer_utils import generate_neuroglancer_url


logging.basicConfig()

logger = logging.getLogger(__name__)


SERVER_COMMAND = "cellmap_flow_server"


@click.group()
@click.option(
"--log-level",
Expand Down Expand Up @@ -83,12 +82,7 @@ def cli(log_level):
)
def dacapo(run_name, iteration, data_path, queue, charge_group):
command = f"{SERVER_COMMAND} dacapo -r {run_name} -i {iteration} -d {data_path}"
run(
command,
data_path,
queue,
charge_group,
)
run(command, data_path, queue, charge_group, run_name)
raise NotImplementedError("This command is not yet implemented.")


Expand Down Expand Up @@ -121,7 +115,8 @@ def dacapo(run_name, iteration, data_path, queue, charge_group):
)
def script(script_path, data_path, queue, charge_group):
command = f"{SERVER_COMMAND} script -s {script_path} -d {data_path}"
run(command, data_path, queue, charge_group)
base_name = script_path.split("/")[-1].split(".")[0]
run(command, data_path, queue, charge_group, base_name)


@cli.command()
Expand All @@ -131,6 +126,13 @@ def script(script_path, data_path, queue, charge_group):
@click.option(
"-d", "--data_path", required=True, type=str, help="The path to the data."
)
@click.option(
"-e",
"--edge_length_to_process",
required=False,
type=int,
help="For 2D models, the desired edge length of the chunk to process; batch size (z) will be adjusted to match as close as possible.",
)
@click.option(
"-q",
"--queue",
Expand All @@ -147,22 +149,70 @@ def script(script_path, data_path, queue, charge_group):
help="The chargeback group to use when submitting",
default=None,
)
def bioimage(model_path, data_path, queue, charge_group):
command = f"{SERVER_COMMAND} bioimage -m {model_path} -d {data_path}"
run(command, data_path, queue, charge_group)

def bioimage(model_path, data_path, edge_length_to_process, queue, charge_group):
command = f"{SERVER_COMMAND} bioimage -m {model_path} -d {data_path} -e {edge_length_to_process}"
base_name = model_path.split("/")[-1].split(".")[0]
run(command, data_path, queue, charge_group, base_name)


@cli.command()
@click.option(
"-f", "--config_folder", required=True, type=str, help="Path to the model folder"
)
@click.option("-n", "--name", required=True, type=str, help="Name of the model")
@click.option(
"-d", "--data_path", required=True, type=str, help="The path to the data."
)
@click.option(
"-q",
"--queue",
required=False,
type=str,
help="The queue to use when submitting",
default="gpu_h100",
)
@click.option(
"-P",
"--charge_group",
required=False,
type=str,
help="The chargeback group to use when submitting",
default=None,
)
def cellmap_model(config_folder, name, data_path, queue, charge_group):
"""Run the CellMapFlow with a CellMap model."""
command = (
f"{SERVER_COMMAND} cellmap-model -f {config_folder} -n {name} -d {data_path}"
)
run(command, data_path, queue, charge_group, name)



@cli.command()
@click.option(
"--script_path",
"-s",
type=str,
help="Path to the Python script containing model specification",
)
@click.option("--dataset", "-d", type=str, help="Path to the dataset")
def script_server_check(script_path, dataset):
model_config = ScriptModelConfig(script_path=script_path)
server = CellMapFlowServer(dataset, model_config)
chunk_x = 2
chunk_y = 2
chunk_z = 2

server._chunk_impl(None, None, chunk_x, chunk_y, chunk_z, None)

print("Server check passed")

def run(
command,
dataset_path,
queue,
charge_group,
):

host = start_hosts(command, queue, charge_group)
if host is None:
raise Exception("Could not start host")
def run(command, dataset_path, queue, charge_group, name):

inference_dict = {host: "prediction"}
start_hosts(command, queue, charge_group, name)

generate_neuroglancer_link(dataset_path, inference_dict)
neuroglancer_url = generate_neuroglancer_url(dataset_path)
while True:
pass
76 changes: 55 additions & 21 deletions cellmap_flow/cli/multiple_cli.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import sys
from cellmap_flow.utils.data import DaCapoModelConfig, BioModelConfig, ScriptModelConfig
from cellmap_flow.utils.data import (
DaCapoModelConfig,
BioModelConfig,
ScriptModelConfig,
CellMapModelConfig,
)
import logging
from cellmap_flow.utils.bsub_utils import start_hosts
from cellmap_flow.utils.neuroglancer_utils import generate_neuroglancer_link
from cellmap_flow.utils.bsub_utils import start_hosts, SERVER_COMMAND
from cellmap_flow.utils.neuroglancer_utils import generate_neuroglancer_url
import cellmap_flow.globals as g


data_args = ["-d", "--data-path"]
charge_back_arg = ["-P", "--project"]
charge_group_arg = ["-P", "--project"]
server_queue_arg = ["-q", "--queue"]

DEFAULT_SERVER_QUEUE = "gpu_h100"

SERVER_COMMAND = "cellmap_flow_server"

logger = logging.getLogger(__name__)

Expand All @@ -29,6 +34,10 @@ def main():

args = sys.argv[1:]

if "--help" in args:
print(main.__doc__)
sys.exit(0)

if not args:
logger.error("No arguments provided.")
sys.exit(1)
Expand All @@ -37,7 +46,7 @@ def main():
logger.error("Missing required argument: --data-path")
sys.exit(1)

if charge_back_arg[0] not in args and charge_back_arg[1] not in args:
if charge_group_arg[0] not in args and charge_group_arg[1] not in args:
logger.error("Missing required argument: --project")
sys.exit(1)

Expand All @@ -47,7 +56,12 @@ def main():
)
args.extend([server_queue_arg[0], DEFAULT_SERVER_QUEUE])

if "--dacapo" not in args and "--script" not in args and "--bioimage" not in args:
if (
"--dacapo" not in args
and "--script" not in args
and "--bioimage" not in args
and "--cellmap-model" not in args
):
logger.error(
"Missing required argument at least one should exist: --dacapo, --script, or --bioimage"
)
Expand All @@ -58,16 +72,16 @@ def main():

# Extract data path
data_path = None
charge_back = None
charge_group = None
queue = None
models = []

for i, arg in enumerate(args):
if arg in charge_back_arg:
if charge_back is not None:
if arg in charge_group_arg:
if charge_group is not None:
logger.error("Multiple charge back projects provided.")
sys.exit(1)
charge_back = args[i + 1]
charge_group = args[i + 1]
if arg in server_queue_arg:
if queue is not None:
logger.error("Multiple server queues provided.")
Expand All @@ -84,7 +98,7 @@ def main():
logger.error("Data path not provided.")
sys.exit(1)

if not charge_back:
if not charge_group:
logger.error("Charge back project not provided.")
sys.exit(1)

Expand Down Expand Up @@ -126,6 +140,26 @@ def main():
i = j
continue

if token == "--cellmap-model":
config_folder = None
name = None
j = i + 1
while j < len(args) and not args[j].startswith("--"):
if args[j] in ("-f", "--config_folder"):
config_folder = args[j + 1]
j += 2
elif args[j] in ("-n", "--name"):
name = args[j + 1]
j += 2
else:
j += 1
if not config_folder:
logger.error(
"Missing -c/--config_folder for --celmmap-model sub-command."
)
sys.exit(1)
models.append(CellMapModelConfig(config_folder, name=name))

elif token == "--script":
# We expect: --script -s script_path -n "some name"
script_path = None
Expand Down Expand Up @@ -182,21 +216,21 @@ def main():
for model in models:
print(model)

run_multiple(models, data_path, charge_back, queue)
run_multiple(models, data_path, charge_group, queue)


if __name__ == "__main__":
main()


def run_multiple(models, dataset_path, charge_back, queue):
inference_dict = {}
def run_multiple(models, dataset_path, charge_group, queue):
g.queue = queue
g.charge_group = charge_group
for model in models:
command = f"{SERVER_COMMAND} {model.command} -d {dataset_path}"
host = start_hosts(
command, job_name=model.name, queue=queue, charge_group=charge_back
start_hosts(
command, job_name=model.name, queue=queue, charge_group=charge_group
)
if host is None:
raise Exception("Could not start host")
inference_dict[host] = model.name
generate_neuroglancer_link(dataset_path, inference_dict)
generate_neuroglancer_url(dataset_path)
while True:
pass
Loading