Module ctsimu.test
General class for a projection-based test.
Expand source code
# -*- coding: UTF-8 -*-
"""General class for a projection-based test."""
import os # File and path handling
import numpy
import copy # for deepcopy
import math
from .image import ImageFile, Image, ImageROI, ImageStack
from .geometry import Geometry
from .processing.pipeline import Pipeline
from .processing.step import Step
from .helpers import *
class generalTest(Step):
""" General class for test scenario evaluations: get image(s), run and store evaluation. """
def __init__(self, testName="General Test", name=None, nExpectedRuns=1, resultFileDirectory=".", rawOutput=False):
Step.__init__(self, testName)
self.testName = testName
self.subtests = []
self.prepared = False
self.currentRun = 0
self.nExpectedRuns = None # usually, number of projections to evaluate
self.resultFileDirectory = None
self.name = None
self.rawOutput = None
self.setName(name)
self.setExpectedRuns(nExpectedRuns)
self.setResultFileDirectory(resultFileDirectory)
self.setRawOutput(rawOutput)
self.reset()
def reset(self):
self.currentRun = 0
self.prepared = False
def addSubtest(self, subt):
self.subtests.append(subt)
def setName(self, name=None):
""" Set an individual name for the (sub) test. """
if name is not None:
self.name = name
else:
self.name = self.testName
def setExpectedRuns(self, n=1):
self.nExpectedRuns = n
def setResultFileDirectory(self, resultFileDirectory="."):
""" Set the location where test results should be saved. """
self.resultFileDirectory = resultFileDirectory + "/"
touch_directory(self.resultFileDirectory)
def setRawOutput(self, rawOutput=False):
""" Save intermediate projections as RAW instead of TIFF? """
self.rawOutput = rawOutput
def plotResults(self):
""" Plot results of evaluation. """
# Should be called by step's followUp() function, if needed.
pass
Classes
class generalTest (testName='General Test', name=None, nExpectedRuns=1, resultFileDirectory='.', rawOutput=False)
-
General class for test scenario evaluations: get image(s), run and store evaluation.
Expand source code
class generalTest(Step): """ General class for test scenario evaluations: get image(s), run and store evaluation. """ def __init__(self, testName="General Test", name=None, nExpectedRuns=1, resultFileDirectory=".", rawOutput=False): Step.__init__(self, testName) self.testName = testName self.subtests = [] self.prepared = False self.currentRun = 0 self.nExpectedRuns = None # usually, number of projections to evaluate self.resultFileDirectory = None self.name = None self.rawOutput = None self.setName(name) self.setExpectedRuns(nExpectedRuns) self.setResultFileDirectory(resultFileDirectory) self.setRawOutput(rawOutput) self.reset() def reset(self): self.currentRun = 0 self.prepared = False def addSubtest(self, subt): self.subtests.append(subt) def setName(self, name=None): """ Set an individual name for the (sub) test. """ if name is not None: self.name = name else: self.name = self.testName def setExpectedRuns(self, n=1): self.nExpectedRuns = n def setResultFileDirectory(self, resultFileDirectory="."): """ Set the location where test results should be saved. """ self.resultFileDirectory = resultFileDirectory + "/" touch_directory(self.resultFileDirectory) def setRawOutput(self, rawOutput=False): """ Save intermediate projections as RAW instead of TIFF? """ self.rawOutput = rawOutput def plotResults(self): """ Plot results of evaluation. """ # Should be called by step's followUp() function, if needed. pass
Ancestors
Subclasses
- Test2D_DW_1
- Test2D_FB_1
- Test2D_FB_2
- Test2D_HS_1
- Test2D_SW_1
- Test2D_SW_2
- Test2D_SW_3
- Test2D_SW_4
- Test2D_WE_1
- Test2D_WE_2
Methods
def addSubtest(self, subt)
-
Expand source code
def addSubtest(self, subt): self.subtests.append(subt)
def plotResults(self)
-
Plot results of evaluation.
Expand source code
def plotResults(self): """ Plot results of evaluation. """ # Should be called by step's followUp() function, if needed. pass
def reset(self)
-
Expand source code
def reset(self): self.currentRun = 0 self.prepared = False
def setExpectedRuns(self, n=1)
-
Expand source code
def setExpectedRuns(self, n=1): self.nExpectedRuns = n
def setName(self, name=None)
-
Set an individual name for the (sub) test.
Expand source code
def setName(self, name=None): """ Set an individual name for the (sub) test. """ if name is not None: self.name = name else: self.name = self.testName
def setRawOutput(self, rawOutput=False)
-
Save intermediate projections as RAW instead of TIFF?
Expand source code
def setRawOutput(self, rawOutput=False): """ Save intermediate projections as RAW instead of TIFF? """ self.rawOutput = rawOutput
def setResultFileDirectory(self, resultFileDirectory='.')
-
Set the location where test results should be saved.
Expand source code
def setResultFileDirectory(self, resultFileDirectory="."): """ Set the location where test results should be saved. """ self.resultFileDirectory = resultFileDirectory + "/" touch_directory(self.resultFileDirectory)
Inherited members