Skip to content
Snippets Groups Projects
Commit 5517a6e4 authored by Tamino Huxohl's avatar Tamino Huxohl
Browse files

add keys class to interfile module

parent 2e3436b7
No related branches found
No related tags found
No related merge requests found
from dataclasses import dataclass
import os
from typing import Dict, Tuple
......@@ -5,6 +6,25 @@ import numpy as np
Interfile = Tuple[Dict[str, str], np.ndarray]
@dataclass
class _InterfileKeys:
placeholder: str = "{_}"
_dim: str = f"matrix size [{placeholder}]"
_spacing: str = f"scaling factor (mm/pixel) [{placeholder}]"
data_file: str = "name of data file"
n_projections: str = "number of projections"
bytes_per_pixel: str = "number of bytes per pixel"
number_format: str = "number format"
def dim(self, index: int) -> str:
return self._dim.replace(self.placeholder, str(index))
def spacing(self, index: int) -> str:
return self._spacing.replace(self.placeholder, str(index))
InterfileKeys = _InterfileKeys()
"""
Several keys defined in INTERFILE headers.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment