`CalciumScoring.Agatston`

— Type`Agatston`

`struct Agatston <: CalciumScore end`

Lets Julia know (via multiple dispatch) that the algorithm of choice when calculating the calcium score should be Agatston's algorithm

`CalciumScoring.CalciumScore`

— Type`CalciumScore`

`abstract type CalciumScore end`

Main type for all calcium scoring algorithms in this package

`CalciumScoring.Integrated`

— Type`Integrated`

```
function Integrated(
vol,
I=sum(vol),
N=length(vol)
)
```

**Inputs**

- vol: region of interest
- I: integrated intensity of the entire
`vol`

- N: total number of voxels contained in the entire
`vol`

**References**

Integrated intensity-based technique for coronary artery calcium mass measurement: A phantom study

Accurate quantification of vessel cross-sectional area using CT angiography: a simulation study

`CalciumScoring.SpatiallyWeighted`

— Type`SpatiallyWeighted`

`struct SpatiallyWeighted <: CalciumScore end`

Lets Julia know (via multiple dispatch) that the algorithm of choice when calculating the calcium score should be the Spatially Weighted Calcium Scoring algorithm.

`CalciumScoring.VolumeFraction`

— Type`VolumeFraction`

`struct VolumeFraction <: CalciumScore end`

Lets Julia know (via multiple dispatch) that the algorithm of choice when calculating the calcium score should be the volume fraction algorithm

`CalciumScoring._percentage_calcium`

— Method`_percentage_calcium`

`_percentage_calcium(voxel_intensity, hu_calcium, hu_heart_tissue)`

Find the percentage of calcium within one voxel given the voxel intensity `voxel_intensity`

, the Hounsfield unit associated with a known calcium density `hu_calcium`

, and the Hounsfield unit associated with background heart tissue `hu_heart_tissue`

`CalciumScoring._weight_thresholds`

— Method`_weight_thresholds`

`_weight_thresholds(kV, max_intensity)`

This code defines a function named `_weight_thresholds`

that calculates the weight threshold for the Agatston scoring algorithm. The function takes two input parameters: kV and max*intensity. The kV parameter represents the CT scan's kilovoltage peak (kVp) value, and `max*intensity` represents the maximum intensity of a calcified lesion in Hounsfield units (HU).

The function checks the validity of the input `kV`

value and ensures that it is one of the accepted values: 70, 80, 100, 120, or 135. If the input value does not match any of the accepted values, an error message is displayed, and the program is halted.

The function then calculates the weight threshold based on the input `kV`

and `max_intensity`

. It uses a series of if-else statements to determine the weight threshold depending on the kV value and the given range of `max_intensity`

values.

The function returns the weight threshold as an integer value between 0 and 4.

**Inputs**

`kV`

: The kilovoltage peak (kVp) value of the CT scan (Accepted values: 70, 80, 100, 120, or 135)`max_intensity`

: The maximum intensity of a calcified lesion in Hounsfield units (HU)

**Returns**

`weight`

: The weight threshold for the Agatston scoring algorithm (integer value between 0 and 4)

**Reference**

`CalciumScoring.score`

— Method`score`

(VolumeFraction)

```
score(vol::AbstractArray, hu_calcium, hu_heart_tissue, alg::VolumeFraction)
score(vol::AbstractArray, hu_calcium, hu_heart_tissue, voxel_size, alg::VolumeFraction)
score(vol::AbstractArray, hu_calcium, hu_heart_tissue, voxel_size, density_calcium, alg::VolumeFraction)
score(vol::AbstractMatrix, hu_calcium, hu_heart_tissue, alg::VolumeFraction)
score(vol::AbstractMatrix, hu_calcium, hu_heart_tissue, voxel_size, alg::VolumeFraction)
score(vol::AbstractMatrix, hu_calcium, hu_heart_tissue, voxel_size, density_calcium, alg::VolumeFraction)
```

Calculate the number of voxels that are calcified, the volume of the calcification, or the mass of the calcification depending on the provided arguments.

**Inputs**

`vol`

: An input region of interest containing all potential calcium.`hu_calcium`

: The Hounsfield unit associated with a known calcium density.`hu_heart_tissue`

: The Hounsfield unit associated with background heart tissue.`voxel_size`

: (optional) The size of an individual pixel/voxel.`density_calcium`

: (optional) The density of the previously mentioned calcium.`alg::VolumeFraction`

: The algorithm to be used for the calculation.

**Returns**

- When called with
`vol`

,`hu_calcium`

,`hu_heart_tissue`

, and`alg`

, this function calculates and returns the number of voxels that are calcified. - When called with
`vol`

,`hu_calcium`

,`hu_heart_tissue`

,`voxel_size`

, and`alg`

, this function calculates and returns the volume of the calcification. - When called with
`vol`

,`hu_calcium`

,`hu_heart_tissue`

,`voxel_size`

,`density_calcium`

, and`alg`

