|
TPCCLIB
|
IO functions for DICOM files. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <string.h>#include "tpcextensions.h"#include "tpcdcm.h"Go to the source code of this file.
Functions | |
| 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) |
IO functions for DICOM files.
Definition in file dcmio.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().
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().
| 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().
| 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().
| 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().