Skip to content

bug when add_deepimagej_config=True in build_model #368

@esgomezm

Description

@esgomezm

Halo!

When building a model and adding the deepImageJ config with the IJ macros, if the pre and post-processing need to use the same pipeline (e.g., scale range), there is the issue of downloading just one macro rather than two different versions of it (pre+postprocessing).

For example, the following code will download the scale_linear.ijmfile twice (one for the preprocessing and one for the postprocessing) but with the same name and in the deepImageJ config, both pre and post-processing will point to the same ij macro file scale_linear.ijm but with the wrong parameters. Could it be possible to rename the downloaded macros accordingly to something like pre_scale_linear.ijm and post_scale_linear.ijm and include as such in the deepImageJ config?

# Preprocessing steps
bmz_preprpocess = [[{"name": "scale_range", "kwargs": {"min_percentile": 2.,
                                                       "max_percentile": 99.9,
                                                       "mode": "per_sample",
                                                       "axes": "xy"}},
                    {"name": "scale_linear", "kwargs": {"gain": 2,
                                                        "offset": -1,
                                                        "axes": "xy"}}]]
# Post processing steps
bmz_postprocess = [[{"name": "scale_linear", "kwargs": {"gain": 0.5,
                                                        "offset": 0.5,
                                                        "axes": "xy"}}]]

# Input & output specs
# ---------------------------------------
kwargs = dict(
  input_names=["input"],
  input_axes=["bcyx"],
  pixel_sizes=[pixel_size],
  preprocessing = bmz_preprpocess)

output_spec = dict(
  output_names=["output"],
  output_axes=["bcyx"],
  postprocessing=bmz_postprocess, 
  output_reference=["input"],
  output_scale=[4*[1]], 
  output_offset=[4*[0]]
)
kwargs.update(output_spec)
 
...

  build_model( ..., 
      add_deepimagej_config=True,
      **kwargs)

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions