Skip to content

Commit

Permalink
replace namedtuple => dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jul 11, 2024
1 parent 086f029 commit f015da8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions petric.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
import csv
import logging
import os
from collections import namedtuple
from dataclasses import dataclass
from pathlib import Path
from time import time
from traceback import print_exc
from typing import Any

import numpy as np
from skimage.metrics import mean_squared_error as mse
Expand Down Expand Up @@ -170,9 +171,18 @@ def construct_RDP(penalty_strength, initial_image, kappa, max_scaling=1e-3):
return prior


Dataset = namedtuple('Dataset', [
'acquired_data', 'additive_term', 'mult_factors', 'OSEM_image', 'prior', 'kappa', 'reference_image',
'whole_object_mask', 'background_mask', 'voi_masks'])
@dataclass
class Dataset:
acquired_data: STIR.AcquisitionData
additive_term: STIR.AcquisitionData
mult_factors: STIR.AcquisitionData
OSEM_image: STIR.ImageData
prior: STIR.RelativeDifferencePrior | Any
kappa: STIR.ImageData
reference_image: STIR.ImageData | None = None
whole_object_mask: STIR.ImageData | None = None
background_mask: STIR.ImageData | None = None
voi_masks: dict[str, STIR.ImageData] = {}


def get_data(srcdir=".", outdir=OUTDIR, sirf_verbosity=0):
Expand Down

0 comments on commit f015da8

Please sign in to comment.