-
Notifications
You must be signed in to change notification settings - Fork 237
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
Fix Bioimaging inference tool #1580
Conversation
* Add missing required_files to run remotely Fix the following error: ``` Fatal error: cannot open file '/jetstream2/scratch/main/jobs/65039573/tool_files/scripts/compare.R': No such file or directory ``` * Replace ubuntu-20.04 runner https://github.blog/changelog/2025-01-15-github-actions-ubuntu-20-runner-image-brownout-dates-and-other-breaking-changes/ * Lint R scripts
]]> | ||
</command> | ||
<inputs> | ||
<param name="input_imaging_model" type="data" format="zip" label="BioImage.IO model" help="Please upload a BioImage.IO model."/> | ||
<param name="input_image_file" type="data" format="tiff,png" label="Input image" help="Please provide an input image for the analysis."/> | ||
<param name="input_image_input_size" type="text" label="Size of the input image" help="Provide the size of the input image. See the chosen model's RDF file to find the correct input size. For example: for the BioImage.IO model MitochondriaEMSegmentationBoundaryModel, the input size is 256 x 256 x 32 x 1. Enter the size as 256,256,32,1."/> | ||
<param name="input_image_input_axes" type="text" label="Axes of the input image" help="Provide the input axes of the input image. See the chosen model's RDF file to find the correct axes. For example: for the BioImage.IO model MitochondriaEMSegmentationBoundaryModel, the input axes is 'bzyx'"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be a select?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw. a text param can also have select options ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't it be extracted from the rdf so that the user doesn't need to know this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter axes
provides the real shape (number of dimensions) of the input image/matrix required by the model to make inferences. The parameter input_size
is necessary to slice pixels from different input image dimensions. So, both parameters I think are important to ascertain the target size of the image to be provided to the model. RDF file is not available inside the tool from where we could extract the axes
information. Also, In a few RDF files, the axes information is not straightforward and written like (from 3d-unet-arabidopsis-apical-stem-cells model):
inputs:
- axes:
- type: batch
- channel_names:
- channel0
id: channel
type: channel
- id: z
scale: 1
size: 100
type: space
- id: 'y'
scale: 1
size: 128
type: space
- id: x
scale: 1
size: 128
type: space
Users have to infer the correct axes information from above. From above, it is bczyx
. Other RDF files have this information directly given as bczyx
. (bczyx == batch, channel, z, y, x)
I can provide this as a select option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FynnBe I understood that the info in the RDF file is standardised, right?
<param name="input_image_file" value="input_platynereisemnucleisegmentationboundarymodel.tif" location="https://uk1s3.embassy.ebi.ac.uk/public-datasets/bioimage.io/organized-badger/1/files/sample_input_0.tif"/> | ||
<param name="input_image_input_size" value="256,256,32,1"/> | ||
<param name="input_image_input_axes" value="bczyx"/> | ||
<output name="output_predicted_image" file="output_platynereisemnucleisegmentationboundarymodel.tif" compare="sim_size" delta="100" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anuprulez you can use the new image_diff here https://docs.galaxyproject.org/en/latest/dev/schema.html#id117
If we store the RDF for every model, next to the model on our server and provide this as a second input ... do you think we can then support most models? We could add a conditional:
|
We might be able to read the RDF file with https://github.com/bioimage-io/spec-bioimage-io
Don't get me wrong, I think we can merge this PR as soon as it is green. Maybe we can add in a next iteration the automatic extraction? |
<output name="output_predicted_image_matrix" file="output_nucleisegboundarymodel_matrix.npy" compare="sim_size" delta="100" /> | ||
</test> | ||
<test> | ||
<param name="input_imaging_model" value="input_imaging_model.zip" location="https://zenodo.org/api/records/6647674/files/weights-torchscript.pt/content"/> | ||
<param name="input_image_file" value="input_nucleisegboundarymodel.png"/> | ||
<param name="input_image_input_size" value="256,256,1,1"/> | ||
<output name="output_predicted_image" file="output_nucleisegboundarymodel.tif" compare="sim_size" delta="100" /> | ||
<param name="input_image_input_axes" value="bcyx"/> | ||
<output name="output_predicted_image" file="output_nucleisegboundarymodel.tif" compare="image_diff" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If those images are too large we can use asserts:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will try that to check if it works with TIF
extensions. There are also NPY files which have similar sizes as TIFF files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just check there size, but using assert-size
@bgruening can you rerun the tests? I am not sure why the first two tool tests fail. They show the following error:
If this is the error, the other tests from number 3 to 6 should also fail. Locally, all of them pass. Thank you! |
This looks good to me! Should we merge this one, so people can try it. |
Yes, I think so. |
Fixes #1544 issue