Skip to content

running modules on subregions of one image #6

@tischi

Description

@tischi

I think there are several reasons why one wants to run one module on a sub-region (not only spatial, but all dimensions) of an image, and I therefore feel we should have some rather generic support for this.

I can see the following use cases:

  • You have a multi-channel image and you want to segment nuclei, then you want a module that can segment nuclei to only run on the nucleus channel.
  • You have a very large image and you want to check whether certain segmentation algorithms perform well on that image. For that it is useful to be able to run these algorithms only a few small parts (e.g. x,y,z subregions) of that image such that you can quickly visually inspect the results before deciding to segment the whole image with a specific algorithm.
  • If modules can (generically) process subregions of an image, this could be used to implement tiled analysis of a large image. In this case the analysis module itself would not have to be touched at all. There would be a module before that generates the tiles (TileGenerator) and then we call the analysis module to work in parallel on those tiles. I think this is what @BioinfoTongLI is doing for some modules, right?
  • Another use case could be image registration. Let's say we have a module that's called Find_2D_Affine_Transformation, which finds an affine transformation to register two images. Normally the input to such a module would be two paths to two different 2D images. Using the suggested pattern, it would be now be two paths to images with corresponding ROIs, i.e. four inputs: path1 & roi1, path2 & roi2. Like this, such a module could be readily used to register, for example, two z slices of the same image or two time points of the same image, in which case the paths would be pointing to the same images and only the ROIs would be different.

There may be more use cases, let me know, I would then add them to the above bullet points.

If we agree that we want this, the question is how to best implement this. My naive proposal would be that the input to an analysis module is always the path to an image and the path to a small text file that contains the region of interest that it should work on. I don't know if that's possible in NextFlow, but I would suggest that if this small text file is missing, the default would be to take the whole image as an input. If it is difficult to deal with missing files in Nextflow, we could also always have the ROI file and say if it's empty, then the whole image should be processed by default.

Fractal seems to already implement something along those lines:

https://fractal-analytics-platform.github.io/fractal-tasks-core/tables/#roi-tables

@BioinfoTongLI @krokicki what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions