-
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
Changes from 2 commits
b4f3a24
a79d5cf
071ba9e
60e58d1
d7cda1d
4417782
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,12 +85,12 @@ def __init__( | |
glob_string: str, | ||
glob_vars: dict[str, str], | ||
file_format: str, | ||
is_viz_default: bool = False, | ||
is_visualization_default: bool = False, | ||
): | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Can we also rename the class variable to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done with the last commit. |
||
if self.file_format not in ["mrc"]: | ||
raise NotImplementedError("We only support MRC files for segmentation masks") | ||
|
||
|
@@ -107,13 +107,13 @@ def __init__( | |
glob_vars: dict[str, str], | ||
file_format: str, | ||
mask_label: int = 1, # No explicit label means we are dealing with a binary mask already | ||
is_viz_default: bool = False, | ||
is_visualization_default: bool = False, | ||
): | ||
self.glob_string = glob_string.format(**glob_vars) | ||
self.file_format = file_format | ||
self.shape = "SegmentationMask" # Don't expose SemanticSegmentationMask to the public portal. | ||
self.label = mask_label | ||
self.is_viz_default = is_viz_default | ||
self.is_viz_default = is_visualization_default | ||
|
||
if self.file_format not in ["mrc"]: | ||
raise NotImplementedError("We only support MRC files for segmentation masks") | ||
|
@@ -138,15 +138,15 @@ def __init__( | |
glob_vars: dict[str, str], | ||
file_format: str, | ||
columns: str, | ||
is_viz_default: bool = False, | ||
is_visualization_default: bool = False, | ||
delimiter: str = ",", | ||
): | ||
self.glob_string = glob_string.format(**glob_vars) | ||
self.file_format = file_format | ||
self.columns = columns | ||
self.shape = shape | ||
self.delimiter = delimiter | ||
self.is_viz_default = is_viz_default | ||
self.is_viz_default = is_visualization_default | ||
if self.file_format not in ["csv", "csv_with_header"]: | ||
raise NotImplementedError("We only support CSV files for Point files") | ||
|
||
|
@@ -170,16 +170,16 @@ def load( | |
annotation_set = [] | ||
with fs.open(csvfilename, "r") as data: | ||
points = csv.reader(data, delimiter=self.delimiter) | ||
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]]), | ||
), | ||
) | ||
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]]), | ||
), | ||
) | ||
Comment on lines
+180
to
+189
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix indentation so the file is actually open. |
||
return annotation_set | ||
|
||
def get_metadata(self, output_prefix: str): | ||
|
@@ -227,7 +227,7 @@ def __init__( | |
file_format: str, | ||
binning: int, | ||
glob_string: str, | ||
is_viz_default: bool = False, | ||
is_visualization_default: bool = False, | ||
order: str | None = None, | ||
filter_value: str | None = None, | ||
): | ||
|
@@ -239,7 +239,7 @@ def __init__( | |
self.glob_string = glob_string.format(**glob_vars) | ||
self.order = order | ||
self.filter_value = "" | ||
self.is_viz_default = is_viz_default | ||
self.is_viz_default = is_visualization_default | ||
if filter_value: | ||
self.filter_value = filter_value.format(**glob_vars) | ||
valid_formats = self.map_functions.keys() | ||
|
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.