Skip to content

Generalize position finder#5

Merged
Rylern merged 11 commits into
mainfrom
vectra-2-support
Aug 21, 2025
Merged

Generalize position finder#5
Rylern merged 11 commits into
mainfrom
vectra-2-support

Conversation

@Rylern

@Rylern Rylern commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

Add support for more images that contain the tile position in the image name (like ...[x,y]....tiff where x and y are positions in micrometers).

Add a new UI parameter to define how to determine the tile position (TIFF tags like before or image name as mentionned above):

image

In scripting, it is now possible to completely define how to determine the tile position.

@Rylern Rylern changed the title Add support for Vectra 2 images Generalize position finder Aug 20, 2025

@petebankhead petebankhead left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and seems to work well.

I've added some comments for how it might be more general. If you think some are worthwhile but would take too long to implement now, they could be moved to become GitHub issues or potential implementation later.

Two other things:

  1. The ReadMe should point to the example scripts, and explain specifically how to handle Vectra 2 and Vectra 3 images (since those are the primary intended use for now)
  2. I find the dialog a bit confusing, in that I choose 'OK' before I have selected images - so it isn't clear what I'd be stitching.

To address 2 you could add a file chooser prompt to the dialog, although I think an easier option would be to change the button text from OK to Choose files.
Alternatively, what happens after pressing OK could be explained with a text prompt on the dialog.

Comment thread sample-scripts/stitch_images_to_tiff.groovy Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
This extension adds support for combining TIFF images based on their "XResolution", "XPosition", "YResolution", "YPosition", "ImageWidth", and "ImageLength" tags.
This extension adds support for combining TIFF images based on their names and "XResolution", "XPosition", "YResolution", "YPosition", "ImageWidth", and "ImageLength" tags.

The extension is intended for QuPath v0.6 and later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR means it is compatible only with v0.7.0.
Is it worth delaying the breaking change, so that we can have a v0.6.0-compatible release?

@Rylern Rylern Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is actually v0.6.0 compatible, but two previous PR weren't: the TIFF writer PR, and the use of the new GeneralTools.moveToTrash()PR.

Comment thread src/main/java/qupath/ext/stitching/core/ImageStitcher.java Outdated
Comment thread src/main/java/qupath/ext/stitching/core/positionfinders/PathPositionFinder.java Outdated
public class PathPositionFinder implements PositionFinder {

private static final Logger logger = LoggerFactory.getLogger(PathPositionFinder.class);
private static final Pattern POSITION_IN_NAME_PATTERN = Pattern.compile("\\[([\\d.]+),([\\d.]+)]");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it is specific to Vectra file names. Should the class name be changed to reflect this, e.g. VectraFilenamePositionFinder?

Alternatively, this could aim to be more general by iterating through alternative patterns, e.g. to include x=123. That isn't necessary since you allow the user to provide their custom position finder, but if the name is general then I think the behavior should try to match that generality.

[See https://imagej.net/plugins/image-stitching for some examples of different potential layouts... although here x and y are for the grid position, and actually this would need to be multiplied by the image width or height (I presume).]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made PathPositionFinder more generic (it is now FilenamePatternPositionFinder) while still having a predefined Vectra pattern. Are there other patterns that should be predefined?

Comment thread src/main/java/qupath/ext/stitching/core/positionfinders/PathPositionFinder.java Outdated
Comment thread src/main/java/qupath/ext/stitching/core/positionfinders/PathPositionFinder.java Outdated
@Rylern

Rylern commented Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

The comments were addressed

@Rylern Rylern merged commit 10c3365 into main Aug 21, 2025
0 of 2 checks passed
@Rylern Rylern deleted the vectra-2-support branch August 21, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants