Simple It K Tutorial
Simple It K Tutorial
numpyOrigin = np.array(list(reversed(itkimage.GetOrigin())))
numpySpacing = np.array(list(reversed(itkimage.GetSpacing())))
1
Since the coordinates of the candidates are given in World Coordinates, we now need to transform
from world coordinates to voxel coordinates. We define now a function to do that. Please note that the
transformation below is only valid if there is no rotation component in the transformation matrix. For all
CT images in our dataset, there is no rotation component so that this formula can be used. This function
takes as inputs: - The world coordinates - The origin - The pixel Spacing This function returns: - Voxel
coordinates (voxelCoord)
We want to extract now some features from the candidates. We define some normalized planes to extract
views from the candidates
maxHU = 400.
minHU = -1000.
After having defined these auxiliary functions, we can now define the main part of our script. First we: -
Specify the path where the image (img path) is - Specificy the path where the file with the list of candidates
is (cand path)
Using the function defined in line 2 we can: - Load the image - Extract the Origin - Extract the Pixel
Spacing
Using the function defined in line 3 we can: - Load the csv file - Get the candidates Using the function
defined in line 4 we can: - Transform from world to voxel coordinates
2
[[seriesuid, coordX, coordY, coordZ, label], [1.3.6.1.4.1.14519.5.2.1.6279.6001.1484472864640
Using the function defined in line 5 we can: - Extract patch for each candidate in the list - Visualize each
patch - Save each page as image in .tiff format