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

Offset and resolution in groudtruth data #5

Open
heliy opened this issue Mar 6, 2024 · 0 comments
Open

Offset and resolution in groudtruth data #5

heliy opened this issue Mar 6, 2024 · 0 comments

Comments

@heliy
Copy link

heliy commented Mar 6, 2024

Hi, thanks for sharing data! I meet problems when I try to map the groudtruth (GT) crop into the raw volume. I have checked suggestions from issue #1 and issue #4 but still failed.

First question is that I cannot find the location of GT crops in raw volume. I take the jrc_sum159-1/crop20 crop to present messages I got from your documentations and issues.

import numpy as np

raw_scale = np.array(raw_attrs['transform']['scale']) # [4.56, 4, 4] (nm), resolution of raw, in zyx order
# GT-related metadatas are in xyz order so I use `[::-1]` to reverse them
gt_scale = np.array(gt_attrs['resolution'])[::-1]          # [2, 2, 2], resolution of GT
gt_size = np.array(gt_attrs['dimensions'])[::-1]          # [170, 400, 400], size of GT
gt_offset = np.array(gt_attrs['offset'])[::-1]              # [22004,  2980, 18820] (nm), location of GT

# gt_offset/raw_scale yields the voxel-level offset in raw volue
voxel_offset= gt_offset/raw_scale          # [4825,  745, 4705]

Next, I crop a [1x200x200] image from raw at the voxel-level offset and resize GT[0] (the 1st z layer) into [200, 200] to check EM image and annotations. Unfortunately, it seems the offset is error.

Picture3

Another question is about the "z" resolution. In GT crop it is 2nm while in raw volume it is 4.56nm (or 5.24nm/... in other datasets). Suggestions in previous issues use [::2] downsample in z-axis, not matching metadatas. I'm confused about it as I found the volumes/raw says it is 4nm, and the page in openorganelle says it is 4.56nm.

Should I use the 2/4.56 ratio to calculate the size of GT crop in raw? or use the [::2] downsampling (1/2 ratio) and discard differences among datasets? Which following is correct?

# solution 1: use the 2/4.56 ratio
shape = gt_size*gt_scale/raw_scale # [75, 200, 200]

# solution 2: use the 1/2 ratio
shape = [int(gt_size[0]/2)]+list((gt_size*gt_scale/raw_scale)[1:]) #[85, 200, 200]

Thanks again for your amazing datas.

Best wishes!

Liuyuan He.

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

No branches or pull requests

1 participant