, this function calculates and returns the mass of the calcification.

**References**

`CalciumScoring.score`

— Method`score`

(SpatiallyWeighted)

```
score(vol::AbstractMatrix, calibration, alg::SpatiallyWeighted)
score(vol::AbstractMatrix, μ, σ, alg::SpatiallyWeighted)
score(vol::AbstractArray, calibration, alg::SpatiallyWeighted)
score(vol::AbstractArray, μ, σ, alg::SpatiallyWeighted)
```

Calculate the calcium score via the Spatially Weighted Calcium Scoring algorithm. This method avoids thresholding by weighting each voxel based on a previous calibration (usually 100 mg/cc) as outlined in the MESA study.

The function can be called with different parameters:

`vol::AbstractMatrix`

,`calibration`

,`alg::SpatiallyWeighted`

- Applies the algorithm to a 2D volume with a calibration array.`vol::AbstractMatrix`

,`μ`

,`σ`

,`alg::SpatiallyWeighted`

- Applies the algorithm to a 2D volume with given mean`μ`

and standard deviation`σ`

.`vol::AbstractArray`

,`calibration`

,`alg::SpatiallyWeighted`

- Applies the algorithm to a 3D volume with a calibration array.`vol::AbstractArray`

,`μ`

,`σ`

,`alg::SpatiallyWeighted`

- Applies the algorithm to a 3D volume with given mean`μ`

and standard deviation`σ`

.

**Inputs**

`vol`

: input volume containing just the region of interest. This can be a 2D (`AbstractMatrix`

) or 3D (`AbstractArray`

) volume.`calibration`

: a previous calibration for weighting each voxel.`μ`

,`σ`

: given mean and standard deviation.`alg::SpatiallyWeighted`

: Spatially Weighted scoring algorithm`SpatiallyWeighted()`

.

**Returns**

`sw_score`

: total Spatially Weighted score, providing a continuous and improved measure of atherosclerosis compared to existing coronary artery calcium scoring methods.

**References**

`CalciumScoring.score`

— Method`score`

(Agatston)

```
score(vol, spacing, alg::Agatston; kV=120, min_size_mm=1)
score(vol, spacing::Array{T}, alg::Agatston; kV=120, min_size_mm=1)
score(vol, spacing, mass_cal_factor, alg::Agatston; kV=120, min_size_mm=1)
score(vol, spacing::Array{T}, mass_cal_factor::Unitful.Quantity, alg::Agatston; kV=120, min_size_mm=1)
```

Calculate the calcium score via the traditional Agatston scoring technique, as outlined in the original paper. Energy (`kV`

) specific `threshold`

s are determined based on previous publications. Also, it converts the Agatston score to a calcium mass score via the `mass_cal_factor`

if provided.

**Inputs**

`vol`

: input volume containing just the region of interest`spacing`

: known pixel/voxel spacing (can be an array of`Unitful.Quantity`

)`alg::Agatston`

: Agatston scoring algorithm`Agatston()`

`mass_cal_factor`

: (optional) a factor to calibrate the calculated mass (can be a`Unitful.Quantity`

)- kwargs:
`kV=120`

: energy of the input CT scan image`min_size=1`

: minimum connected component size (see`label_components`

)

**Returns**

`agatston_score`

: total Agatston score`volume_score`

: total calcium volume via Agatston scoring (can be a`Unitful.Quantity`

)`abs_mass_score`

: (optional) total calcium mass after calibration, returned only when`mass_cal_factor`

is provided

**References**

Quantification of coronary artery calcium using ultrafast computed tomography

`CalciumScoring.score`

— Method`score`

(Integrated)

```
score(S_Bkg, S_Obj, algorithm::Integrated)
score(S_Bkg, S_Obj, size, algorithm::Integrated)
score(S_Bkg, S_Obj, size, ρ, algorithm::Integrated)
```

Use the integrated intensity approach to find the total number of object voxels/volume/mass contained in `vol`

.

The function can be called with different parameters:

`S_Bkg`

,`S_Obj`

,`algorithm`

- Returns the total number of object voxels.`S_Bkg`

,`S_Obj`

,`size`

,`algorithm`

- Returns the total object volume.`S_Bkg`

,`S_Obj`

,`size`

,`ρ`

,`algorithm`

- Returns the total object mass.

**Inputs**

`S_Bkg`

: pure background signal intensity in the`vol`

`S_Obj`

: pure object signal intensity in the`vol`

`size`

: (optional) size of the voxels in the given`vol`

(only for the 2nd and 3rd variations)`ρ`

: (optional) density of the given object of interest contained within the`vol`

(only for the 3rd variation)`algorithm`

: the`Integrated`

algorithm which accounts for noise and partial volume effect by integrating the intensity of the entire volume`vol`

**References**

Integrated intensity-based technique for coronary artery calcium mass measurement: A phantom study

Accurate quantification of vessel cross-sectional area using CT angiography: a simulation study