Skip to content

Add a flip parameter on ProjectImportImagesCommand#2075

Merged
petebankhead merged 4 commits intoqupath:mainfrom
Rylern:flip-on-image-import
Jan 27, 2026
Merged

Add a flip parameter on ProjectImportImagesCommand#2075
petebankhead merged 4 commits intoqupath:mainfrom
Rylern:flip-on-image-import

Conversation

@Rylern
Copy link
Contributor

@Rylern Rylern commented Jan 21, 2026

Implements #2028:

image image

@Rylern Rylern linked an issue Jan 21, 2026 that may be closed by this pull request
@petebankhead
Copy link
Member

Thanks, I'll check this out in more detail tomorrow. Two quick thoughts:

  1. It should probably also support Flip.BOTH
  2. Would it deserve its own ImageServer implementation?

Currently we have RotatedImageServer, even though AffineTransformImageServer could also do the job. This avoids the need transform all x and y coordinates then build up the image pixel by pixel (or rely on Graphics2D rendering for RGB images). Here, you could instead extract rows and columns and simply reverse them.

To help answer, it would be worth checking performance with a large, multiplexed image, e.g., LuCa-7color_Scan1.qptiff or Patient_1.ome.tiff; you could benchmark tile reading using AffineTransformImageServer and RotatedImageServer to see if they are different enough to justify the latter.

@petebankhead
Copy link
Member

See also how command line support is provided for rotation with --rotate (it has been a long time since I've used this, so I'm only guessing it still works....).

@Rylern
Copy link
Contributor Author

Rylern commented Jan 22, 2026

On LuCa-7color_Scan1.qptiff or Patient_1.ome.tiff, the benchmark script results are:

  • Around 21 seconds with no rotation.
  • Around 30.3 seconds with the following rotation:
server = new RotatedImageServer(server, RotatedImageServer.Rotation.ROTATE_180)
  • Around 35 seconds with the following rotation:
var transform = new AffineTransform()
transform.rotate(Math.PI, server.getWidth() / 2, server.getHeight() / 2)
server = new TransformedServerBuilder(server)
    .transform(transform)
    .build()

So yes it might be better to create a new FlipImageServer.

@petebankhead petebankhead merged commit 7218e4b into qupath:main Jan 27, 2026
3 checks passed
@Rylern Rylern deleted the flip-on-image-import branch January 28, 2026 08:59
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.

Add a flip image parameter

2 participants