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

Add webknossos_annotation.py #11

Closed

Conversation

jingjingwu1225
Copy link
Contributor

No description provided.

@kabilar kabilar requested a review from balbasty November 5, 2024 13:32
max_load: int = 16384,
nii: bool = False,
has_channel: int = 1,
):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you document what each input/option does?

low_res_offsets.append([t,b,l,r])

# load jp2 image to get voxel size info
j2k = glymur.Jp2k(jp2_dir)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be better to reference the zarr file that was annotated. It should have the voxel size info as well.


dic_EB = {0:0, 1:1, 9:2, 2:3, 4:4, 10:5, 11:6, 8:7, 3:8}
dic_JS = {0:0, 4:2, 5:3, 9:4, 6:5, 2:6, 7:7, 3:8}
dic_JW = {0:0, 1:1, 2:2, 3:3, 4:4, 6:5, 7:6, 8:7, 9:8}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a comment to describe what these dictionaries contain?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, should this be an input option somehow?



nblevel = 9
# Write each level
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should probably get the number of levels from the data, not hardcode it.

for level in range(nblevel):
omz_res = omz_data[level]
size = omz_res.shape[-2:]
shape = [1, 20] + [i for i in size]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment - do we need to harcode this?



# Write OME-Zarr multiscale metadata
print('Write metadata')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do the annotation have the exact same shape as the annotated zarr file? I feel like we should just copy that info from the input zarr.



def generate_mask(mask):
final_mask = np.zeros_like(mask).astype(np.uint8)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this doing? Is it a good thing to process the data in a "conversion" script?

@kabilar kabilar changed the title Add webknossos_annotation.py under scripts folder Add webknossos_annotation.py Nov 5, 2024
Copy link
Member

@kabilar kabilar left a comment

Choose a reason for hiding this comment

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

Hi @jingjingwu1225, while the details of this script are fresh on our minds, perhaps this is a good time to add unit and/or integration tests alongside the script? Integrating these tests within a GitHub Actions workflow would be straightforward and I can help with this process. Thanks for considering.

cc @balbasty

@jingjingwu1225
Copy link
Contributor Author

Hi @kabilar, thanks for the comment. I'll modify the script first based on comments of Yael and then we can start integrating tests, you help is appreciated!

@balbasty
Copy link
Collaborator

@kabilar @jingjingwu1225 We're about to merge the refactored package in main. It would be great to integrate the script and tests into this refactored package. @calvinchai can provide guidance.

@jingjingwu1225 jingjingwu1225 deleted the webknossos-annotation branch November 12, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants