STIR  6.2.0
Functions
CoG.cxx File Reference

This program computes the centre of gravity in each plane and writes its coordinates to file, together with a weight for each plane. More...

#include "stir/DiscretisedDensity.h"
#include "stir/VoxelsOnCartesianGrid.h"
#include "stir/shared_ptr.h"
#include "stir/CartesianCoordinate3D.h"
#include "stir/CartesianCoordinate2D.h"
#include "stir/warning.h"
#include "stir/centre_of_gravity.h"
#include <iostream>
#include <iomanip>
#include <numeric>
#include <fstream>
#include <algorithm>
#include <string>

Functions

int main (int argc, char *argv[])
 

Detailed Description

This program computes the centre of gravity in each plane and writes its coordinates to file, together with a weight for each plane.

Usage
CoG output_filename_prefix image_input_filename
Output will be in files output_filename_prefix.x and output_filename_prefix.y. Each will contain a list of all z coordinates (in mm), then all x/y coordinates (in mm), then all weights.
Details
The result can be used to find the central line of an (uniform) object, for instance a cylinder. The output of this program can by used by do_linear_regression.

The weight is currently simply the sum of the voxel values in that plane, thresholded to be at least 0. If the weight is 0, the x,y coordinates are simply set to 0.

All coordinates are in mm and in the standard STIR coordinate system, except that the origin in z is shifted to the centre of the planes.

Author
Kris Thielemans