Skip to content
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

Labeled image instance export doesn't work as expected for z-stacks #1267

Closed
petebankhead opened this issue May 22, 2023 · 1 comment · Fixed by #1297
Closed

Labeled image instance export doesn't work as expected for z-stacks #1267

petebankhead opened this issue May 22, 2023 · 1 comment · Fixed by #1297
Labels
Milestone

Comments

@petebankhead
Copy link
Member

Bug report

Describe the bug
Exporting annotations across multiple z-slices can fail, in that annotations are drawn on more slices than they should.

To Reproduce
Steps to reproduce the behavior:

  1. Create a QuPath project containing the ImageJ sample image 'Confocal Series' (accessed via File → Open Samples
  2. Import the attached .geojson file (rename .txt to .geojson) - can import via drag & drop
  3. Attempt export using the script below:
double downsample = 1.0

def imageData = getCurrentImageData()

def labelServer = new LabeledImageServer.Builder(imageData)
    .downsample(downsample)    // Choose server resolution; this should match the resolution at which tiles are exported
    .useInstanceLabels()
    .useAnnotations()
    .multichannelOutput(false) // If true, each label refers to the channel of a multichannel binary image (required for multiclass probability)
    .build()

def path = buildFilePath(PROJECT_BASE_DIR, "labels.tif")
writeImage(labelServer, path)

Expected behavior
A TIFF stack is written that contains 3 annotations on different z-slices.

Screenshots
All 3 annotations are included on slices where only one should appear.

Screenshot 2023-05-22 at 14 39 46

Desktop (please complete the following information):

  • OS: macOS (probably all)
  • QuPath Version: 0.4.3

Additional context
Problem first noticed when replying to https://forum.image.sc/t/exporting-annotations-for-all-z-stack/81393/3

@petebankhead petebankhead added this to the v0.5.0 milestone May 22, 2023
@petebankhead petebankhead changed the title Labeled image export doesn't work as expected for z-stacks Labeled image instance export doesn't work as expected for z-stacks Aug 23, 2023
@petebankhead
Copy link
Member Author

The bug only seems to surface for instance labels and indexed image output.

petebankhead added a commit to petebankhead/qupath that referenced this issue Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant