duo.zeff package

Submodules

duo.zeff.abbema module

class duo.zeff.abbema.Abbema(com)[source]

Bases: object

Calculate(imageHighKVP, imageLowKVP)[source]
CalculateGPU(imageHighKVP, imageLowKVP)[source]
CalculateGivenCTNumber(imageHighKVP, imageLowKVP)[source]
CalculateGivenCTNumberGPU(imageHighKVP, imageLowKVP)[source]
CalculateSinglePixel(pixelHighKVP, pixelLowKVP)[source]
CalculateZ(mat)[source]
LoadDll(libPath)[source]
duo.zeff.abbema.Func(Z, coeff1, coeff2, coeff3, c, g, k)[source]
duo.zeff.abbema.FuncDerivative(Z, coeff1, coeff2, coeff3, c, g, k)[source]

duo.zeff.abbema_coeff_calculator module

class duo.zeff.abbema_coeff_calculator.AbbemaCoeffCalculator(com)[source]

Bases: object

CalculateCSMicroXS(E, Z)[source]
CalculatePEMicroXS(E, Z)[source]
CalculateRLMicroXS(E, Z)[source]
CalculateTotalMicroXS(E, Z)[source]
Initialize()[source]
Show()[source]
class duo.zeff.abbema_coeff_calculator.CaiModifiedAbbemaCoeffCalculator(com)[source]

Bases: duo.zeff.abbema_coeff_calculator.AbbemaCoeffCalculator

Initialize()[source]
duo.zeff.abbema_coeff_calculator.FuncCS(T, h, j, k)[source]
duo.zeff.abbema_coeff_calculator.FuncPE(T, a, b, c)[source]
duo.zeff.abbema_coeff_calculator.FuncRL(T, d, f, g)[source]
class duo.zeff.abbema_coeff_calculator.ImprovedAbbemaCoeffCalculator(com)[source]

Bases: duo.zeff.abbema_coeff_calculator.AbbemaCoeffCalculator

Derive1()[source]
Derive2()[source]
Derive3()[source]
Initialize()[source]
class duo.zeff.abbema_coeff_calculator.OriginalAbbemaCoeffCalculator(com)[source]

Bases: duo.zeff.abbema_coeff_calculator.AbbemaCoeffCalculator

Initialize()[source]
class duo.zeff.abbema_coeff_calculator.ReproducedAbbemaCoeffCalculator(com)[source]

Bases: duo.zeff.abbema_coeff_calculator.AbbemaCoeffCalculator

Derive1()[source]
Derive2()[source]
Derive3()[source]
Initialize()[source]

duo.zeff.blend module

class duo.zeff.blend.Blend(allowedZMin, allowedZMax, CTNumber_Elow, CTNumber_Ehigh)[source]

Bases: object

BlendWithAlpha(imageHighKVP, imageLowKVP, imageMixed, imageZeff, method=0)[source]
BlendWithConstantAlpha(imageMixed, imageZeff)[source]
BlendWithoutAlpha(imageMixed, imageZeff)[source]

duo.zeff.bourque module

class duo.zeff.bourque.Bourque(com, method='bspline')[source]

Bases: object

Critical: By default Bourque parameterizes electron microscopic cross-section (exs) using polynomial approximation. At low-energy range, when exs changes abruptly due to absorption, curve fitting would have large error.

Variables
  • method

    Type of Bourque coefficient calculator to apply.

    • ”original”: Using polynomial.

    • ”chebyshev”: Using Chebyshev polynomial.

    • ”bspline”: Using cubic B-Spline.

  • bcc – Bourque coefficient calculator object.

  • dList – Parameters of DER(Z) polynomial curve fitting.

  • bs – Parameters of Z(DER) B-spline curve fitting.

Calculate(muHighKVP, muLowKVP)[source]
CalculateDualEnergyRatio(Ehigh, Elow, Z)[source]

Given Ehigh, Elow, Z, calculate DER using parametric equation of exs in Z

CalculateDualEnergyRatio2(Z)[source]

Given Z, calculate DER using parametric equation of DER in Z

CalculateGivenCTNumber(imageHighKVP, imageLowKVP)[source]
CalculateZeff2(der)[source]
CalculateZeffAtE(mat, energy)[source]

Given material and energy, calculate Zeff. This method calls duo.zeff.bourque_coeff_calculator.BourqueCoeffCalculator.ParameterizeAtE(). The curve fitting depends on Bourque.method which defaults to “bspline”. ENDFB cross-section data is used.

EvaluateSpline(mat, energy, Z)[source]

Debugging purpose

ParameterizeDualEnergyRatioAndZ(Ehigh, Elow)[source]

Given Ehigh and Elow, derive

  • The parametric equation of DER as a function of Z.

  • The parametric equation of Z as a function of DER.

Bourque states that Z and gamma are bijective in [1, 38] We noticed they are bijective in [1, 36] using the ENDFB library.

Following Bourque’s method, we establish a relation (Bourque.bs) between Z and DER, and use DER of an unknown material to predict its Z. The result would still be the same if we directly use exs_low / exs_high without considering water.

duo.zeff.bourque.Func6(Z, d0, d1, d2, d3, d4, d5)[source]

duo.zeff.bourque_coeff_calculator module

class duo.zeff.bourque_coeff_calculator.BSplineBourqueCoeffCalculator(elementTable)[source]

Bases: duo.zeff.bourque_coeff_calculator.BourqueCoeffCalculator

Subclass of BourqueCoeffCalculator, but using B-spline instead for curve fitting.

CalculateElectronXS(Z)[source]

Given Z, calculate electron microscopic cross-section. This method must be used after a call to ParameterizeAtE(), which calculates parameters based on the given energy.

Parameters

Z (int.) – Atomic number.

EvaluateSpline(my_xs_tt, Z)[source]

Debugging purpose

FindRoots(my_xs_tt)[source]

Known issue: for single-element material Z=1 (H, H2, H3 …), interpolate.sproot() is somehow unable to find the root where Z=1

ParameterizeAtE(energy)[source]

Calculate parameters at the given photon energy

Parameters

energy (float.) – Photon energy in keV.

class duo.zeff.bourque_coeff_calculator.BourqueCoeffCalculator(elementTable)[source]

Bases: object

Class that manages the parameters of Bourque’s formalism, using polynomial for curve fitting.

CalculateElectronXS(Z)[source]

Given Z, calculate electron microscopic cross-section. This method must be used after a call to ParameterizeAtE(), which calculates parameters based on the given energy.

Parameters

Z (int.) – Atomic number.

FindRoots(my_xs_tt)[source]
ParameterizeAtE(energy)[source]

Calculate parameters at the given photon energy

Parameters

energy (float.) – Photon energy in keV.

class duo.zeff.bourque_coeff_calculator.ChebyshevBourqueCoeffCalculator(elementTable)[source]

Bases: duo.zeff.bourque_coeff_calculator.BourqueCoeffCalculator

Subclass of BourqueCoeffCalculator, but using Chebyshev polynomial instead for curve fitting.

CalculateElectronXS(Z)[source]

Given Z, calculate electron microscopic cross-section. This method must be used after a call to ParameterizeAtE(), which calculates parameters based on the given energy.

Parameters

Z (int.) – Atomic number.

FindRoots(my_xs_tt)[source]
ParameterizeAtE(energy)[source]

Calculate parameters at the given photon energy

Parameters

energy (float.) – Photon energy in keV.

duo.zeff.cai module

class duo.zeff.cai.Cai(com, method='bourque', controlPointType='colonECExtra')[source]

Bases: object

ApplyModelRecursively(dicomDir, outputImageDir)[source]
Calculate(imageHighKVP, imageLowKVP)[source]
CalculateGivenCTNumber(imageHighKVP, imageLowKVP)[source]

duo.zeff.common module

class duo.zeff.common.Common(dataPath, method='original', use140kVpWithSn=True, use100kVp=False)[source]

Bases: object

AddImageRegular(imageRegular, title)[source]
AddImageZeff(imageZeff, title)[source]
ApplyModel(lowHighDicomDir, fileName, outputImageName, methodObj, **kwargs)[source]
ApplyModelIteratively(lowHighDicomDir, mixedImageDicomDir, outputECDicomDir, methodObj, **kwargs)[source]
CalculateGivenCTNumber(imageHighKVP, imageLowKVP, methodObj, useGPU=False)[source]
ConvertCTNumberToMu(CTNumber, mu_water, mu_air)[source]
ConvertMuToCTNumber(mu, mu_water, mu_air)[source]
ElectronicCleanse(imageLowKVP, imageHighKVP, imageMixed, imageZeff, zeffWindowLower, zeffWindowUpper, imageMask)[source]
Initialize()[source]
PlotSingleImage(imageData, outputImageName, markWrongData=True)[source]
ProcessCTImage(fileName)[source]
SaveDicom(inputFileName, imageMixed_ec, outputFullPath)[source]
ShowImageInfo(image)[source]
VerifyModel(knownMaterial, methodObj)[source]

duo.zeff.control_point module

class duo.zeff.control_point.ControlPointContainer[source]

Bases: object

class duo.zeff.control_point.ControlPointManager(com, method, isToDumpIntermediateData=True)[source]

Bases: object

AddManuallyTunedExtraMaterial()[source]
CalculateZeffForControlPoint()[source]
GetMaterialFromNist(name)[source]
Initialize()[source]
InitializeControlPointContainer()[source]
InitializeRBF()[source]
PlotDiscretePoint()[source]
PlotFullSurface()[source]

Known issue: Matplotlib 3.4.2 still has a bug where 3D plot zorder is oftentimes ignored.

WriteControlPointToFile()[source]
class duo.zeff.control_point.ControlPointManagerColonEC(com, method, isToDumpIntermediateData=True)[source]

Bases: duo.zeff.control_point.ControlPointManager

