This module contains classes to deal with DICOM Tractography Results objects. It is able to create, load and access the contained fiber tracks and the related meta information.
The module fully supports Measurements and Statistics (on a per-track and track set) basis as defined in the standard.
Several checks (as possible) make sure that only valid Tractography objects can be written. However, this module is not meant to modify existing Tractography Result objects but only to create them from scratch. This means that loading a file and then modify it may lead to inconsistent DICOM objects when saved.
This module makes heavy use of the dcmiod module for managing common IOD attributes as found in the Patient, General Study or General Series Module.
The main class of this module is:
Examples
The following (complete) example shows how to load a DICOM Tractography Results object and dump an overview of the contained data:
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmtract/trctractographyresults.h"
#include "dcmtk/dcmtract/trctrack.h"
int main(int argc, char *argv[])
{
if (argc < 2)
{
CERR << "Usage: read <inputfile>" << OFendl;
return 1;
}
{
CERR <<
"Unable to load Tractography Results file: " << result.
text();
return 1;
}
COUT << "Patient Name: " << val << OFendl;
COUT << "Study : " << val << OFendl;
COUT << "Series : " << val << OFendl;
COUT << "Instance : " << val << OFendl;
COUT << "-------------------------------------------------------------------------" << OFendl;
COUT << "Track Sets (total: " << numTrackSets << ")" << OFendl;
for (size_t ts = 0; ts < numTrackSets; ts++)
{
size_t numTracks = sets[ts]->getNumberOfTracks();
COUT << " Track Set #" << ts << ": " << numTracks << " Tracks, "
<< sets[ts]->getNumberOfTrackSetStatistics() << " Track Set Statistics, "
<< sets[ts]->getNumberOfTrackStatistics() << " Track Statistics, "
<< sets[ts]->getNumberOfMeasurements() << " Measurements " << OFendl;
for (size_t t = 0; t < numTracks; t++)
{
TrcTrack* track = sets[ts]->getTracks()[t];
const Float32* vals = NULL;
COUT << " Track #" << t << "'s first 3/" << numTracks << " points: ";
for (size_t v = 0; (v < 3) && (v < numPoints); v++)
{
COUT << "(" << vals[v] << "," << vals[v+1] << "," << vals[v+2] << ") " ;
}
COUT << OFendl;
}
}
delete trc;
return 0;
}
The following (complete) example demonstrates creation of a minimal Tractography Results object (single TrackSet with one Track and no Statistics or Measurements). All IDs, UIDs and Track values are, of course, just meaningless examples:
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmtract/trctractographyresults.h"
int main(int argc, char *argv[])
{
anatomy.
set(
"T-A0095",
"SRT",
"White matter of brain and spinal cord");
trc->
addTrackSet(
"First and last Track Set",
"Mini description", anatomy, diffusionModel, algorithmId,
set);
Uint16 cieLabColor[3];
cieLabColor[0] = 30000;
cieLabColor[1] = 0 ;
cieLabColor[2] = 0 ;
Float32 pointData[30];
for (size_t f = 0; f < 10; f++)
{
pointData[f*3] = f;
pointData[f*3+1] = 1;
pointData[f*3+2] = 2;
}
set->addTrack(pointData, 10, cieLabColor, 1 , track);
delete trc;
return 0;
}