|
TPCCLIB
|
Header file for libtpcdcm. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include "tpcextensions.h"#include "tpcift.h"#include "tpcfileutil.h"#include "tpcisotope.h"Go to the source code of this file.
Data Structures | |
| struct | DCMTAG |
| struct | DCMITEM |
| struct | DCMFILE |
| struct | DCMMATRIX |
| struct | DCMML |
Enumerations | |
| enum | dcmtruid { DCM_TRUID_UNKNOWN , DCM_TRUID_LEI , DCM_TRUID_LEE , DCM_TRUID_LEED , DCM_TRUID_BEE , DCM_TRUID_JPEG50 , DCM_TRUID_JPEG51 , DCM_TRUID_JPEG70 , DCM_TRUID_JPEG80 , DCM_TRUID_JPEG81 , DCM_TRUID_JPEG90 , DCM_TRUID_JPEG91 , DCM_TRUID_JPEG92 , DCM_TRUID_JPEG93 , DCM_TRUID_MPEG100 , DCM_TRUID_MPEG102 , DCM_TRUID_MPEG103 , DCM_TRUID_RLE , DCM_TRUID_RFC , DCM_TRUID_XML , DCM_TRUID_INVALID } |
| enum | dcmvr { DCM_VR_AE , DCM_VR_AS , DCM_VR_AT , DCM_VR_CS , DCM_VR_DA , DCM_VR_DS , DCM_VR_DT , DCM_VR_FL , DCM_VR_FD , DCM_VR_IS , DCM_VR_LO , DCM_VR_LT , DCM_VR_OB , DCM_VR_OD , DCM_VR_OF , DCM_VR_OL , DCM_VR_OW , DCM_VR_PN , DCM_VR_SH , DCM_VR_SL , DCM_VR_SQ , DCM_VR_SS , DCM_VR_ST , DCM_VR_TM , DCM_VR_UC , DCM_VR_UI , DCM_VR_UL , DCM_VR_UN , DCM_VR_UR , DCM_VR_US , DCM_VR_UT , DCM_VR_INVALID } |
Functions | |
| void | dcmfileInit (DCMFILE *d) |
| void | dcmitemFree (DCMITEM *d) |
| void | dcmfileFree (DCMFILE *d) |
| unsigned short int | dcmfileMaxDepth (DCMFILE *df) |
| unsigned short int | dcmitemMaxDepth (DCMITEM *d) |
| unsigned short int | dcmitemParentNr (DCMITEM *d) |
| char * | dcmValueString (DCMITEM *d) |
| long int | dcmitemGetInt (DCMITEM *d) |
| double | dcmitemGetReal (DCMITEM *d) |
| DCMITEM * | dcmFindTag (DCMITEM *d, const short int omit, DCMTAG *tag, const int verbose) |
| void | dcmitemPrint (DCMITEM *d) |
| void | dcmTagSet (DCMTAG *tag, unsigned short int group, unsigned short int element) |
| int | dcmAddItem (DCMFILE *dcm, DCMITEM *d, short int aschild, DCMTAG tag, dcmvr vr, unsigned int vl, char *rd, const int verbose) |
| DCMITEM * | dcmFindDownTag (DCMITEM *d, const short int omit, DCMTAG *tag, const int verbose) |
| int | dcmTagIntRange (DCMITEM *d, DCMTAG *tag, int *mi, int *ma, const int verbose) |
| dcmtruid | dcmTrUID (const char *s) |
| char * | dcmTrUIDDescr (dcmtruid id) |
| char * | dcmTrUIDString (dcmtruid id) |
| unsigned int | dcmSOPIdentify (const char *s) |
| char * | dcmSOPName (unsigned int i) |
| char * | dcmSOPUID (unsigned int i) |
| char * | dcmSOPUIDName (const char *s) |
| unsigned char | dcmVRReserved (dcmvr id) |
| dcmvr | dcmVRId (const char *s) |
| char * | dcmVRName (dcmvr id) |
| size_t | dcmVRVLength (dcmvr id) |
| char * | dcmVRDescr (dcmvr id) |
| char * | dcmDA2intl (const char *orig, char *intl) |
| char * | dcmTM2intl (const char *orig, char *intl) |
| char * | dcmDT2intl (const char *orig, char *intl) |
| unsigned int | dcmDictSize () |
| int | dcmDictIndexTag (unsigned int i, unsigned short int *group, unsigned short int *element) |
| char * | dcmDictIndexVR (unsigned int i) |
| char * | dcmDictIndexType (unsigned int i) |
| char * | dcmDictIndexDescr (unsigned int i) |
| unsigned int | dcmDictFindTag (DCMTAG *tag) |
| int | dcmSameImage (const DCMFILE *d1, const DCMFILE *d2, const int verbose) |
| int | dcmFileList (const char *filename, IFT *ift, TPCSTATUS *status) |
| List DICOM files belonging to one image. | |
| int | dcmFileRemove (const char *filename, TPCSTATUS *status) |
| Remove DICOM files belonging to one image. | |
| int | dcmVerifyMagic (const char *filename, FILE *fp) |
| dcmtruid | dcmReadTransferSyntaxUID (FILE *fp) |
| int | dcmReadFileTag (FILE *fp, DCMTAG *tag) |
| int | dcmWriteFileTag (FILE *fp, DCMTAG *tag) |
| int | dcmWriteFileSQDelimItem (FILE *fp) |
| int | dcmWriteFileSQItemDelimTag (FILE *fp) |
| dcmvr | dcmReadFileVR (FILE *fp, char *vrstr) |
| unsigned int | dcmReadFileVL (FILE *fp, unsigned int n) |
| int | dcmReadFileVRVL (FILE *fp, dcmvr *vr, unsigned int *vl, unsigned int *n) |
| int | dcmWriteFileVRVL (FILE *fp, dcmvr vr, unsigned int vl, unsigned int *n) |
| int | dcmFileReadNextElement (DCMFILE *dcm, DCMITEM *prev_item, DCMITEM *parent_item, const short int sub, const short int headerOnly, int verbose) |
| int | dcmFileRead (const char *filename, DCMFILE *dcm, const short int headerOnly, TPCSTATUS *status) |
| int | dcmFileWrite (const char *filename, DCMFILE *dcm, TPCSTATUS *status) |
| int | dcmImgIsotope (DCMFILE *d, isotope *isot, decaycorrection *dc, const int verbose) |
| int | dcmImgPos (DCMFILE *d, double *imgpos, const int verbose) |
| int | dcmImgDim (DCMFILE *d, unsigned short int *imgdim, const int verbose) |
| int | dcmImgPxlsize (DCMFILE *d, double *pxlsize, const int verbose) |
| int | dcmImgOrient (DCMFILE *d, double *iop, const int verbose) |
| int | dcmImgXform (double *iop, double *xyzMM, double *imgPos, double *xform, const int verbose) |
| int | dcmXformToQuatern (double *xform, double *quatern, double *qoffset, const int verbose) |
| void | dcmmatrixInit (DCMMATRIX *m) |
| void | dcmmatrixFree (DCMMATRIX *m) |
| void | dcmmlInit (DCMML *d) |
| void | dcmmlFree (DCMML *d) |
| int | dcmmlAllocate (DCMML *d, int mNr) |
| int | dcmMListRead (IFT *ift, DCMML *ml, TPCSTATUS *status) |
| int | dcmmlSortByPlane (DCMML *d, TPCSTATUS *status) |
Header file for libtpcdcm.
Header file for library libtpcdcm.
Definition in file tpcdcm.h.
| enum dcmtruid |
DICOM Transfer Syntax UID.
In case of implicit VR, elements do NOT contain VR ! Reference: DICOM PS3.5 2017a chapter 10.
Items must be the same and in the same order as the dcm_truid list in dcmuid.c.
Definition at line 57 of file tpcdcm.h.
| enum dcmvr |
DICOM value representation (VR).
Reference: DICOM PS3.5 2017a chapter 6.2.
Items must be the same and in the same order as the dcm_vr list in dcmvr.c.
Definition at line 91 of file tpcdcm.h.
| int dcmAddItem | ( | DCMFILE * | dcm, |
| DCMITEM * | d, | ||
| short int | aschild, | ||
| DCMTAG | tag, | ||
| dcmvr | vr, | ||
| unsigned int | vl, | ||
| char * | rd, | ||
| const int | verbose ) |
Add an item to DCMFILE data struct.
| dcm | Pointer to DCMFILE. |
| d | Pointer to a previous item in DCMFILE, into which to link this item; enter NULL to add as next item to the highest level. |
| aschild | Add as child; 1=yes, 0=no. |
| tag | Tag |
| vr | VR |
| vl | VL; enter 0xFFFFFFFF to use VR's default length. |
| rd | Pointer to the item value as byte array |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 501 of file dcmdata.c.
Referenced by imgWriteDICOM().
| char * dcmDA2intl | ( | const char * | orig, |
| char * | intl ) |
Convert DICOM date 'DA' to international format YYYY-MM-DD.
| orig | Pointer to original DICOM string. |
| intl | Pointer to string where date in international format will be written; must be allocated for at least 11 characters. |
Definition at line 179 of file dcmvr.c.
Referenced by dcmMListRead().
| unsigned int dcmDictFindTag | ( | DCMTAG * | tag | ) |
Get the dictionary index for given tag.
| tag | Pointer to DICOM tag. |
Definition at line 2820 of file dcmdictionary.c.
Referenced by dcmFileReadNextElement().
| char * dcmDictIndexDescr | ( | unsigned int | i | ) |
Get the DICOM tag description, based on given dictionary index.
| i | Dictionary index [0..n-1]. |
Definition at line 2780 of file dcmdictionary.c.
Referenced by dcmFileReadNextElement().
| int dcmDictIndexTag | ( | unsigned int | i, |
| unsigned short int * | group, | ||
| unsigned short int * | element ) |
Get the DICOM tag group and element, based on given dictionary index.
| i | Dictionary index [0..n-1]. |
| group | Pointer to tag group; enter NULL if not needed. |
| element | Pointer to tag element; enter NULL if not needed. |
Definition at line 2744 of file dcmdictionary.c.
| char * dcmDictIndexType | ( | unsigned int | i | ) |
Get the DICOM Tag Type, based on given dictionary index.
Tag Type is a NULL terminated string.
Reference: DICOM PS3.3
| i | Dictionary index [0..n-1]. |
Definition at line 2804 of file dcmdictionary.c.
| char * dcmDictIndexVR | ( | unsigned int | i | ) |
Get the DICOM tag VR string, based on given dictionary index.
Definition at line 2766 of file dcmdictionary.c.
Referenced by dcmFileReadNextElement().
| unsigned int dcmDictSize | ( | ) |
Get the size of DICOM dictionary.
Definition at line 2730 of file dcmdictionary.c.
Referenced by dcmDictFindTag(), dcmDictIndexDescr(), dcmDictIndexTag(), dcmDictIndexType(), and dcmDictIndexVR().
| char * dcmDT2intl | ( | const char * | orig, |
| char * | intl ) |
Convert DICOM datetime 'DT' to international format YYYY-MM-DD hh:mm:ss.
| orig | Pointer to original DICOM string. Should be in format YYYYMMDDhhmmss.FFFFFF+hhmm |
| intl | Pointer to string where date and time in international format will be written; must be allocated for at least 20 characters. |
Definition at line 225 of file dcmvr.c.
Referenced by dcmMListRead(), and imgReadDICOM().
| void dcmfileFree | ( | DCMFILE * | d | ) |
Free memory allocated for DCMFILE data. All contents are destroyed.
| d | Pointer to DCMFILE. |
Definition at line 67 of file dcmdata.c.
Referenced by dcmFileList(), dcmFileRead(), dcmMListRead(), imgReadDICOM(), and imgWriteDICOM().
| void dcmfileInit | ( | DCMFILE * | d | ) |
Initiate the DCMFILE struct before any use.
| d | Pointer to DCMFILE. |
Definition at line 22 of file dcmdata.c.
Referenced by dcmfileFree(), dcmFileList(), dcmMListRead(), imgReadDICOM(), and imgWriteDICOM().
List DICOM files belonging to one image.
User can give DICOM image as a folder containing image file(s), or as a name of one of the files of the image. This function lists the files (with paths) belonging to the same image.
| filename | Pointer to the name of DICOM directory or file. |
| ift | Pointer to initiated IFT structure, into which file names will be stored; any previous contents will be deleted. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 123 of file dcmfile.c.
Referenced by dcmFileRemove(), and imgRead().
| unsigned short int dcmfileMaxDepth | ( | DCMFILE * | df | ) |
Get the maximum depth of DCMFILE items tree.
| df | Pointer to DCMFILE item. |
Definition at line 102 of file dcmdata.c.
| int dcmFileRead | ( | const char * | filename, |
| DCMFILE * | dcm, | ||
| const short int | headerOnly, | ||
| TPCSTATUS * | status ) |
Read a single DICOM file.
| filename | Pointer to filename. |
| dcm | Pointer to initiated data structure. |
| headerOnly | Read only header (1), or read both header and pixel data (0). |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 768 of file dcmio.c.
Referenced by dcmFileList(), dcmMListRead(), and imgReadDICOM().
| int dcmFileReadNextElement | ( | DCMFILE * | dcm, |
| DCMITEM * | prev_item, | ||
| DCMITEM * | parent_item, | ||
| const short int | sub, | ||
| const short int | headerOnly, | ||
| int | verbose ) |
Read an element from DICOM file, and add it to the given linked list. This function will be called recursively in case of sequential items.
| dcm | Pointer to DCMFILE struct; must be initiated before first call. |
| prev_item | Pointer to previous element; NULL if none exists (yet). |
| parent_item | Pointer to parent element; NULL if none exists (yet). |
| sub | Add as next element (0) or as child element. |
| headerOnly | Read only header (1), or read both header and pixel data (0). |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 409 of file dcmio.c.
Referenced by dcmFileRead(), and dcmFileReadNextElement().
| int dcmFileRemove | ( | const char * | filename, |
| TPCSTATUS * | status ) |
Remove DICOM files belonging to one image.
User can give DICOM image as a folder containing image file(s), or as a name of one of the files of the image.
| filename | Pointer to the name of DICOM directory or file. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 270 of file dcmfile.c.
Referenced by imgWriteDICOM().
Write a single DICOM file.
| filename | Pointer to file name. |
| dcm | Pointer to DICOM data to be written. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 852 of file dcmio.c.
Referenced by imgWriteDICOM().
Search for specified tag in DCMITEM data tree, but only downward.
| d | Pointer to current DICOM item. |
| omit | Omit this item from the search. |
| tag | Pointer to the DICOM tag that is searched for. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 428 of file dcmdata.c.
Referenced by dcmFindDownTag(), dcmFindTag(), dcmImgIsotope(), dcmImgPos(), dcmImgPxlsize(), dcmMListRead(), and imgReadDICOM().
Search for specified tag in DCMITEM data tree, from left to right, down and up.
| d | Pointer to current DICOM item. |
| omit | Omit this item from the search. |
| tag | Pointer to the DICOM tag that is searched for. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 375 of file dcmdata.c.
Referenced by dcmFileList(), dcmFindTag(), dcmImgDim(), dcmImgIsotope(), dcmImgOrient(), dcmImgPos(), dcmImgPxlsize(), dcmMListRead(), dcmSameImage(), dcmTagIntRange(), and imgReadDICOM().
| int dcmImgDim | ( | DCMFILE * | d, |
| unsigned short int * | imgdim, | ||
| const int | verbose ) |
Get DICOM image dimensions.
| d | Pointer to DCMFILE. |
| imgdim | Pointer to imgdim array of x, y, z, and frame numbers, to be filled here. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 232 of file dcmimage.c.
Referenced by imgReadDICOM().
| int dcmImgIsotope | ( | DCMFILE * | d, |
| isotope * | isot, | ||
| decaycorrection * | dc, | ||
| const int | verbose ) |
Get isotope and status of decaycorrection from DICOM.
| d | Pointer to DCMFILE. |
| isot | Pointer to isotope code, to be set here; enter NULL if not needed. |
| dc | Pointer to status of decaycorrection. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 24 of file dcmimage.c.
Referenced by imgReadDICOM().
| int dcmImgOrient | ( | DCMFILE * | d, |
| double * | iop, | ||
| const int | verbose ) |
Get DICOM image orientation (Patient).
| d | Pointer to DCMFILE. |
| iop | Pointer to iop array of six values, to be filled here. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 387 of file dcmimage.c.
Referenced by imgReadDICOM().
| int dcmImgPos | ( | DCMFILE * | d, |
| double * | imgpos, | ||
| const int | verbose ) |
Get DICOM Image Position (Patient).
| d | Pointer to DCMFILE. |
| imgpos | Pointer to imgpos array of x, y, and z coordinates of the upper left hand corner (centre of the first voxel) of the image, in mm, to be filled here. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 121 of file dcmimage.c.
Referenced by imgReadDICOM().
| int dcmImgPxlsize | ( | DCMFILE * | d, |
| double * | pxlsize, | ||
| const int | verbose ) |
Get DICOM Image voxel size.
| d | Pointer to DCMFILE. |
| pxlsize | Pointer to pxlsize array of x, y, and z sizes of image pixel, or actually, mm distance between neighbour voxel centres in x, y, and z directions. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 320 of file dcmimage.c.
Referenced by imgReadDICOM().
| int dcmImgXform | ( | double * | iop, |
| double * | xyzMM, | ||
| double * | imgPos, | ||
| double * | xform, | ||
| const int | verbose ) |
Calculate xform matrix from DICOM header information.
Based on dcm2niix xform_mat(), which is based on dicm2nii. Last vector xform[3][0..4] is not yet computed.
| iop | Array of 6 Image Orientation (Patient) parameters. |
| xyzMM | Array of 3 voxel sizes in mm (x, y, z). |
| imgPos | Array of 3 Image Position (Patient) parameters. |
| xform | Pointer to xform 4x4 matrix stored as an array of 16 doubles, to be filled here. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 431 of file dcmimage.c.
Referenced by imgReadDICOM().
| void dcmitemFree | ( | DCMITEM * | d | ) |
Recursively free memory allocated for DCMITEM items and their children items.
| d | Pointer to DCMITEM. |
Definition at line 39 of file dcmdata.c.
Referenced by dcmfileFree(), and dcmitemFree().
| long int dcmitemGetInt | ( | DCMITEM * | d | ) |
Read integer value from given DICOM item.
VR must be either UL, US, SL, SS, or IS; otherwise 0 is returned.
| d | Pointer to item. |
Definition at line 295 of file dcmdata.c.
Referenced by dcmImgDim(), dcmImgPos(), dcmMListRead(), dcmSameImage(), dcmTagIntRange(), and imgReadDICOM().
| double dcmitemGetReal | ( | DCMITEM * | d | ) |
Read floating point value from given DICOM item.
VR must be either FL, FD, DS, UL, US, SL, SS, or IS; otherwise 0 is returned.
| d | Pointer to item. |
Definition at line 331 of file dcmdata.c.
Referenced by dcmImgPxlsize(), dcmMListRead(), and imgReadDICOM().
| unsigned short int dcmitemMaxDepth | ( | DCMITEM * | d | ) |
Get the maximum depth of DCMITEM tree.
| d | Pointer to DCMITEM item. |
Definition at line 83 of file dcmdata.c.
Referenced by dcmfileMaxDepth(), and dcmitemMaxDepth().
| unsigned short int dcmitemParentNr | ( | DCMITEM * | d | ) |
Check how deep in DCMITEM tree this item is.
| d | Pointer to DCMITEM. |
Definition at line 122 of file dcmdata.c.
Referenced by dcmFileReadNextElement().
| void dcmitemPrint | ( | DCMITEM * | d | ) |
Print contents of given DICOM item into stdout.
| d | Pointer to item. |
Definition at line 467 of file dcmdata.c.
Referenced by dcmAddItem(), dcmFileWrite(), dcmMListRead(), and imgReadDICOM().
| void dcmmatrixFree | ( | DCMMATRIX * | m | ) |
Free memory allocated for DCMMATRIX data. All contents are destroyed.
| m | Pointer to DCMMATRIX. |
Definition at line 40 of file dcmmatrix.c.
Referenced by dcmmlFree().
| void dcmmatrixInit | ( | DCMMATRIX * | m | ) |
Initiate the DCMMATRIX struct before any use.
| m | Pointer to DCMMATRIX. |
Definition at line 22 of file dcmmatrix.c.
Referenced by dcmmatrixFree(), and dcmmlAllocate().
| int dcmmlAllocate | ( | DCMML * | d, |
| int | mNr ) |
Allocate more memory for DCMML data. Previous contents are preserved.
| d | Pointer to initiated and possibly previously allocated DCMML struct data; any old contens are preserved. |
| mNr | Nr of additional matrices to allocate; if struct contains unused space for requested number already, then nothing is done. |
Definition at line 89 of file dcmmatrix.c.
Referenced by dcmMListRead().
| void dcmmlFree | ( | DCMML * | d | ) |
Free memory allocated for DCMML data. All contents are destroyed.
| d | Pointer to DCMML. |
Definition at line 70 of file dcmmatrix.c.
Referenced by dcmMListRead().
| void dcmmlInit | ( | DCMML * | d | ) |
Initiate the DCMML struct before any use.
| d | Pointer to DCMMLIST. |
Definition at line 54 of file dcmmatrix.c.
Referenced by dcmmlFree().
Read DICOM image matrix list.
| ift | Pointer to IFT structure containing file names constituting a DICOM image. |
| ml | Pointer to initiated DICOM matrix list. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 120 of file dcmmatrix.c.
Sort matrices in DCMML (DICOM matrix list) struct by plane (slice) number.
| d | Pointer to DCMML struct |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 540 of file dcmmatrix.c.
| int dcmReadFileTag | ( | FILE * | fp, |
| DCMTAG * | tag ) |
Read DICOM tag from current file position.
| fp | File pointer, positioned at the start of the element (and tag). |
| tag | Pointer to DICOM tag struct; enter NULL if you just need to move file position over the tag. |
Definition at line 135 of file dcmio.c.
Referenced by dcmFileReadNextElement(), and dcmReadTransferSyntaxUID().
| unsigned int dcmReadFileVL | ( | FILE * | fp, |
| unsigned int | n ) |
Read DICOM value length (2 or 4 bytes, depending on VR) from current file position.
| fp | File pointer, positioned at the VL start. |
| n | Number of bytes (2 or 4) in the VL representation. |
Definition at line 274 of file dcmio.c.
Referenced by dcmFileReadNextElement(), and dcmReadTransferSyntaxUID().
| dcmvr dcmReadFileVR | ( | FILE * | fp, |
| char * | vrstr ) |
Read DICOM value representation (2 or 4 bytes) from current file position.
| fp | File pointer, positioned at the VR start. |
| vrstr | Pointer for VR string, allocated for at least 3 characters to have space for the trailing null; enter NULL if not needed. |
Definition at line 237 of file dcmio.c.
Referenced by dcmReadTransferSyntaxUID().
| int dcmReadFileVRVL | ( | FILE * | fp, |
| dcmvr * | vr, | ||
| unsigned int * | vl, | ||
| unsigned int * | n ) |
Read DICOM Value Representation (VR, 2 or 4 bytes) and Value Length (VL, 2 or 4 bytes) from current file position.
| fp | File pointer, positioned at the VR start. |
| vr | Pointer for enumerated VR value; enter NULL if not needed (file pointer moved anyway). |
| vl | Pointer for VL; enter NULL if not needed (file pointer moved anyway). |
| n | Pointer for number of bytes read from file; enter NULL if not needed. |
Definition at line 306 of file dcmio.c.
Referenced by dcmFileReadNextElement().
| dcmtruid dcmReadTransferSyntaxUID | ( | FILE * | fp | ) |
Read and identify the DICOM Transfer Syntax UID.
| fp | Pointer to DICOM file opened in binary format, and positioned right after the Magic number. Position will be returned to this position. |
Definition at line 73 of file dcmio.c.
Referenced by dcmFileRead().
Check that two DICOM files belong to the same image.
Defaults to yes, if the needed tags are missing.
| d1 | Pointer to the first DICOM file data (pixel data not necessary). |
| d2 | Pointer to the second DICOM file data (pixel data not necessary). |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 24 of file dcmfile.c.
Referenced by dcmFileList().
| unsigned int dcmSOPIdentify | ( | const char * | s | ) |
Identify the DICOM SOP UID.
| s | SOP UID string. |
Definition at line 62 of file dcmsop.c.
| char * dcmSOPName | ( | unsigned int | i | ) |
Get the DICOM SOP UID Name.
| i | SOP UID list index. |
Definition at line 83 of file dcmsop.c.
| char * dcmSOPUID | ( | unsigned int | i | ) |
Get the DICOM SOP UID.
| i | SOP UID list index. |
Definition at line 101 of file dcmsop.c.
| char * dcmSOPUIDName | ( | const char * | s | ) |
Get the name of DICOM SOP UID.
| s | SOP UID string. |
Definition at line 119 of file dcmsop.c.
Search the range of integer values for specified tag in DCMITEM data tree.
| d | Pointer to top DICOM item. |
| tag | Pointer to the DICOM tag that is searched for. |
| mi | Pointer to int where min value is written; NULL if not needed. |
| ma | Pointer to int where max value is written; NULL if not needed. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 631 of file dcmdata.c.
Referenced by dcmImgDim(), and dcmMListRead().
| void dcmTagSet | ( | DCMTAG * | tag, |
| unsigned short int | group, | ||
| unsigned short int | element ) |
Set DICOM Tag group and element.
| tag | Pointer to Tag to set. |
| group | Tag Group |
| element | Tag Element |
Definition at line 483 of file dcmdata.c.
Referenced by dcmFileList(), dcmImgDim(), dcmImgIsotope(), dcmImgOrient(), dcmImgPos(), dcmImgPxlsize(), dcmSameImage(), imgReadDICOM(), and imgWriteDICOM().
| char * dcmTM2intl | ( | const char * | orig, |
| char * | intl ) |
Convert DICOM time 'TM' to international format hh:mm:ss.
| orig | Pointer to original DICOM string. |
| intl | Pointer to string where time in international format will be written; must be allocated for at least 9 characters. |
Definition at line 202 of file dcmvr.c.
Referenced by dcmMListRead().
| dcmtruid dcmTrUID | ( | const char * | s | ) |
Identify the DICOM Transfer Syntax UID.
| s | UID string. |
Definition at line 66 of file dcmuid.c.
Referenced by dcmReadTransferSyntaxUID().
| char * dcmTrUIDDescr | ( | dcmtruid | id | ) |
Get the DICOM Transfer Syntax UID description.
| id | Transfer Syntax UID id (DCM_TRUID_LEI, ...). |
Definition at line 87 of file dcmuid.c.
Referenced by dcmFileRead().
| char * dcmTrUIDString | ( | dcmtruid | id | ) |
Get the DICOM Transfer Syntax UID string.
| id | Transfer Syntax UID id (DCM_TRUID_LEI, ...). |
Definition at line 105 of file dcmuid.c.
Referenced by imgWriteDICOM().
| char * dcmValueString | ( | DCMITEM * | d | ) |
Pre-process the DICOM element value into format suitable for printing.
Attribute tag
Float
Double
Unsigned 32-bit int
Unsigned 16-bit int
Signed 32-bit int
Signed 16-bit int
| d | Pointer to item containing the value to print. |
Definition at line 141 of file dcmdata.c.
Referenced by dcmFileReadNextElement(), dcmImgIsotope(), dcmImgOrient(), dcmImgPos(), dcmImgPxlsize(), dcmitemPrint(), dcmMListRead(), and imgReadDICOM().
| int dcmVerifyMagic | ( | const char * | filename, |
| FILE * | fp ) |
Verify that given file (either file name or file pointer) appears to be DICOM file, based on the magic number.
| filename | Name of file to open and to verify for the magic number; enter NULL to use the file pointer (next argument) instead. |
| fp | File pointer of file to check, opened with fp=fopen(filename, "rb"); enter NULL to open file (previous argument) locally. Previously opened file pointer is first rewound to start; if DICOM magic number is found, then file pointer is left to the end of magic number, and if not, it is rewound to the file start. |
Definition at line 25 of file dcmio.c.
Referenced by dcmFileList(), dcmFileRead(), and imgRead().
| char * dcmVRDescr | ( | dcmvr | id | ) |
Get the DICOM VR description.
| id | VR id (DCM_VR_AE, ...). |
Definition at line 162 of file dcmvr.c.
Referenced by dcmFileReadNextElement().
| dcmvr dcmVRId | ( | const char * | s | ) |
Identify the DICOM VR based on the two-character long string.
| s | VR string. Two first characters are used. String does not need to be null-terminated. |
Definition at line 103 of file dcmvr.c.
Referenced by dcmFileReadNextElement(), dcmReadFileVR(), and dcmReadFileVRVL().
| char * dcmVRName | ( | dcmvr | id | ) |
Get the DICOM VR name.
| id | VR id (DCM_VR_AE, ...). |
Definition at line 126 of file dcmvr.c.
Referenced by dcmAddItem(), dcmFileReadNextElement(), dcmitemPrint(), dcmReadFileVR(), and dcmWriteFileVRVL().
| unsigned char dcmVRReserved | ( | dcmvr | id | ) |
Is the explicit VR (2 bytes) followed by reserved 2 bytes? If yes, then the following Value Length is also given as 32-byte integer, if no, then as 16-bit integer.
| id | VR id (DCM_VR_AE, ...). |
Definition at line 85 of file dcmvr.c.
Referenced by dcmReadFileVR(), dcmReadFileVRVL(), dcmReadTransferSyntaxUID(), and dcmWriteFileVRVL().
| size_t dcmVRVLength | ( | dcmvr | id | ) |
Get the DICOM VR max value length in bytes; 0 if not defined.
| id | VR id (DCM_VR_AE, ...). |
Definition at line 144 of file dcmvr.c.
Referenced by dcmAddItem(), dcmFileReadNextElement(), dcmFileWrite(), and dcmValueString().
| int dcmWriteFileSQDelimItem | ( | FILE * | fp | ) |
Write DICOM Sequence delimitation item into current file position.
This item consists of four byte sequence delimitation tag (0xFFFE, 0xE0DD) and four byte item length (0x00000000), i.e. together 8 bytes.
| fp | File pointer, at the write position. |
Definition at line 191 of file dcmio.c.
Referenced by dcmFileWrite().
| int dcmWriteFileSQItemDelimTag | ( | FILE * | fp | ) |
Write DICOM Sequence Item Delimitation Tag with VL into current file position.
This tag consists of four bytes, sequence item delimitation tag (0xFFFE, 0xE00D), followed by four byte item length (0x00000000), i.e. together 8 bytes.
| fp | File pointer, at the write position. |
Definition at line 216 of file dcmio.c.
Referenced by dcmFileWrite().
| int dcmWriteFileTag | ( | FILE * | fp, |
| DCMTAG * | tag ) |
Write DICOM tag into current file position.
| fp | File pointer, at the write position. |
| tag | Pointer to DICOM tag struct to write. |
Definition at line 165 of file dcmio.c.
Referenced by dcmFileWrite(), dcmWriteFileSQDelimItem(), and dcmWriteFileSQItemDelimTag().
| int dcmWriteFileVRVL | ( | FILE * | fp, |
| dcmvr | vr, | ||
| unsigned int | vl, | ||
| unsigned int * | n ) |
Write DICOM Value Representation (VR, 2 or 4 bytes) and Value Length (VL, 2 or 4 bytes) into current file position.
| fp | File pointer, opened fro writing in binary mode. |
| vr | Enumerated VR value. |
| vl | VL |
| n | Pointer for number of bytes written into file; enter NULL if not needed. |
Definition at line 366 of file dcmio.c.
Referenced by dcmFileWrite().
| int dcmXformToQuatern | ( | double * | xform, |
| double * | quatern, | ||
| double * | qoffset, | ||
| const int | verbose ) |
Calculate quatern parameters for NIfTI from xform matrix.
Based on dcm2niix, but results are compatible with TPC ImageConverter.
| xform | Pointer to xform 4x4 matrix stored as an array of 16 doubles; not modified. |
| quatern | Pointer to quatern parameter b, c, and d array (size of 3); filled here; enter NULL, if not needed. |
| qoffset | Pointer to qoffset parameter x, y, and z array (size of 3); filled here; enter NULL, if not needed. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 540 of file dcmimage.c.
Referenced by imgReadDICOM().