/usr/include/dcmtk/dcmfg/fginterface.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 | /*
*
* Copyright (C) 2015-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: dcmfg
*
* Author: Michael Onken
*
* Purpose: Main interface class for managing Functional Groups
*
*/
#ifndef FGINTERFACE_H
#define FGINTERFACE_H
#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/ofvector.h"
#include "dcmtk/ofstd/ofmap.h"
#include "dcmtk/dcmdata/dcsequen.h"
#include "dcmtk/dcmdata/dcdatset.h"
#include "dcmtk/dcmdata/dctk.h"
#include "dcmtk/dcmiod/iodrules.h"
#include "dcmtk/dcmfg/fgtypes.h"
#include "dcmtk/dcmfg/fgdefine.h"
#include "dcmtk/dcmfg/fg.h"
// Forward declaration
class IODMultiframeDimensionModule;
/** Main interface class to access functional groups from DICOM Enhanced
* objects. Allows reading, modifying and writing functional groups back
* and forth from DICOM datasets.
*/
class DCMTK_DCMFG_EXPORT FGInterface
{
public:
/// Type representing per-frame functional groups, i.e.\ a number of
/// functional groups assigned to each frame
typedef OFMap<Uint32, FunctionalGroups*> PerFrameGroups;
/// Iterator type for iterating over functional groups
typedef FunctionalGroups::iterator iterator;
/// Const iterator type for iterating over functional groups
typedef FunctionalGroups::const_iterator const_iterator;
/** Constructor, constructs empty sets of per-frame and shared
* functional groups
*/
FGInterface();
/** Virtual destructor, frees memory
*/
virtual ~FGInterface();
/** Delete all functional groups (shared and per-frame)
*/
virtual void clear();
/** Checks the functional groups for consistency
* @return OFTrue, if check consistency is ok, error otherwise
*/
virtual OFBool check();
/** Returns number of frames. Computed by number of per-frame
* functional group items (i.e.\ the Number of Frames attribute
* is not taken into account).
* @return Number of frames
*/
virtual size_t getNumberOfFrames();
/** Read enhanced multi-frame information from DICOM item, usually
* DcmDataset, i.e.\ must contain Shared and Per-frame Functional Group
* Sequences
* @param dataset The item to read from
* @return EC_Normal if reading was successful, error otherwise
*/
virtual OFCondition read(DcmItem& dataset);
/** Write enhanced multi-frame information to DICOM item,
* usually DcmDataset, i.e.\ writes Shared and Per-frame Functional Group
* Sequences
* @param dataset The item to write to
* @return EC_Normal if successful, error otherwise
*/
virtual OFCondition write(DcmItem& dataset);
/** Get specific functional group for a frame, no matter whether it is stored
* per frame or shared
* @param frameNo The frame number the functional group should apply to
* (starts with 0)
* @param fgType The type of functional group to look for
* @return The functional group if found, NULL otherwise
*/
virtual FGBase* get(const Uint32 frameNo,
const DcmFGTypes::E_FGType fgType);
// TODO Add get(..) version that takes the sequence tag (e.g.\ for unknown
// functional groups
/** Get specific functional group for a frame, no matter whether it is stored
* per frame or shared.
* @param frameNo The frame number of group of interest (starts from 0)
* @param fgType The type of functional group to look for
* @param isPerFrame If OFTrue, the group found was found as per-frame,
* otherwise it is a shared functional group
* @return The functional group if found, error otherwise
*/
virtual FGBase* get(const Uint32 frameNo,
const DcmFGTypes::E_FGType fgType,
OFBool& isPerFrame);
/** Return all per-frame functional groups, e.g.\ to iterate over them
* @param frameNo The frame number of the groups of interest (starts from 0)
* @return The per-frame functional groups for the given frame
*/
const FunctionalGroups* getPerFrame(const Uint32 frameNo) const;
/** Return all shared functional groups, e.g.\ to iterate over them
* @return The shared functional groups
*/
const FunctionalGroups* getShared() const;
/** Add functional group that should be shared for all frames. This will
* delete all per-frame groups of the same type if existing.
* @param group The group to be added. The group is copied.
* @return EC_Normal, if adding was successful, error otherwise
*/
virtual OFCondition addShared(const FGBase& group);
/** Add functional group for given frame. If there is already a shared
* functional group with identical values, the call returns without
* errors, too. If there is a shared group that differs, the shared group
* is converted to be "per-frame" for all frames and then the given group
* is inserted for the frame specified by the user.
* If a per-frame functional group of the same type already exists it is
* overwritten.
* @param frameNo The frame number this group should be added for (starts
* from 0)
* @param group The group to be added. The group is copied when adding,
* so the ownership stays with the caller, no matter what the
* method returns.
* @return EC_Normal, if adding was successful, error otherwise
*/
virtual OFCondition addPerFrame(const Uint32 frameNo,
const FGBase& group);
/** Deletes a shared functional group of the given type
* @param fgType The type of functional group to delete
* @return OFTrue if group existed and could be deleted, OFFalse (group did
* not exist) otherwise
*/
virtual OFBool deleteShared(const DcmFGTypes::E_FGType fgType);
/** Deletes per-frame functional group of the given type for a specific frame
* @param frameNo The frame number for the functional group of interest.
* First frame is frame 0.
* @param fgType The type of functional group to delete
* @return OFTrue if group existed and could be deleted, OFFalse (group did
* not exist) otherwise
*/
virtual OFBool deletePerFrame(const Uint32 frameNo,
const DcmFGTypes::E_FGType fgType);
/** Deletes per-frame functional group for all frames
* @param fgType The type of functional group to delete
* @return Number of per-frame groups deleted (usually equal to number of
* frames)
*/
size_t deletePerFrame(const DcmFGTypes::E_FGType fgType);
/** Deletes all functional groups for a specific frame
* @param frameNo The frame number whose functional groups should be deleted.
* First frame is frame 0.
* @return Number of per-frame groups deleted for this frame
*/
size_t deleteFrame(const Uint32 frameNo);
protected:
/** Get shared functional group based on its type
* @param fgType The type of functional group
* @return The functional group or NULL if not existent
*/
virtual FGBase* getShared(const DcmFGTypes::E_FGType fgType);
/** Insert shared functional group
* @param group The functional group to be inserted
* @param replaceExisting If OFTrue, an existing shared functional group
* will be deleted, otherwise the old group is not overwritten
* @return EC_Normal if insertion worked, FG_EC_DoubledFG if group exists and
* is not overwritten, other error code for other cases
*/
virtual OFCondition insertShared(FGBase* group,
const OFBool replaceExisting = OFTrue);
/** Get per-frame functional group
* @param frameNo The frame number of the group
* @param fgType The type of the group
* @return The functional group or NULL if not existent
*/
virtual FGBase* getPerFrame(const Uint32 frameNo,
const DcmFGTypes::E_FGType fgType);
/** Insert per-frame functional group
* @param frameNo The frame number the group should be added for
* @param group The functional group to be inserted
* @param replaceExisting If OFTrue, an existing per-frame functional group
* will be deleted, otherwise the old group is not overwritten
* @return EC_Normal if insertion worked, FG_EC_DoubledFG if group exists and
* is not overwritten, other error code for other cases
*/
virtual OFCondition insertPerFrame(const Uint32 frameNo,
FGBase* group,
const OFBool replaceExisting = OFTrue);
/** Get existing per-frame group or create it for the given frame. Note that
* the per-frame groups do not have to be created "in order", i.e.\ one could
* add groups in order 3,5,1 ,... .
* @param frameNo The frame number to get/create per-frame groups for
* @return The functional groups if found/created, NULL in case of error
*/
virtual FunctionalGroups* getOrCreatePerFrameGroups(const Uint32 frameNo);
/** Read Shared Functional Group Sequence from given item
* @param dataset The item to read from
* @return EC_Normal if reading was successful, error otherwise
*/
virtual OFCondition readSharedFG(DcmItem& dataset);
/** Read Per-Frame Functional Group Sequence from given item
* @param dataset The item to read from
* @return EC_Normal if reading was successful, error otherwise
*/
virtual OFCondition readPerFrameFG(DcmItem& dataset);
/** Read single functional group into the item provided
* @param fgItem The item to read from
* @param groups The resulting group after reading
* @return EC_Normal if reading was successful, error otherwise
*/
virtual OFCondition readSingleFG(DcmItem& fgItem,
FunctionalGroups& groups);
/** Write Shared Functional Group Sequence to given item
* @param dataset The item to write to
* @return EC_Normal if writing was successful, error otherwise
*/
virtual OFCondition writeSharedFG(DcmItem& dataset);
/** Write Per-Frame Functional Group Sequence to given item
* @param dataset The item to write to
* @return EC_Normal if writing was successful, error otherwise
*/
virtual OFCondition writePerFrameFG(DcmItem& dataset);
/** Convert a shared functional group to a per-frame one by copying the
* shared one into a per-frame one for each frame and deleting the shared one
* aftewrards.
* @param fgType The type of functional group to convert
* @return EC_Normal if conversion worked out, FG_EC_NoSuchGroup if such a
* group does not exist and other error otherwise. In the last case
* the functional groups may be left in invalid state, but that
* should only happen for fatal errors like exhausted memory.
*/
virtual OFCondition convertSharedToPerFrame(const DcmFGTypes::E_FGType fgType);
private:
/// Shared functional groups
FunctionalGroups m_shared;
/// Link from frame number (map key) to the list of functional groups (value)
/// relevant for the frame
PerFrameGroups m_perFrame;
};
#endif // MODMULTIFRAMEFGH_H
|