# Wiki

Clone wiki# openSkin / Home

# Welcome

OpenSkin is a set of Python scripts to calculate skin doses from fluoroscopy radiation dose structured reports.

It is primarily intended for use with OpenREM but may also function as a standalone tool.

Whilst every effort has been made to produce a supplier independent design only certain equipment has been available for testing. Equipment specific bug reports are welcome.

## Requirements

OpenSkin needs python math and time modules and pypng and numpy installed. The main script also requires csv and easygui as well as the internal tkinter and os modules. Geometry classes are implemented internally.

For running the Python version, please install:

- PyPNG
- EasyGUI
- NumPY

OpenSkin was developed using Python 2.7 and has not been tested on Python 3.

# Design

Throughout the package a number of conventions are used.

Details of how phantoms are constructed can be found on the Phantom design page.

The package is divided into several components.

## Geometry classes

These classes define the basic geometry for the calculations.

`Segment_3`

is a line segment with a start and end.

`Triangle_3`

is a triangle used for intersections.

`Phantom`

is a flat representation defining cells of analyse, used for comparison to eg Gafchromic film.

`Phantom_3`

is a peeled patient representation defining cells of skin to analyse.

`SkinDose`

is a wrapper class to hold a set of skin dose results and provide a map of total dose.

## Mathematical functions

`intersect`

takes a segment and a triangle and computes whether they intersect.

`collimate`

uses the area of the beam at a known distance to create two triangles near the focal spot covering a square field to use for intersection calculations/

`findFocus`

calculates the position of the focus relative to the phantom given the translations and rotations.

`checkOrthogonal`

compares two vectors to find if they are within 90 degrees of each other. It is used to exclude rays which would pass through the neighbouring parts of the phantom.

`buildRay`

takes radiation structured dose report information and builds an x-ray beam, including rotation.

`checkMiss`

attempts to speed up code by carrying out a simple check to see whether the beam diverges from the target point. It is deprecated and should not be used.

`findNearest`

checks an array for the closest match. Used for matching back-scatter factors.

`getBSF`

returns the closest matched backs-catter factor for a specific set of exposure conditions.

`rotateRayY`

rotates a ray around its end point. Used for rotational exposures.

## Dose mapping functions

`skinMap`

runs an analysis on a given phantom and orientation.

`rotational`

runs an analysis on a rotational exposure (eg cone bean CT).

`skinMapToPng`

writes a dose map as either a colour or black and white PNG image.

`writeResultsToTxt`

exports useful results to a simple text file.

## Scripts to import data and run analyses

`main.py`

straps together calculations and adds a simple GUI. This is a good starting point for building custom scripts.

Updated