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

discarding mu_map slices can now be used to discard same kind of slices from reconstructions

parent 672fd2b9
No related branches found
No related tags found
No related merge requests found
from typing import Optional
import numpy as np
import pandas as pd
......@@ -6,22 +8,30 @@ HEADER_DISC_FIRST = "discard_first"
HEADER_DISC_LAST = "discard_last"
def discard_slices(row: pd.Series, μ_map: np.ndarray) -> np.ndarray:
def discard_slices(row: pd.Series, μ_map: np.ndarray, recon: Optional[np.ndarray] = None) -> np.ndarray:
"""
Discard slices based on the flags in the row of th according table.
The row is expected to contain the flags 'discard_first' and 'discard_last'.
:param row: the row of meta configuration file of a dataset
:param μ_map: the μ_map
:param recon: optional reconstruction of which the same slice is discarded so that the alignment stays the same
:return: the μ_map with according slices removed
"""
_res = μ_map
if row[HEADER_DISC_FIRST]:
_res = _res[1:]
if recon is not None:
recon = recon[1:]
if row[HEADER_DISC_LAST]:
_res = _res[:-1]
if recon is not None:
recon = recon[:-1]
if recon is not None:
return _res, recon
return _res
......
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