This file is indexed.

/usr/include/dcmtk/dcmtract/trctrackset.h is in libdcmtk-dev 3.6.2-3build3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
    /*
 *
 *  Copyright (C) 2016, Open Connections GmbH
 *  All rights reserved.  See COPYRIGHT file for details.
 *
 *  This software and supporting documentation are maintained by
 *
 *    OFFIS e.V.
 *    R&D Division Health
 *    Escherweg 2
 *    D-26121 Oldenburg, Germany
 *
 *
 *  Module:  dcmtract
 *
 *  Author:  Michael Onken
 *
 *  Purpose: Class representing a Track Set from a Tractography Results IOD
 *
 */


#ifndef TRCTRACKSET_H
#define TRCTRACKSET_H

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmiod/modbase.h"
#include "dcmtk/dcmiod/iodutil.h"
#include "dcmtk/dcmiod/iodmacro.h"   // for CodeSequenceMacro and CodeWithModifiers
#include "dcmtk/dcmtract/trctypes.h"


// Forward declarations
class TrcTracksStatistic;
class TrcTrackSetStatistic;
class TrcTrack;
class TrcMeasurement;

/** Class representing a Track Set within the Tractography Results IOD. A Track
 *  Set is a set of tracks (really), and might define a measurements and
 *  statistics which then must be populated for all tracks in the set.
 *
 */
