xdesign.phantom

Functions:

Phantom([shape]) Phantom generation class.
class xdesign.phantom.Phantom(shape=u'circle')[source]

Bases: object

Phantom generation class.

shape

string

Shape of the phantom. Available options: circle, square.

population

scalar

Number of generated features in the phantom.

area

scalar

Area of the features in the phantom.

feature

list

List of features.

append(feature)[source]

Add a feature to the top of the phantom.

density

Returns the area density of the phantom. (Does not acount for mass_atten.)

insert(i, feature)[source]

Insert a feature at a given depth.

list
load(filename)[source]

Load phantom from file.

numpy()[source]

Returns the Numpy representation.

pop(i=-1)[source]

Pop i-th feature from the phantom.

reverse()[source]

Reverse the features of the phantom

rotate(theta, origin=<xdesign.geometry.Point object>, axis=None)[source]

Rotate phantom around a point.

save(filename)[source]

Save phantom to file.

sort(param=u'mass_atten', reverse=False)[source]

Sorts the features by mass_atten or size

sprinkle(counts, radius, gap=0, region=None, mass_atten=1, max_density=1)[source]

Sprinkle a number of circles. Uses various termination criteria to determine when to stop trying to add circles.

Parameters:
  • counts (int) – The number of circles to be added.
  • radius (scalar or list) – The radius of the circles to be added.
  • gap (float, optional) – The minimum distance between circle boundaries. A negative value allows overlapping edges.
  • region (Entity, optional) – The new circles are confined to this shape. None if the circles are allowed anywhere.
  • max_density (scalar, optional) – Stops adding circles when the geometric density of the phantom reaches this ratio.
  • mass_atten (scalar, optional) – A mass attenuation parameter passed to the circles.
Returns:

counts (scalar) – The number of circles successfully added.

translate(dx, dy)[source]

Translate phantom.