Vizgen/vizgen-postprocessing

CellposeSegParameters.__init__() missing 2 required positional arguments

Closed this issue · 2 comments

Hi,

I am attempting to run vpt on my own dataset using the segmentation_algorithm.json file provided in the tests/data directory within this repository. I issue the following command:

vpt run-segmentation --segmentation-algorithm segmentation_algorithm.json --input-micron-to-mosaic input/micron_to_mosaic_pixel_transform.csv --output-path ./results --input-images input/'mosaic_(?P<stain>[\w|-]+[0-9]?)_z(?P<z>[0-9]+).tif'

I then receive the following error message:

exception of type <class 'TypeError'> thrown: CellposeSegParameters.__init__() missing 2 required positional arguments: 'nuclear_channel' and 'entity_fill_channel'
Traceback (most recent call last):
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/vizgen_postprocess.py", line 58, in main
    c.run(run_command, subparser_name, parsed)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/app/context.py", line 100, in run
    proc(*args)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/vizgen_postprocess.py", line 22, in run_command
    get_cmd_entrypoint(cmd)(args)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/run_segmentation/__init__.py", line 10, in run
    run_segmentation(args)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/run_segmentation/main.py", line 35, in run_segmentation
    parallel_run(pipeline_to_tasks('run-segmentation-on-tile', rot_args))
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/app/context.py", line 171, in parallel_run
    return current_context().parallel_run(tasks)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/app/context.py", line 137, in parallel_run
    return [t.proc(t.args) for t in tasks]
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/app/context.py", line 137, in <listcomp>
    return [t.proc(t.args) for t in tasks]
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/run_segmentation_on_tile/__init__.py", line 10, in run
    run_segmentation_on_tile(args)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/run_segmentation_on_tile/main.py", line 97, in run_segmentation_on_tile
    result = segmentation_on_tile(seg_spec, args.tile_index)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/run_segmentation_on_tile/main.py", line 79, in segmentation_on_tile
    tasks_result = get_tile_segmentation(seg_spec, window_info)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/run_segmentation_on_tile/main.py", line 46, in get_tile_segmentation
    seg_result = run_segmentation(images, task)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/segmentation/factory.py", line 35, in run_segmentation
    return runner(image, task.segmentation_properties, task.segmentation_parameters,
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/segmentation/cellpose/segmentation.py", line 78, in run_segmentation
    masks = cellpose_polygons_masks(images, segmentation_properties, segmentation_parameters)
  File "/mnt/disks/scratch/mbernstein/miniconda3/vizgen_vpt/lib/python3.10/site-packages/vpt/segmentation/cellpose/segmentation.py", line 37, in cellpose_polygons_masks
    parameters = CellposeSegParameters(**segmentation_parameters)

Do you have any suggestions/ideas on the cause of this error and how to fix it?

Thank you!

The data in the /tests directory contains some files that don't include all useful features (to improve execution speed) or that are intentionally malformed (to test error handling). Please use any files from the /tests directory with caution.

Could you try again with a file from the /example_analysis_algorithm directory? For Cellpose there are three options:

  • cellpose_default_1_ZLevel.json -- Optimized for a balance of speed and cell detection. Performs segmentation the cyto2 and nuclei models on a single z-layer and "harmonizes" the output.
  • cellpose_default_3_ZLevel.json -- A slower version of cellpose_default_1_ZLevel.json that performs segmentation on three z-layers. Demonstrates how 3D segmentation may be assembled from discontinuous input planes.
  • cellpose_default_3_ZLevel_nuclei_only.json -- An example of Cellpose-based segmentation with a single segmentation task that performs segmentation in 3D.

Hope that helps!

Thank you very much for your help! It seems to have completed running when using the /example_analysis_algorithm/cellpose_default_1_ZLevel.json file.