-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix ingestion of segmentation masks #15
Conversation
…, as this is the point where the labels are split.
@@ -71,7 +71,7 @@ def pyramid_to_mrc( | |||
mrcfiles.append(os.path.basename(filename)) | |||
|
|||
if write: | |||
newfile = mrcfile.new(filename, self.data, overwrite=True) | |||
newfile = mrcfile.new(filename, pyramid[0], overwrite=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the processed mask data instead of original data.
if skip_header: | ||
next(points) | ||
for coord in points: | ||
annotation_set.append( | ||
self.point( | ||
float(coord[coord_order[0]]), | ||
float(coord[coord_order[1]]), | ||
float(coord[coord_order[2]]), | ||
), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation so the file is actually open.
@@ -120,7 +120,8 @@ def __init__( | |||
|
|||
def convert(self, fs: FileSystemApi, input_prefix: str, output_prefix: str, voxel_spacing: float = None): | |||
input_file = self.get_source_file(fs, input_prefix) | |||
return scale_maskfile(fs, self.get_output_filename(output_prefix), input_file, self.label, write=True) | |||
return scale_maskfile(fs, self.get_output_filename(output_prefix), input_file, self.label, write=True, | |||
voxel_spacing=voxel_spacing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add voxel_spacing override for segmentation masks.
): | ||
self.glob_string = glob_string.format(**glob_vars) | ||
self.file_format = file_format | ||
self.shape = shape | ||
self.is_viz_default = is_viz_default | ||
self.is_viz_default = is_visualization_default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also rename the class variable to is_visualization_default
for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with the last commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing chanzuckerberg/cryoet-data-portal#502
The labels in segmentation masks were not correctly separated because
pyramid_to_mrc
incommon/image.py
took the original data, not the one from the pyramid (only the pyramid data is processed)AnnotationSource classes in
importers/annotation.py
expected the keyword argumentis_viz_default
, but the YAML dict hasis_visualization_default
Import of
Point
annotations failed due to faulty indenting inPoint.load
inimporters/annotation.py
Voxel spacing of the ingested segmentation masks was not correct, because
scale_maskfile
incommon/image.py
was not yet using the new override mechanism for thevoxel_spacing
(the correctvoxel_spacing
was actually passed insideAnnotationImporter.import_annotations
, but not taken into account in theSemanticSegmentationMaskFile.convert
method.