AddExtraMaterial()[source]
AddExtraMaterial2()[source]
class duo.zeff.control_point.ControlPointManagerColonECExtra(com, method, isToDumpIntermediateData=True)[source]

Bases: duo.zeff.control_point.ControlPointManager

AddExtraMaterial2()[source]
class duo.zeff.control_point.ControlPointManagerKidneyStone(com, method, isToDumpIntermediateData=True)[source]

Bases: duo.zeff.control_point.ControlPointManager

AddExtraMaterial2()[source]
class duo.zeff.control_point.ControlPointManagerKidneyStoneExtra(com, method, isToDumpIntermediateData=True)[source]

Bases: duo.zeff.control_point.ControlPointManager

AddExtraMaterial2()[source]
class duo.zeff.control_point.ControlPointManagerSpecial1(com, method, isToDumpIntermediateData=True)[source]

Bases: duo.zeff.control_point.ControlPointManager

AddExtraMaterial2()[source]
class duo.zeff.control_point.ControlPointManagerSpecial2(com, method, isToDumpIntermediateData=True)[source]

Bases: duo.zeff.control_point.ControlPointManager

AddExtraMaterial2()[source]

duo.zeff.enhance module

class duo.zeff.enhance.Enhance[source]

Bases: object

Denoise(image, filterSize=5)[source]
RemoveVerticalPartialVolumeEffect(image)[source]

duo.zeff.nist module

class duo.zeff.nist.Nist(com)[source]

Bases: object

ImportNistMaterial()[source]
SearchMaterialFromNist(name)[source]
Show()[source]

duo.zeff.power_law module

class duo.zeff.power_law.Mayneord[source]

Bases: duo.zeff.power_law.PowerLaw

class duo.zeff.power_law.PowerLaw[source]

Bases: object

CalculateZeff(mat)[source]

duo.zeff.taylor module

class duo.zeff.taylor.Taylor(com, method='original')[source]

Bases: object

CalculateZeffAtE(mat, energy)[source]

duo.zeff.taylor_coeff_calculator module

class duo.zeff.taylor_coeff_calculator.AltTaylorCoeffCalculator(elementTable)[source]

Bases: duo.zeff.taylor_coeff_calculator.TaylorCoeffCalculator

CalculateXS(Z)[source]
FindRoots(my_xs_tt)[source]
ParameterizeAtE(energy)[source]
duo.zeff.taylor_coeff_calculator.Func6(Z, a0, a1, a2, a3, a4, a5)[source]
class duo.zeff.taylor_coeff_calculator.TaylorCoeffCalculator(elementTable)[source]

Bases: object

CalculateXS(Z)[source]
FindRoots(my_xs_tt)[source]
ParameterizeAtE(energy)[source]

duo.zeff.torikoshi module

class duo.zeff.torikoshi.Torikoshi(com)[source]

Bases: object

CalculateZeffAtE(mat, energy)[source]

duo.zeff.torikoshi_coeff_calculator module

class duo.zeff.torikoshi_coeff_calculator.TorikoshiCoeffCalculator(elementTable)[source]

Bases: object

CalculateElectronXS(Z)[source]

Given Z, calculate electron microscopic cross-section. This method must be used after a call to ParameterizeAtE(), which calculates parameters based on the given energy.

Parameters

Z (int.) – Atomic number.

CalculateF(Z)[source]

Given Z, calculate F(energy, Z) function defined in Torikoshi 2003. This method must be used after a call to ParameterizeAtE(), which calculates parameters based on the given energy.

Parameters

Z (int.) – Atomic number.

CalculateG(Z)[source]

Given Z, calculate G(energy, Z) function defined in Torikoshi 2003. This method must be used after a call to ParameterizeAtE(), which calculates parameters based on the given energy.

Parameters

Z (int.) – Atomic number.

FindRoots(my_xs_tt)[source]
ParameterizeAtE(energy)[source]

Calculate parameters at the given photon energy

Parameters

energy (float.) – Photon energy in keV.

duo.zeff.zeff_calculator module

class duo.zeff.zeff_calculator.ZeffCalculator(com, material, method='bourque', isNist=False)[source]

Bases: object

Calculate()[source]

duo.zeff.zeff_table module

class duo.zeff.zeff_table.ZeffTableGenerator(dataPath, step=1, controlPointType='colonECExtra', use140kVpWithSn=True, use100kVp=False, originalBourque=False)[source]

Bases: object

AddControlPointsToImage(cpManager, ax)[source]
AddDelimitingLinesToImage(ax)[source]
CalculateCTNumberForOneMaterial(Z, density)[source]
CalculateCTNumbers(ax, Z, density)[source]
ClampZeff(zeffMap)[source]
CreateNewColormap(image)[source]
GenerateZeffTable()[source]
GetImageCoordinateFromHU(HU)[source]
InitializeHuLowHighImages()[source]
LoadAndPlotData(fileName, imageName)[source]
PlotDiff(imageDiff, title)[source]
PlotZeff(imageZeff, title, addControlPoints=False, caiObj=None)[source]
SaveDataToDisk()[source]

Module contents