MPITestImages

Documentation for MPITestImages.

MPITestImages.TestImageType

Struct describing a testimage.

Fields

  • name::String: The name of the test image.
  • data::AbstractArray: The test image data itself. This can be 2D or 3D.
  • args::Tuple: The arguments necessary to generate the specified test image.
  • kwargs::Any: The corresponding key word arguments to generate the specified test image.
source
MPITestImages.checker_imageFunction
checker_image()
checker_image(size)
checker_image(size, checkersCount)
checker_image(size, checkersCount, stripeWidth)

Function to generate a phantom with a checker board pattern. This function uses a best effort approach, meaning that it is tried to cover most of the phantom with the pattern using the specified parameters.

Arguments

  • size::Tuple{Integer, Integer}: The size of the phantom
  • checkersCount::Tuple{Integer, Integer}: How many squares to generate along each axis
  • stripeWidth::Tuple{Integer, Integer}: By default (1, 1). Sets the width of the lines between the squares

Examples

julia> image = checker_image((8, 8), (2, 3), (2, 1))
8×8 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  1.0  0.0  1.0  0.0  1.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  1.0  0.0  1.0  0.0  1.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
source
MPITestImages.delta_imageMethod
delta_image(
    size,
    numOfPoints;
    sizeOfPoint,
    distanceOfPoints,
    pivot,
    circularShape
)

Function to generate a phantom with discrete points. The distanceOfPoints argument takes two functions that take the number of the point to generate and return an integer. This makes the phantoms to generate highly customizable.

Arguments

  • size::Tuple{Integer, Integer}: The size of the phantom
  • numOfPoints::Integer: The number of points to generate
  • sizeOfPoint::Tuple{Integer, Integer}: The size of the points in the phantom
  • distanceOfPoints::Tuple{Function, Function}: The distance to add between each points in x and y direction
  • pivot::Tuple{Integer, Integer}: The starting point to generate points towards (size, size)
  • circularShape::Bool: If true, points are generated as circular

Examples

Two simple dots

julia> image = delta_image((8, 8), 2; sizeOfPoint=(3, 2), distanceOfPoints=(x -> 0, x -> 4), pivot=(3, 3))
8×8 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  1.0  1.0  0.0  0.0  1.0  1.0
 0.0  0.0  1.0  1.0  0.0  0.0  1.0  1.0
 0.0  0.0  1.0  1.0  0.0  0.0  1.0  1.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

L-shaped arrangement

julia> image = delta_image((8, 8), 3; sizeOfPoint=(2, 2), distanceOfPoints=(x -> x == 2 ? 3 : 0, x -> x == 3 ? -3 : 3), pivot=(3, 3))
8×8 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  1.0  1.0  0.0  0.0  0.0  0.0
 0.0  0.0  1.0  1.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  1.0  1.0  0.0  1.0  1.0  0.0
 0.0  0.0  1.0  1.0  0.0  1.0  1.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
source
MPITestImages.derenzo_imageMethod
derenzo_image(
    diameter,
    pointSizePerSextant,
    gapBetweenSextants;
    distanceBetweenPoints,
    arrowShape
)

Function to generate Derenzo Phantom. This is done by specifying the diameter of the phantom and the size in pixel and for each sextant of the phantom. The algorithm tries to fill the radius with as many dots as possible.

Arguments

  • diameter::Int64: Diameter in pixel of the phantom.
  • pointSizePerSextant::Vector{Integer}: Size for the points in each sextant. Should atleast be of length 6.
  • gapBetweenSextants::Union{Int64, Vector{Int64}}: Gap between the center of the phantom and the sextants.

Optional Arguments

distanceBetweenPoints::Union{Int64, Vector{Int64}}=-1: The ctc distance of the holes. arrowShape::Bool=false: If true the last row of each sextant will have another row of one less hole if it fits.

Returns

  • image::Matrix{Float64}: The resulting Derenzo phantom.

Examples

This call generates a phantom similar to QRMs Mini Derenzo Phantom:

derenzo = derenzo_image(600, 
	Int.(round.([0.6*500, 0.8*500, 1.0*500, 1.2*500, 1.5*500, 2.0*500]./29)), 
	30,
	distanceBetweenPoints=Int.(round.([1.2*500, 1.6*500, 2.0*500, 2.4*500, 3.0*500, 4.0*500]./29)),
	arrowShape=true)
source
MPITestImages.jaszczak_phantomMethod
jaszczak_phantom(
    radiusSpheres,
    derenzoImage,
    height,
    distanceSpheresToRods,
    heightRods
)

Function to generate the Jaszczak Phantom. It is necessary to generate a Derenzo phantom first as it is part of the 3D body to generate.

Arguments

  • radiusSpheres::Vector{Int64}: Vector with length 6 giving the radius of each sphere of the phantom.
  • derenzoImage::Matrix{Float64}: The Derenzo phantom which is part of the Jaszczak Phantom.

The dimensions of this image dictates the depth and width of the resulting phantom.

  • height::Int64: The height of the phantom.
  • distanceSpheresToRods::Int64: The distance between the spheres and the beginning of the rods.
  • heightRods::Int64: The height of the rods (The Derenzo phantom part).

Returns

  • Array{Float64, 3}: The three dimensional phantom.
source
MPITestImages.spatial_resolution_phantomMethod
spatial_resolution_phantom(
    sizePhantom,
    numHolesInRow,
    numRows,
    holeSizes
)

Generates Spatial Resolution Phantom.

Adapted from https://www.elsesolutions.com/wp-content/uploads/2016/02/Spatial-Resolution-Phantom.pdf

Arguments

  • size::Tuple{Integer, Integer, Integer}: The size of the 3D phantom.
  • numHolesInRow::Integer: How many holes should be placed in one row.
  • numRows::Integer: Number of rows in the phantom.
  • holeSizes::Vector{Integer}: Sizes of holes at each row. This vector has to have an equal length to the number of rows present.

Returns

  • Array{Float64, 3}: The three dimensional phantom.
source
MPITestImages.testimageMethod
testimage(name, args; kwargs...)

Retrieve a test image with the given name and the matching parameters.

Note: The name must correspond either to a remote file or a function name annotated by the testimage_gen macro. If both exist, precedence is given to the function.

Examples

julia> image = testimage("delta_image", (8, 8), 2; sizeOfPoint=(3, 2), distanceOfPoints=(x -> 0, x -> 4), pivot=(3, 3))
8×8 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  1.0  1.0  0.0  0.0  1.0  1.0
 0.0  0.0  1.0  1.0  0.0  0.0  1.0  1.0
 0.0  0.0  1.0  1.0  0.0  0.0  1.0  1.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
source