class DCMTK_DCMTRACT_EXPORT TrcTrackSet
: public IODComponent
{

public:

  // Allow read/write functions in DcmIODUtil to access class internals
  friend class DcmIODUtil;

  /** Create TrcTrackSet object by proving required data
   *  @param  trackSetLabel Label for the Track Set (256 chars max, VR=LO)
   *  @param  trackSetDescription Description for the Track Set (2^32-2 bytes
   *          maximum, VR=UT)
   *  @param  trackSetAnatomy Code for the anatomy the Track Set covers. DICOM
   *          proposes CID 7710 "Tractography Anatomic Sites" (Baseline)
   *  @param  trackSetDiffusionModelCode Code for diffusion model used for Track
   *          Set. DICOM prescribes code from CID 7261 "Diffusion Model Value
   *          Types"
   *  @param  trackSetAlgorithmIdentification Algorithm used in order to
   *          create Track Set. DICOM prescribes code from CID 7262 "Diffusion
   *          Tractography Algorithm Families".
   *  @param  trackSet Returns the created Track Set, if successfull (NULL
   *          otherwise)
   *  @return EC_Normal if creation was successful, error otherwise
   */
  static OFCondition create(const OFString& trackSetLabel,
                            const OFString& trackSetDescription,
                            const CodeWithModifiers& trackSetAnatomy,
                            const CodeSequenceMacro& trackSetDiffusionModelCode,
                            const CodeSequenceMacro& trackSetAlgorithmIdentification,
                            TrcTrackSet*& trackSet /* result */);

  /** Destructor, frees memory
   */
  virtual ~TrcTrackSet();

  /** Resets rules to their original values
   */
  virtual void resetRules();

  /** Set missing values by inventing "default values". Automatically
   *  called during write() by IODComponent.
   */
  virtual void inventMissing();

  /** Get name of component
   *  @return Name of the module ("TrackSetSequenceItem")
   */
  virtual OFString getName() const;

  /** Clear all data
   */
  virtual void clearData();

  /** Read attributes from given item into this class
   *  @param source  The source to read from
   *  @param clearOldData If OFTrue, old data is cleared before reading. Otherwise
   *         old data is overwritten (or amended)
   *  @result EC_Normal if reading was successful, error otherwise
   */
  virtual OFCondition read(DcmItem& source,
                           const OFBool clearOldData = OFTrue);

  /** Get Tracks of this Track Set
   *  @return Reference to Tracks of this Track Set
   */
  virtual const OFVector<TrcTrack*>& getTracks();

  /** Write attributes from this class into given item
   *  @param  destination The item to write to
   *  @result EC_Normal if writing was successful, error otherwise
   */
  virtual OFCondition write(DcmItem& destination);

   /** Get Track Set Number (should be 1-n)
    *  @param  value Reference to variable in which the value should be stored
    *  @param  pos Index of the value to get (0..vm-1)
    *  @return EC_Normal if successful, an error code otherwise
    */
  virtual OFCondition getTrackSetNumber(Uint16 &value,
                                        const unsigned long pos = 0) const;

  /** Get Track Set Label
   *  @param  value Reference to variable in which the value should be stored
   *  @param  pos Index of the value to get (0..vm-1), -1 for all components
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition getTrackSetLabel(OFString &value,
                                       const signed long pos = 0) const;

  /** Get Track Set Description
   *  @param  value Reference to variable in which the value should be stored
   *  @param  pos Index of the value to get (0..vm-1), -1 for all components
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition getTrackSetDescription(OFString &value,
                                             const signed long pos = 0) const;

  /** Get reference to Track Set Anatomical Type Code
   *  @return Reference to the code
   */
  virtual CodeWithModifiers& getTrackSetAnatomy();

  /** Get copy of Recommended Display CIELab Value
   *  @param L Returns CIELab L value
   *  @param a Returns CIELab a value
   *  @param b Returns CIELab b value
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition getRecommendedDisplayCIELabValue(Uint16& L,
                                                       Uint16& a,
                                                       Uint16& b);

  /** Get Recommended Line Thickness
   *  @param value Reference to the variable in which the value should be stored
   *  @param pos Index of the value to get (0..vm-1)
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition getRecommendedLineThickness(Float32& value,
                                                  const unsigned long pos = 0);
  /** Get Laterality.
   *  @param laterality Reference to the variable in which the value should be stored.
   *         If value in dataset is not set at all, LAT_UNKNOWN is returned. If
   *         a value is present that is not covered by the standard LAT_ERROR
   *         is returned.
   *  @return EC_Normal if successful (i.e. not LAT_ERROR), error code otherwise
   */
  virtual OFCondition getLaterality(TrcTypes::E_TrackSetLaterality& laterality);


  /** Find measurements of a specific type. They can be retrieved afterwards by
   *  using getMeasurement().
   *  @param  type The measurement type to look for
   *  @param  measurementNumbers Returns the measurement indexes that are
   *          of specified type.
   *  @return Always returns EC_Normal (for now).
   */
  virtual OFCondition findMeasurementsByType(const CodeSequenceMacro& type,
                                            OFVector<size_t>& measurementNumbers);

  /** Get measurement by index. The index can be identified by using
   *  findMeasurementsByType() or getMeasurementInfos()
   *  @param  measurementIndex The index of the measurement (starting from 0)
   *  @param  measurement Returns a reference to the measurement requested
   *  @return Returns EC_Normal if measurement exists, TRC_EC_NoSuchMeasurement
   *          otherwise
   */
  virtual OFCondition getMeasurement(const size_t measurementIndex,
                                     const TrcMeasurement*& measurement);

  /** Get descriptive information of all measurements
   *  @param typesAndUnits  Returns vector of pairs, which each pair holding
   *         a code for type of measurement and its physical units.
   */
  virtual void getMeasurementInfos(OFVector<OFPair<CodeSequenceMacro, CodeSequenceMacro> >& typesAndUnits);

  /** Get access to all statistics defined for the Tracks in this Track Set
   *  @return Returns reference to all Track statistics
   */
  virtual const OFVector<TrcTracksStatistic*>& getTrackStatistics();

  /** Get access to all statistics defined for the Tracks in this Track Set
   *  @return Returns reference to all Track statistics
   */
  virtual const OFVector<TrcTrackSetStatistic*>& getTrackSetStatistics();

  /** Get access to diffusion acquisition code
   *  @returns Returns reference to diffusion acquisition code
   */
  virtual CodeSequenceMacro& getDiffusionAcquisitionCode();

  /** Get access to diffusion model code used
   *  @return Returns reference to diffusion model code
   */
  virtual CodeSequenceMacro& getDiffusionModelCode();

  /** Get access to tracking algorithm identification codes
   *  @return Reference to tracking algorithm identification codes
   */
  virtual OFVector<CodeSequenceMacro*>& getTrackingAlgorithmIdentification();

  /** Returns number of Tracks in Track Set
   *  @return Number of Tracks in Track Set
   */
  size_t getNumberOfTracks();

  /** Returns number of Track Set Statistics in Track Set
   *  @return Number of Track Set Statistics in Track Set
   */
  size_t getNumberOfTrackSetStatistics();

  /** Returns number of Track Statistics in Track Set
   *  @return Number of Track Statistics in Track Set
   */
  size_t getNumberOfTrackStatistics();

  /** Returns number of Measurements in Track Set
   *  @return Number of Measurements in Track Set
   */
  size_t getNumberOfMeasurements();

  /** Add track to Track Set
   *  @param  pointData  Array of points (x,y,z coordinate for each point)
   *  @param  numPoints Number of points in pointData (i.e. number of point
   *          coordinates divided by 3)
   *  @param  recommendedCIELabColors Recommended display color(s) as CIELab
   *          values, i.e. L,a,b component(s). There are 3 modes:
   *          1) Single color: All points in track will be colored in that color
   *          2) No color (NULL): Color is not defined on a per-track basis but
   *          must be defined on Track Set level
   *          3) One color per point: Colors for all points are provided
   *          separately.
   *  @param  numColors  Number of colors defined in recommendedCIELabColors
   *          (must be either 0, 1 or numPoints)
   *  @param  result Returns the resulting Track if creation was successful,
   *          error otherwise
   */
  virtual OFCondition addTrack(const Float32* pointData,
                               const size_t numPoints,
                               const Uint16* recommendedCIELabColors,
                               const size_t numColors,
                               TrcTrack*& result);

  /** Add measurement for this Track Set
   *  @param  measurementCode The type of measurement. DICOM prescribes a code
   *          from  CID 7263 "Diffusion Tractography Measurement Types"
   *  @param  measurementUnitCodes The physical units of the measured value.
   *          DICOM prescribes a code from CID 82 "Units of Measurement".
   *  @param  measurement The created measurement, if successful, NULL otherwise
   *  @return EC_Normal if successful, error otherwise
   */
  virtual OFCondition addMeasurement(const CodeSequenceMacro& measurementCode,
                                     const CodeSequenceMacro& measurementUnitCodes,
                                     TrcMeasurement*& measurement /* result */);

  /** Add Track Statistic, i.e. statistic that is defined once and where a single
   *  value must be provided for all tracks.
   *  @param  typeCode The type of statistic, DICOM prescribes code from CID
   *          7263 "Diffusion Tractography Measurement Types".
   *  @param  typeModifierCode The region of interest of this statistic. DICOM
   *          prescribes code from CID 7464 "General Region of Interest
   *          Measurement Modifiers"
   *  @param  unitsCode The physical units of the measured value. DICOM
   *          prescribes a code from CID 82 "Units of Measurement".
   *  @param  values The statistical values, one for each track
   *  @param  numValues The number of values in statisticValues (must be equal to
   *          number of tracks in this Track Set)
   *  @param  statistic Returns the created statistic, if successful. NULL
   *          otherwise
   *  @return Returns EC_Normal if successful, error otherwise
   */
  virtual OFCondition addTrackStatistics(const CodeSequenceMacro& typeCode,
                                         const CodeSequenceMacro& typeModifierCode,
                                         const CodeSequenceMacro& unitsCode,
                                         const Float32* values,
                                         const size_t numValues,
                                         TrcTracksStatistic*& statistic /* result */);

  /** Add Track Set Statistic, i.e. a statistical value computed for the whole
   *  Track Set.
   *  @param  typeCode The type of statistic, DICOM prescribes code from CID
   *          7263 "Diffusion Tractography Measurement Types".
   *  @param  typeModifierCode The region of interest of this statistic. DICOM
   *          prescribes code from CID 7464 "General Region of Interest
   *          Measurement Modifiers"
   *  @param  unitsCode The physical units of the measured value. DICOM
   *          prescribes a code from CID 82 "Units of Measurement".
   *  @param  value The statistical value
   *  @param  statistic Returns the created statistic, if successful. NULL
   *          otherwise
   */
  virtual OFCondition addTrackSetStatistic(const CodeSequenceMacro& typeCode,
                                           const CodeSequenceMacro& typeModifierCode,
                                           const CodeSequenceMacro& unitsCode,
                                           const Float64 value,
                                           TrcTrackSetStatistic*& statistic /* result */);

  /** Set Track Set Label
   *  @param  value Value to be set (single value only) or "" for no value
   *  @param  checkValue Check 'value' for conformance with VR (LO) and VM (1)
   *          if enabled
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition setTrackSetLabel(const OFString &value,
                                       const OFBool checkValue = OFTrue);

  /** Set Track Set Description
   *  @param  value Value to be set (single value only) or "" for no value
   *  @param  checkValue Check 'value' for conformance with VR (UT) and VM (1)
   *          if enabled
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition setTrackSetDescription(const OFString &value,
                                             const OFBool checkValue = OFTrue);

  /** Set Recommended Display CIELab Value
   *  @param  L CIELab L component value
   *  @param  a CIELab a component value
   *  @param  b CIELab b component value
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition setRecommendedDisplayCIELabValue(const Uint16 L,
                                                       const Uint16 a,
                                                       const Uint16 b);

  /** Set Recommended Line Thickness
   *  @param  value Value to be set.  The units shall be the same as the units
   *          of the coordinate system in which the point coordinates are specified.
   *  @param  checkValue Check 'value' for conformance with VR (FL)
   *          if enabled
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition setRecommendedLineThickness(const Float32& value,
                                                  const OFBool checkValue = OFTrue);

  /** Set Laterality
   *  @param  value Value to be set
   *  @param  checkValue Check 'value' for conformance if enabled. Parameter is
   *          not used but present for consistency with other functions.
   *  @return EC_Normal if successful, an error code otherwise
   */
  virtual OFCondition setLaterality(const TrcTypes::E_TrackSetLaterality value,
                                    const OFBool checkValue = OFTrue);

protected:

  /** Protected constructor, use create() method to create a new Track Set
   */
  TrcTrackSet();

  /** Reads Track statistics from item into dedicated structures
   *  @param  source The item to read from, must contain Track Set Statistics
   *          Sequence
   *  @return EC_Normal if reading was successful, error otherwise
   */
  OFCondition readTrackStatistics(DcmItem& source);

  /** Reads Track Set statistics from item into dedicated structures
   *  @param  source The item to read from, must contain Track Statistics
   *          Sequence
   *  @return EC_Normal if reading was successful, error otherwise
   */
  OFCondition readTrackSetStatistics(DcmItem& source);

  OFCondition readMeasurements(DcmItem& source);

  /** Reads Tracks from item into dedicated structures
   *  @param  source The item to read from, must contain Track Sequence
   *  @return EC_Normal if reading was successful, error otherwise
   */
  OFCondition readTracks(DcmItem& source);

  /** Write Track Statistics to given item
   *  @param  result Returns EC_Normal if writing was successful, error otherwise
   *          or if result has not been EC_Normal when calling
   *  @param  destination The destination item to write to. The Track Statistic
   *          Sequence will be written by this method.
   */
  void writeTrackStatistics(OFCondition& result,
                            DcmItem& destination);

  /** Write Track Statistics to given item
   *  @param  result Returns EC_Normal if writing was successful, error otherwise
   *          or if result has not been EC_Normal when calling
   *  @param  destination The destination item to write to. The Track Set
   *          Statistic Sequence will be written by this method.
   */
  void writeTrackSetStatistics(OFCondition& result,
                               DcmItem& destination);

  /** Write Measurements to given item
   *  @param  result Returns EC_Normal if writing was successful, error otherwise
   *          or if result has not been EC_Normal when calling
   *  @param  destination The destination item to write to. The Measurements
   *          Sequence will be written by this method.
   *  @return Same as parameter "result"
   */
  OFCondition writeMeasurements(OFCondition& result,
                                DcmItem& destination);

  /** Write Tracks to given item
   *  @param  result Returns EC_Normal if writing was successful, error otherwise
   *          or if result has not been EC_Normal when calling
   *  @param  destination The destination item to write to. The Tracks Sequence
   *          will be written by this method.
   *  @return Same as parameter "result"
   */
  OFCondition writeTracks(OFCondition& result,
                          DcmItem& destination);

  /** Check whether measurements have data for all tracks
   *  @return EC_Normal measurement data is complete, TRC_EC_MeasurementDataMissing
   *          otherwise
   */
  OFCondition checkMeasurements();

private:

  /// Data for all tracks (i.e. content of Track Sequence)
  OFVector<TrcTrack*> m_Tracks;

  /// Anatomy code for this Track Set
  CodeWithModifiers m_Anatomy;

  /// Measurements for this Track Set
  OFVector<TrcMeasurement*> m_Measurements;

  /// Statistics for Tracks in this Track Set
  OFVector<TrcTracksStatistic*> m_TrackStatistics;

  /// Statistics for Track Set
  OFVector<TrcTrackSetStatistic*> m_TrackSetStatistics;

  /// Code for diffusion acquisition used for this Track Set
  CodeSequenceMacro m_DiffusionAcquisitionCode;

  /// Code for diffusion model used for this Track Set
  CodeSequenceMacro m_DiffusionModelCode;

  /// Codes for algorithms used to create this Track Set
  OFVector<CodeSequenceMacro*> m_TrackingAlgorithmIdentification;

};

#endif // TRCTRACKSET_H