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.
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;
}
IODGeneralSeriesModule & getSeries()
Get Series Module.
IODSOPCommonModule & getSOPCommon()
Get SOP Common Module.
IODGeneralStudyModule & getStudy()
Get General Study Module.
IODPatientModule & getPatient()
Get Patient Module.
virtual OFCondition getSeriesInstanceUID(OFString &value, const signed long pos=0) const
Get series instance UID.
virtual OFCondition getStudyInstanceUID(OFString &value, const signed long pos=0) const
Get Study Instance UID.
virtual OFCondition getPatientName(OFString &value, const signed long pos=0) const
Get Patient's Name.
virtual OFCondition getSOPInstanceUID(OFString &value, const signed long pos=0) const
Get SOP Instance UID.
General purpose class for condition codes.
Definition: ofcond.h:164
OFBool bad() const
check if the status is not OK, i.e. error or failure.
Definition: ofcond.h:302
const char * text() const
get a human readable text representation of this error code.
Definition: ofcond.h:277
a simple string class that implements a subset of std::string.
Definition: ofstring.h:76
Class representing a Track of of the "Tractography Results" IOD.
Definition: trctrack.h:36
virtual size_t getTrackData(const Float32 *&data) const
Get Track Data.
Class representing an object of the "Tractography Results" object IOD.
Definition: trctractographyresults.h:42
virtual size_t getNumberOfTrackSets()
Returns number of Track Sets in Tractography Results object.
static OFCondition loadFile(const OFString &filename, TrcTractographyResults *&tractography)
Load Tractography Results object from a file.
virtual OFVector< TrcTrackSet * > & getTrackSets()
Return Track Sets (from Tractography Results Module)
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;
}
Class representing a Code Sequence Macro.
Definition: iodmacro.h:35
virtual OFCondition set(const OFString &value, const OFString &scheme, const OFString &meaning, const OFString &schemeVersion="", const OFBool checkValue=OFTrue, const OFBool autoTag=OFTrue)
Set all values in this class conveniently.
Code with Modifier(s).
Definition: iodmacro.h:271
Content Identification Macro.
Definition: iodmacro.h:962
IODFoRModule & getFrameOfReference()
Get Frame of Reference Module.
virtual OFCondition setSeriesDescription(const OFString &value, const OFBool checkValue=OFTrue)
Set Series Description.
Class representing a reference to an image.
Definition: iodreferences.h:153
virtual OFCondition setPatientID(const OFString &value, const OFBool checkValue=OFTrue)
Set Patient ID.
virtual OFCondition setPatientName(const OFString &value, const OFBool checkValue=OFTrue)
Set Patient's Name.
Class that holds a set of IODReference instances (or its sub classes) and offers helper functionality...
Definition: iodreferences.h:291
virtual OFBool add(IODReference *ref)
Add reference to this set of references.
Class representing a Track Set within the Tractography Results IOD.
Definition: trctrackset.h:46
virtual OFCondition addTrack(const Float32 *pointData, const size_t numPoints, const Uint16 *recommendedCIELabColors, const size_t numColors, TrcTrack *&result)
Add track to Track Set.
virtual OFCondition saveFile(const OFString &filename, const E_TransferSyntax writeXfer=EXS_LittleEndianExplicit)
Save current object to given filename.
static OFCondition create(const ContentIdentificationMacro &contentIdentification, const OFString &contentDate, const OFString &contentTime, const IODEnhGeneralEquipmentModule::EquipmentInfo &equipment, const IODReferences &imageReferences, TrcTractographyResults *&result)
Create new Tractography Results object.
virtual OFCondition addTrackSet(const OFString &trackSetLabel, const OFString &trackSetDescription, const CodeWithModifiers &anatomyCode, const CodeSequenceMacro &diffusionModelCode, const AlgorithmIdentificationMacro &algoIdentCode, TrcTrackSet *&trackSet)
Add Track Set to object.
#define OFFIS_DCMTK_VERSION_STRING
DCMTK version number (as string) for this release.
Definition: dcuid.h:221
Convenient struct containing all information required for setting enhanced equipment information (for...
Definition: modenhequipment.h:45