DICOMSDL  0.79.20110728
DICOMSoftwareDevelopmentLibrary
dicom.h
Go to the documentation of this file.
1 /* -----------------------------------------------------------------------
2  *
3  * $Id$
4  *
5  * Copyright 2010, Kim, Tae-Sung. All rights reserved.
6  * See copyright.txt for details
7  *
8  * -------------------------------------------------------------------- */
9 
10 #ifndef __DICOM_H__
11 #define __DICOM_H__
12 
13 #include "dicomcfg.h"
14 #include <map>
15 #include <set>
16 #include <vector>
17 #include <string>
18 #include <list>
19 
20 namespace dicom { //------------------------------------------------------
21 
22 struct dicomfile;
23 struct dataset;
24 struct dataelement;
25 struct sequence;
27 
28 struct dicomdir;
29 
30 /* -----------------------------------------------------------------------
31  * define types
32  */
33 
34 #define DICOMSDL_UIDPREFIX "1.2.826.0.1.3680043.8.417.1"
35 #define DICOMSDL_IMPLCLASSUID DICOMSDL_UIDPREFIX".1"
36 #define DICOMSDL_IMPLVERNAME "DICOMSDL 2010SEP"
37 #define DICOMSDL_FILESETID "DICOMDIR"
38 
39 typedef uint32 tagtype;
40 typedef uint16 vrtype;
41 
42 #define make_tag(gggg,eeee) (((gggg)<< 16) + (eeee))
43 #define group_in_tag(tag) ((uint16)((tag) >> 16))
44 #define element_in_tag(tag) ((uint16)((tag) & 0xffff))
45 #define make_even(x) ((x)+((x)&1))
46 
47 const vrtype VR_NULL = 0x0000; /* NULL tag */
48 const vrtype VR_AE = 0x4541;
49 const vrtype VR_AS = 0x5341;
50 const vrtype VR_AT = 0x5441;
51 const vrtype VR_CS = 0x5343;
52 const vrtype VR_DA = 0x4144;
53 const vrtype VR_DS = 0x5344;
54 const vrtype VR_DT = 0x5444;
55 const vrtype VR_FD = 0x4446;
56 const vrtype VR_FL = 0x4c46;
57 const vrtype VR_IS = 0x5349;
58 const vrtype VR_LO = 0x4f4c;
59 const vrtype VR_LT = 0x544c;
60 const vrtype VR_OB = 0x424f;
61 const vrtype VR_OF = 0x464f;
62 const vrtype VR_OW = 0x574f;
63 const vrtype VR_PN = 0x4e50;
64 const vrtype VR_SH = 0x4853;
65 const vrtype VR_SL = 0x4c53;
66 const vrtype VR_SQ = 0x5153;
67 const vrtype VR_SS = 0x5353;
68 const vrtype VR_ST = 0x5453;
69 const vrtype VR_TM = 0x4d54;
70 const vrtype VR_UI = 0x4955;
71 const vrtype VR_UL = 0x4c55;
72 const vrtype VR_UN = 0x4e55;
73 const vrtype VR_US = 0x5355;
74 const vrtype VR_UT = 0x5455;
75 
76 /* VR_UK; strange VR which found in file from RAYPAX
77  * ; probably contains short string --; */
78 const vrtype VR_UK = 0x4b55;
79 /* VR_PIXSEQ is a custom VR only used in this program;
80  * for ENCODED PIXEL DATA
81  * i.e. in case of 0x7fe00010; VR_OB; len = -1 */
82 const vrtype VR_PIXSEQ = 0x5850;
83 /* VR_OFFSET is custom VR in this DICOM implementation.
84  * An element with VR_OFFSET contains offset of a directory record.
85  * Any elements with (0004;1200); (0004;1202); (0004;1400); (0004;1420) will
86  * have this VR. */
87 const vrtype VR_OFFSET = 0x534f;
88 
89 typedef enum {
90  DICOM_OK = 0,
92 
107 } errtype;
108 
109 
111 typedef uint32 opttype;
112 typedef uint32 optarg;
113 
114 const opttype OPT_DEFAULT = 0x0000;
115 
132 
150 
176 
183 
184 static const opttype default_load_opt = OPT_DEFAULT
185  //| OPT_LOAD_PARTIAL_FILE
186  //| OPT_LOAD_CONTINUE_ON_ERROR
187  //| OPT_LOAD_DONOT_COPY_DATA
188  ;
189 
190 static const opttype default_save_opt = OPT_DEFAULT
191  //| OPT_SAVE_WITHOUT_PREAMBLE
192  //| OPT_SAVE_WITHOUT_METAINFO
193  //| OPT_SAVE_IMPLICIT_SQ_LENGTH
194  //| OPT_SAVE_IMPLICIT_DATASET_LENGTH
195  //| OPT_SAVE_CALC_GROUPLENGTH
196  //| OPT_SAVE_BASIC_OFFSET_TABLE
197  ;
198 
199 
200 /* COPY DICOMDICT.HXX INTO HERE vvvv ---------------------------------- */
201 
202 /* -----------------------------------------------------------------------
203  *
204  * Converted from Part 7: Message Exchange (2009)
205  * Annex E Command Dictionary, E.1 REGISTRY OF DICOM COMMAND ELEMENTS
206  *
207  */
208 
209 typedef enum {
210  C_STORE_RQ = 0x0001,
211  C_STORE_RSP = 0x8001,
212  C_GET_RQ = 0x0010,
213  C_GET_RSP = 0x8010,
214  C_FIND_RQ = 0x0020,
215  C_FIND_RSP = 0x8020,
216  C_MOVE_RQ = 0x0021,
217  C_MOVE_RSP = 0x8021,
218  C_ECHO_RQ = 0x0030,
219  C_ECHO_RSP = 0x8030,
222  N_GET_RQ = 0x0110,
223  N_GET_RSP = 0x8110,
224  N_SET_RQ = 0x0120,
225  N_SET_RSP = 0x8120,
226  N_ACTION_RQ = 0x0130,
227  N_ACTION_RSP = 0x8130,
228  N_CREATE_RQ = 0x0140,
229  N_CREATE_RSP = 0x8140,
230  N_DELETE_RQ = 0x0150,
231  N_DELETE_RSP = 0x8150,
232  C_CANCEL_RQ = 0x0FFF,
233 } commandtype;
234 
235 
236 /* -----------------------------------------------------------------------
237  *
238  * Converted from DICOM Part 6: Data Dictionary (2009)
239  *
240  * Python codelet that converts uid name into 'uid variable name'.
241  *
242  uid = uid_name.upper().replace(' & ', 'AND')
243  uid = re.sub('['+re.escape(',-@/()')+']', ' ', uid)
244  uid = uid.split(':')[0]
245  uid = uid.split('[')[0]
246  uid = '_'.join(uid.split())
247  uid = 'UID_'+uid
248  if 'RETIRED' in uid: uid = None
249  */
250 
251 typedef enum {
426 } uidtype;
427 
428 /* COPY DICOMDICT.HXX INTO HERE ^^^^ ---------------------------------- */
429 
430 
431 /* -----------------------------------------------------------------------
432  * dataset
433  */
434 
435 typedef std::map <tagtype, dataelement *> element_dict_type;
436 
438 struct DLLEXPORT dataset {
439  element_dict_type edict; // element dictionary
440  uidtype tsuid; // transfer syntax for this dataset
441 
442  // load & save -------------------------------------------------------
443 
444  // return DICOM_OK or DICOM_DEFLATED_FILEIMAGE
445  // throw error string on error
446  int load(
447  void *instream, dicomfile* dfobj, uidtype tsuid,
448  opttype opt=default_load_opt, optarg arg=0);
449 
450  int save_a(char **val_a, int *len_a, opttype opt=default_save_opt);
451  int _save(void *ostream, uidtype tsuid, opttype opt);
452 
453  // get function ------------------------------------------------------
454  dataelement* get_dataelement(tagtype tag);
455 
456  /* tagstr accept following forms
457  (gggg,eeee mean group and element number of tag in hex form)
458  "0xggggeeee", "ggggeeee"
459  "ggggeeee.0.ggggeeee", "KeyWord" */
460  dataelement* get_dataelement(const char *tagstr);
461 
462  dataelement& operator[] (tagtype tag)
463  { return *get_dataelement(tag); };
464  dataelement& operator[] (const char *tagstr)
465  { return *get_dataelement(tagstr); };
466 
467  // add function ------------------------------------------------------
468  dataelement* add_dataelement(
469  tagtype tag, vrtype vr=VR_NULL,
470  uint32 len=0, void *ptr=NULL,
471  int endian=MACHINE_ENDIANNESS, int own_memory=false);
472  dataelement* add_dataelement(const char *tagstring, vrtype vr=VR_NULL);
473 
474  // del function ------------------------------------------------------
475  void remove_dataelement(tagtype tag);
476  void remove_all_dataelements();
477 
478  ~dataset() { remove_all_dataelements(); };
479 
480  void dump_string_a(char **val_a, int *len_a, std::string prefix="");
481  std::string dump_string(std::string prefix="");
482 
483  // image related function --------------------------------------------
484  void get_image_info(
485  int *width, int *height,
486  int *precision, int *signedness,
487  int *ncomponents, int *bytes_per_pixel,
488  int *nframes);
489  void set_image_dimension(
490  int width, int height,
491  int precision, int signedness, int ncomponents);
492 
493  void get_pixeldata_a(char **val_a, int *len_a);
494  int copy_pixeldata_to(char *buf, int rowstep, int framestep, int idx=-1);
495 
496  int copy_pixeldata_to(void *buf, int rowstep, int framestep, int idx=-1)
497  { return copy_pixeldata_to((char *)buf, rowstep, framestep, idx); }
498 
499  int set_pixeldata(uidtype tsuid, char *buf,
500  int width, int height, int prec, int sgnd, int ncomps, int nframes,
501  int rowstep, int framestep, int quality=0);
502 
503  // misc functions ----------------------------------------------------
504 
505  int set_filemetainfo(
506  uidtype sop_class_uid,
507  char* sop_instance_uid,
508  uidtype transfer_syntax_uid
509  );
510 
511  int change_pixelencoding(uidtype transfer_syntax_uid, int quality=0);
512 
513  inline int number_of_elements()
514  { return edict.size(); };
515 
516  // change dataelement->ptr when instream->data has changed
517  void realloc_ptr(long ptrdiff);
518 
519 private:
520  void _dump(std::iostream *os, std::string prefix);
521 };
522 
523 /* -----------------------------------------------------------------------
524  * dicomfile
525  */
526 
536 DLLEXPORT dicomfile* open_dicomfile
537  (const char *filename,
538  opttype opt=default_load_opt, optarg arg=0);
539 
551 DLLEXPORT dicomfile* open_dicomfile_from_memory
552  (char *data, int datasize,
553  opttype opt=default_load_opt, optarg arg=0);
554 
560 DLLEXPORT void close_dicomfile(dicomfile *df);
561 
562 struct DLLEXPORT dicomfile: public dataset {
563  void *stream;
564 
565  // read dicom file ---------------------------------------------------
566 
567  int load_from_file(const char *filename,
568  opttype opt=default_load_opt, optarg arg=0);
569  int load_from_data
570  (const char *data, int datasize,
571  opttype opt=default_load_opt, optarg arg=0);
572 
573  int save_to_file(const char *filename, opttype opt=default_save_opt);
574  int save_to_memory_a
575  (char **val_a, int *len_a, opttype opt=default_save_opt);
576 
577  // track the positions of dataset within dicomfile image -------------
578  std::map<uint32, dataset*> dataset_pos_list;
579  void mark_dataset_offset(uint32 offset, dataset *ds);
580  dataset* dataset_at(uint32 offset);
581 
582  // ctor & dtor -------------------------------------------------------
583  dicomfile() { stream = NULL; };
584  ~dicomfile();
585 
586  // return associated filename
587  char* get_filename();
588 
589 private:
590  void _read_from_stream(opttype opt, optarg arg);
591 };
592 
593 /* -----------------------------------------------------------------------
594  * dataelement
595  */
596 
597 struct DLLEXPORT dataelement {
598  tagtype tag; // DICOM data element's tag
599  vrtype vr; // DICOM data element's VR
600  uint32 len; // length of DICOM data element's value
601  void* ptr; // pointer to value
602  int endian; // LITTLE_ENDIAN or BIG_ENDIAN
603  int own_memory; // if true, ~dataelement() does free(ptr)
604 
605  uint8* get_ptr() { return (uint8 *)ptr; };
606 
607  // check validity ----------------------------------------------------
608 
609  inline int is_valid() { return (vr != VR_NULL); };
610  inline operator bool() { return (vr != VR_NULL); };
611 
612  // get int type value(s) ---------------------------------------------
613 
614  int to_int(int defaultvalue=0);
615  inline operator int () { return to_int(); };
616 
617  void to_int_values_a(int **values, int *nvalues);
618  std::vector<int> to_int_values();
619  operator std::vector<int> () { return to_int_values(); };
620 
621  // get double type value(s) ------------------------------------------
622 
623  double to_double(double defaultvalue=0.0);
624  inline operator double() { return to_double(); };
625 
626  void to_double_values_a(double **values, int *nvalues);
627  std::vector <double> to_double_values();
628  operator std::vector <double> () { return to_double_values(); };
629 
630  // get string type value ---------------------------------------------
631 
632  void to_string_a(char **val_a, int *len_a=NULL);
633  std::string to_string(const char* defaultvalue="");
634  inline operator std::string () { return to_string(); };
635 
636  // get raw value ----------------------------------------------------
637 
638  void raw_value(char **val, int *len);
639 
640  // get a representative string of value --------------------------------
641 
642  void repr_string_a(char **val_a, int *len_a, int max_len=80);
643  std::string repr_string(int max_len=80);
644 
645  // get the uid type value if element's vr is VR_UI -----------------------
646 
647  uidtype to_uid();
648  inline operator uidtype () { return to_uid(); };
649 
650  // set int type value(s) ---------------------------------------------
651 
652  void from_int(int value);
653  void from_int_values(int *values, int nvalues);
654 
655  inline void set_value(int value)
656  { from_int(value); };
657  inline void set_value(int *values, int nvalues)
658  { from_int_values(values, nvalues); };
659  void set_value(std::vector <int> & v);
660 
661  inline int operator=(int value)
662  { from_int(value); return value; };
663  inline std::vector <int> & operator=(std::vector <int> & v)
664  { set_value(v); return v; };
665 
666  // set double type value(s) ------------------------------------------
667 
668  void from_double(double value);
669  void from_double_values(double *values, int nvalues);
670 
671  inline void set_value(double value)
672  { from_double(value); };
673  inline void set_value(double *values, int nvalues)
674  { from_double_values(values, nvalues); };
675  void set_value(std::vector <double> & v);
676 
677  inline double operator=(double v)
678  { from_double(v); return v; };
679  inline std::vector <double> & operator=(std::vector <double> & v)
680  { set_value(v); return v; };
681 
682  // direct access function to sequence, recordoffset, ...
683 
684  int number_of_datasets();
685  dataset* dataset_at(int idx);
686  dataset* add_dataset();
688  { if (vr == VR_SQ && ptr) return (sequence *)ptr;
689  else return NULL; };
690  inline operator sequence* () { return to_sequence(); };
691 
692  int number_of_frames();
693 
694  void from_dataset(dataset *);
695  dataset* to_dataset();
696  inline operator dataset* () { return to_dataset(); };
697 
698  // set string type value(s) ------------------------------------------
699 
700  void from_string(const char *str);
701  void from_string(std::string &s)
702  { from_string((char *)(s.c_str())); };
703 
704  inline void set_value(char *str)
705  { from_string(str); };
706  inline void set_value(std::string &s)
707  { from_string((char *)(s.c_str())); };
708 
709  inline char* operator=(char * v)
710  { from_string(v); return v; };
711  inline std::string operator=(std::string &s)
712  { from_string((char *)(s.c_str())); return s; };
713 
714  // set raw type value(s) ---------------------------------------------
715 
716  void from_data(const char *data, int datasize);
717 
718  inline void set_value(const char *data, int datasize)
719  { from_data(data, datasize); };
720 
721  // -------------------------------------------------------------------
722 
723  void set_endian(int endian=MACHINE_ENDIANNESS);
724  int get_vm();
725 
726  // -------------------------------------------------------------------
727  int alloc_memory(int len); // return if alloc memory successfully
728  void free_value();
729  ~dataelement() { free_value(); };
730 
731  void _save(void *ostream, uidtype tsuid, opttype opt);
732 };
733 
734 DLLEXPORT dataelement* nullelement();
735 
736 class DLLEXPORT dataelement_iterator
737 {
738 public:
740  element_dict_type::iterator it;
741 
743  dataelement* next();
744 };
745 
746 /* -----------------------------------------------------------------------
747  * dataset sequence
748  */
749 
750 struct DLLEXPORT sequence {
751  std::vector <dataset *> seq;
752 
753  int load(void *instream, dicomfile* dfobj, uidtype tsuid);
754  int size() { return (int) seq.size(); };
755 
756  dataset* dataset_at(int idx) {
757  return (idx < size() ? seq[idx] : NULL);
758  }
759  dataset* operator[] (int idx)
760  { return dataset_at(idx); };
761 
762  dataset* add_dataset();
763  void add_dataset(dataset *ds);
764  void remove_dataset(int idx, bool delete_dataset=true);
765  void remove_dataset(dataset *ds, bool delete_dataset=true);
766  void remove_all_datasets(bool delete_dataset=true);
767 
768  void _save(void *ostream, uidtype tsuid, opttype opt);
769 
770  ~sequence() { remove_all_datasets(); };
771 
772 };
773 
774 
775 /* -----------------------------------------------------------------------
776  * struct DICOMDIR
777  */
778 
779 DLLEXPORT dicomdir* open_dicomdir
780  (const char *filename, opttype opt=default_load_opt);
781 DLLEXPORT dicomdir* open_dicomdir_from_memory
782  (char *data, int datasize, opttype opt=default_load_opt);
783 DLLEXPORT void close_dicomdir(dicomdir *df);
784 
785 // implementing a directory record
786 // see PS 3.3 - 2009
787 // F.3 BASIC DIRECTORY INFORMATION OBJECT DEFINITION
788 
789 struct dirrec_t {
790  // directory record type
791  char dirrec_type[20];
792 
793  // low level directory records
794  std::map<std::string, dirrec_t *> lowlevdir;
795 
796  // dataset containing keys for this directory record
798 
799  // if own_dataset is true, ~dirrec_t() should delete dataset
801 
802  void set_dirrec_type(const char *s);
803  dirrec_t();
804  ~dirrec_t();
805 };
806 
807 // implementing a DICOMDIR file
808 
809 struct DLLEXPORT dicomdir {
812 
813  int load_from_file
814  (const char *filename, opttype opt=default_load_opt);
815  int load_from_data
816  (const char *data, int datasize, opttype opt=default_load_opt);
817 
818  void save_to_file(const char *filename, opttype opt=default_save_opt);
819  void save_to_memory_a
820  (char **val_a, int *len_a, opttype opt=default_save_opt);
821 
822  dicomdir();
823  ~dicomdir();
824 
825  int add_dicomfile(dicomfile *df, char *ref_file_id);
826  int add_dicomfile(const char *filename, char *ref_file_id);
827 
828  void build_dicomfile();
829 
830  void _dump(dirrec_t* r, std::string key="", std::string prefix="");
831  void dump();
832 
833 protected:
834  int add_dicomfile_image_type(dicomfile *df, char *ref_file_id);
835  void analyze_directory_records(dirrec_t* base_dir, dataset *ds);
836  void make_root_dirrec_own_dataset(dirrec_t* r=NULL,
837  std::set<dataset *> *sds = (std::set<dataset *> *)NULL);
838 };
839 
840 // functions managing dataelement's tag list to be stored in DICOMDIR file
841 DLLEXPORT void add_tags_for_dicomdir(char **drtype_taglist);
842 DLLEXPORT void reset_tags_for_dicomdir();
843 
844 
845 /* -----------------------------------------------------------------------
846  * misc functions
847  */
848 
849 DLLEXPORT vrtype get_tag_vr (tagtype tag);
850 DLLEXPORT const char* get_tag_name (tagtype tag);
851 DLLEXPORT const char* get_tag_keyword (tagtype tag);
852 DLLEXPORT tagtype find_tag(const char *keyword);
853 
854 DLLEXPORT uidtype uidvalue_to_uid (const char *uidvalue);
855 DLLEXPORT const char *uid_to_uidvalue (uidtype uid);
856 DLLEXPORT const char *uidvalue_to_uidname (const char *uidvalue);
857 DLLEXPORT const char *uid_to_uidname (uidtype uid);
858 
859 DLLEXPORT const char *get_vr_repr (vrtype vr);
860 
861 // logging debug, warning and error messages
862 
863 typedef void (*logfunc)(char *msg);
864 DLLEXPORT void set_debug_logger(logfunc);
865 DLLEXPORT void set_warning_logger(logfunc);
866 DLLEXPORT void set_error_logger(logfunc);
867 
868 DLLEXPORT void set_display_debug_message(int b);
869 DLLEXPORT void set_display_warning_message(int b);
870 DLLEXPORT void set_display_debug_message(int b);
871 
872 // get error message
873 
880 DLLEXPORT char *get_error_message();
881 
882 // select decoder / encoder for decoding / encoding pixel data
883 
884 DLLEXPORT int use_decoder(uidtype tsuid, const char *codec_name);
885 DLLEXPORT int use_encoder(uidtype tsuid, const char *codec_name);
886 
887 // support functions for zipped DICOM files
888 
889 DLLEXPORT std::string zipfile_get_list(const char *filename);
890 DLLEXPORT void zipfile_extract_file_a(const char *zipfn, const char *fn,
891  char **val_a, int *len_a);
892 
893 // uid's length should not exceed 64 bytes
894 #define MAX_UID_LEN 64
895 
896 DLLEXPORT std::string gen_uid(char* base_uid=NULL);
897 DLLEXPORT void set_uid_prefix(char *u=NULL);
898 DLLEXPORT int is_valid_uid(char *u);
899 
908 DLLEXPORT dataset* pick_dataelements(dicomfile *df, const char **keys);
909 
911 {
912  void *m_rec;
913 
914 public:
915  dicomfile_sorter(const char **study_keys,
916  const char **study_desc_keys,
917  const char **ser_keys,
918  const char **ser_desc_keys,
919  const char **inst_keys);
921 
922  void add(dicomfile *dfobj, const char *fn);
923 
924  void rewind();
925 
926  size_t number_of_studies();
929 
930  const char* get_next_study();
931  const char* get_next_series();
932  const char* get_next_instance();
933 
934 };
935 
936 DLLEXPORT void test_func(char *s);
937 
938 } // namespace dicom -----------------------------------------------------
939 
940 #endif // __DICOM_H__
Definition: dicom.h:383
void set_value(const char *data, int datasize)
Definition: dicom.h:718
const vrtype VR_DT
Definition: dicom.h:54
const vrtype VR_CS
Definition: dicom.h:51
DLLEXPORT void zipfile_extract_file_a(const char *zipfn, const char *fn, char **val_a, int *len_a)
const char * get_next_instance()
DLLEXPORT uidtype uidvalue_to_uid(const char *uidvalue)
uint32 opttype
Definition: dicom.h:111
std::map< std::string, dirrec_t * > lowlevdir
Definition: dicom.h:794
void * ptr
Definition: dicom.h:601
sequence * to_sequence()
Definition: dicom.h:687
DLLEXPORT void test_func(char *s)
std::vector< double > & operator=(std::vector< double > &v)
Definition: dicom.h:679
const vrtype VR_PIXSEQ
Definition: dicom.h:82
Definition: dicom.h:214
vrtype vr
Definition: dicom.h:599
Definition: dicom.h:232
const vrtype VR_UN
Definition: dicom.h:72
DLLEXPORT const char * get_tag_keyword(tagtype tag)
void add(dicomfile *dfobj, const char *fn)
DLLEXPORT const char * get_tag_name(tagtype tag)
DLLEXPORT const char * uid_to_uidvalue(uidtype uid)
int is_valid()
Definition: dicom.h:609
Definition: dicom.h:223
Definition: dicom.h:90
Definition: dicom.h:438
Definition: dicom.h:423
void set_value(char *str)
Definition: dicom.h:704
std::string operator=(std::string &s)
Definition: dicom.h:711
const vrtype VR_LO
Definition: dicom.h:58
int operator=(int value)
Definition: dicom.h:661
dataset * ds
Definition: dicom.h:797
DLLEXPORT const char * get_vr_repr(vrtype vr)
const vrtype VR_UK
Definition: dicom.h:78
DLLEXPORT std::string zipfile_get_list(const char *filename)
Definition: dicom.h:103
void set_value(int *values, int nvalues)
Definition: dicom.h:657
Definition: dicom.h:105
Definition: dicom.h:267
const opttype OPT_SAVE_IMPLICIT_DATASET_LENGTH
Definition: dicom.h:180
Definition: dicom.h:306
commandtype
Definition: dicom.h:209
uidtype tsuid
Definition: dicom.h:440
void set_value(std::string &s)
Definition: dicom.h:706
Definition: dicom.h:219
Definition: dicom.h:363
const vrtype VR_UL
Definition: dicom.h:71
char * operator=(char *v)
Definition: dicom.h:709
const vrtype VR_US
Definition: dicom.h:73
Definition: dicom.h:215
std::map< tagtype, dataelement * > element_dict_type
Definition: dicom.h:435
void set_value(double value)
Definition: dicom.h:671
const opttype OPT_LOAD_PARTIAL_FILE
Definition: dicom.h:131
~dataelement()
Definition: dicom.h:729
DLLEXPORT int use_decoder(uidtype tsuid, const char *codec_name)
dataset * dataset_at(int idx)
Definition: dicom.h:756
Definition: dicom.h:271
DLLEXPORT void set_debug_logger(logfunc)
uint32 optarg
Definition: dicom.h:112
dicomfile_sorter(const char **study_keys, const char **study_desc_keys, const char **ser_keys, const char **ser_desc_keys, const char **inst_keys)
const vrtype VR_DA
Definition: dicom.h:52
const vrtype VR_OF
Definition: dicom.h:61
void * stream
Definition: dicom.h:563
DLLEXPORT int is_valid_uid(char *u)
Definition: dicom.h:268
Definition: dicom.h:99
Definition: dicom.h:106
Definition: dicom.h:231
Definition: dicom.h:376
Definition: dicom.h:341
Definition: dicom.h:287
DLLEXPORT void add_tags_for_dicomdir(char **drtype_taglist)
bool own_dataset
Definition: dicom.h:800
Definition: dicom.h:225
Definition: dicom.h:368
const opttype OPT_SAVE_WITHOUT_METAINFO
Definition: dicom.h:178
int own_memory
Definition: dicom.h:603
Definition: dicom.h:100
Definition: dicom.h:910
DLLEXPORT void set_display_warning_message(int b)
void(* logfunc)(char *msg)
Definition: dicom.h:863
Definition: dicom.h:210
const vrtype VR_OB
Definition: dicom.h:60
void set_dirrec_type(const char *s)
Definition: dicom.h:230
Definition: dicom.h:273
size_t number_of_series_in_curr_study()
Definition: dicom.h:789
Definition: dicom.h:750
Definition: dicom.h:380
DLLEXPORT dicomfile * open_dicomfile_from_memory(char *data, int datasize, opttype opt=default_load_opt, optarg arg=0)
const vrtype VR_SL
Definition: dicom.h:65
Definition: dicom.h:226
char dirrec_type[20]
Definition: dicom.h:791
Definition: dicom.h:213
uidtype
Definition: dicom.h:251
uint8 * get_ptr()
Definition: dicom.h:605
DLLEXPORT void close_dicomdir(dicomdir *df)
const vrtype VR_UI
Definition: dicom.h:70
Definition: dicom.h:212
const vrtype VR_AT
Definition: dicom.h:50
~dataset()
Definition: dicom.h:478
Definition: dicom.h:289
DLLEXPORT dicomfile * open_dicomfile(const char *filename, opttype opt=default_load_opt, optarg arg=0)
const opttype OPT_SAVE_BASIC_OFFSET_TABLE
Definition: dicom.h:182
void set_value(double *values, int nvalues)
Definition: dicom.h:673
Definition: dicom.h:562
const vrtype VR_OW
Definition: dicom.h:62
Definition: dicom.h:252
Definition: dicom.h:221
DLLEXPORT tagtype find_tag(const char *keyword)
const char * get_next_series()
Definition: dicom.h:257
const vrtype VR_FD
Definition: dicom.h:55
void from_string(std::string &s)
Definition: dicom.h:701
Definition: dicom.h:370
DLLEXPORT void set_uid_prefix(char *u=NULL)
const vrtype VR_FL
Definition: dicom.h:56
dicomfile * df
Definition: dicom.h:810
Definition: dicom.h:104
Definition: dicom.h:227
Definition: dicom.h:94
dataset * ds
Definition: dicom.h:739
Definition: dicom.h:229
DLLEXPORT char * get_error_message()
const vrtype VR_LT
Definition: dicom.h:59
dicomfile()
Definition: dicom.h:583
Definition: dicom.h:424
DLLEXPORT vrtype get_tag_vr(tagtype tag)
Definition: dicom.h:228
Definition: dicom.h:211
Definition: dicom.h:224
DLLEXPORT dicomdir * open_dicomdir_from_memory(char *data, int datasize, opttype opt=default_load_opt)
element_dict_type::iterator it
Definition: dicom.h:740
Definition: dicom.h:274
Definition: dicom.h:95
Definition: dicom.h:98
const opttype OPT_DEFAULT
Definition: dicom.h:114
int endian
Definition: dicom.h:602
const vrtype VR_SQ
Definition: dicom.h:66
Definition: dicom.h:218
Definition: dicom.h:97
Definition: dicom.h:220
Definition: dicom.h:216
uint32 tagtype
Definition: dicom.h:39
std::vector< dataset * > seq
Definition: dicom.h:751
const vrtype VR_SH
Definition: dicom.h:64
const vrtype VR_NULL
Definition: dicom.h:47
Definition: dicom.h:809
int number_of_elements()
Definition: dicom.h:513
std::vector< int > & operator=(std::vector< int > &v)
Definition: dicom.h:663
int copy_pixeldata_to(void *buf, int rowstep, int framestep, int idx=-1)
Definition: dicom.h:496
void set_value(int value)
Definition: dicom.h:655
const opttype OPT_SAVE_CALC_GROUPLENGTH
Definition: dicom.h:181
dirrec_t * root_dirrec
Definition: dicom.h:811
const vrtype VR_AE
Definition: dicom.h:48
Definition: dicom.h:217
const vrtype VR_UT
Definition: dicom.h:74
Definition: dicom.h:377
Definition: dicom.h:96
DLLEXPORT void close_dicomfile(dicomfile *df)
tagtype tag
Definition: dicom.h:598
DLLEXPORT void reset_tags_for_dicomdir()
uint32 len
Definition: dicom.h:600
Definition: dicom.h:597
const vrtype VR_AS
Definition: dicom.h:49
const vrtype VR_ST
Definition: dicom.h:68
DLLEXPORT dicomdir * open_dicomdir(const char *filename, opttype opt=default_load_opt)
uint16 vrtype
Definition: dicom.h:40
Definition: dicom.h:93
const vrtype VR_IS
Definition: dicom.h:57
Definition: dicom.h:337
const vrtype VR_SS
Definition: dicom.h:67
std::map< uint32, dataset * > dataset_pos_list
Definition: dicom.h:578
DLLEXPORT dataset * pick_dataelements(dicomfile *df, const char **keys)
Definition: dicom.h:304
Definition: dicom.h:736
Definition: dicom.h:291
Definition: dicom.h:275
const char * get_next_study()
DLLEXPORT dataelement * nullelement()
const vrtype VR_OFFSET
Definition: dicom.h:87
Definition: dicom.h:301
const opttype OPT_LOAD_CONTINUE_ON_ERROR
Definition: dicom.h:149
const vrtype VR_DS
Definition: dicom.h:53
errtype
Definition: dicom.h:89
const opttype OPT_SAVE_IMPLICIT_SQ_LENGTH
Definition: dicom.h:179
DLLEXPORT void set_display_debug_message(int b)
const opttype OPT_LOAD_DONOT_COPY_DATA
Definition: dicom.h:175
element_dict_type edict
Definition: dicom.h:439
~sequence()
Definition: dicom.h:770
DLLEXPORT const char * uidvalue_to_uidname(const char *uidvalue)
DLLEXPORT void set_error_logger(logfunc)
Definition: dicom.h:362
const opttype OPT_SAVE_WITHOUT_PREAMBLE
Definition: dicom.h:177
DLLEXPORT std::string gen_uid(char *base_uid=NULL)
Definition: dicom.h:365
Definition: dicom.h:222
int size()
Definition: dicom.h:754
DLLEXPORT void set_warning_logger(logfunc)
const vrtype VR_TM
Definition: dicom.h:69
Definition: dicom.h:256
const vrtype VR_PN
Definition: dicom.h:63
double operator=(double v)
Definition: dicom.h:677
Definition: dicom.h:91
DLLEXPORT const char * uid_to_uidname(uidtype uid)
size_t number_of_images_in_curr_series()
DLLEXPORT int use_encoder(uidtype tsuid, const char *codec_name)