Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: minor refactors #184

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10003.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ tiltseries:
tilting_scheme: Dose symmetric from 0.0 degrees
total_flux: 120
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10006.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ tiltseries:
tilting_scheme: Dose symmetric from 0.0 degrees
total_flux: 120
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
authors: *id002
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10426.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10427.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10428.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10429.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10430.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10431.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10432.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10433.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10434.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
5 changes: 2 additions & 3 deletions ingestion_tools/dataset_configs/10435.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ tiltseries:
tilting_scheme: dose-symmetric
total_flux: float {tilt_series_total_flux}
sources:
- literal:
value:
- validation placeholder
- source_glob:
list_glob: validation_placeholder/for_unavailable_ts.st
tomograms:
- metadata:
affine_transformation_matrix:
Expand Down
11 changes: 3 additions & 8 deletions ingestion_tools/scripts/common/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,8 @@ def has_label(self) -> bool:
return np.any(self.volume_reader.data == self.label)


def get_tomo_metadata(
fs: FileSystemApi,
output_prefix: str,
) -> dict[str, Any]:
# Write a tomo metadata file.
def get_volume_metadata(fs: FileSystemApi, output_prefix: str) -> dict[str, Any]:
# Generates metadata related to volume files.
scales = []
size: dict[str, float] = {}
omezarr_dir = fs.destformat(f"{output_prefix}.zarr")
Expand All @@ -406,14 +403,12 @@ def get_tomo_metadata(
if not size:
size = dims
scales.append(dims)

output_json = {
return {
"scales": scales,
"size": size,
"omezarr_dir": os.path.basename(omezarr_dir),
"mrc_files": [os.path.basename(f"{output_prefix}.mrc")],
}
return output_json


def get_voxel_size(fs: FileSystemApi, tomo_filename: str) -> float:
Expand Down
4 changes: 2 additions & 2 deletions ingestion_tools/scripts/importers/base_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from common.copy import copy_by_src
from common.finders import DepositionObjectImporterFactory
from common.image import VolumeInfo, get_tomo_metadata, get_volume_info, get_voxel_size, make_pyramids
from common.image import VolumeInfo, get_volume_info, get_volume_metadata, get_voxel_size, make_pyramids

if TYPE_CHECKING:
from common.config import DepositionImportConfig
Expand Down Expand Up @@ -157,7 +157,7 @@ def get_output_path(self) -> str:
def load_extra_metadata(self) -> dict[str, Any]:
run: RunImporter = self.get_run()
output_prefix = self.get_output_path()
metadata = get_tomo_metadata(self.config.fs, output_prefix)
metadata = get_volume_metadata(self.config.fs, output_prefix)
metadata["run_name"] = run.name
return metadata

Expand Down
Loading