changeset 2006:36c07a64bf4a

Implement _acr_name_proc to allow printing of field names in dump_acr_nema
author bert <bert>
date Fri, 11 Mar 2005 22:05:29 +0000
parents 854aa575cc3c
children e70371144190
files conversion/Acr_nema/acr_nema/group.h conversion/Acr_nema/element.c conversion/Acr_nema/group.c
diffstat 3 files changed, 31 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/conversion/Acr_nema/acr_nema/group.h
+++ b/conversion/Acr_nema/acr_nema/group.h
@@ -6,7 +6,10 @@
 @CREATED    : November 10, 1993 (Peter Neelin)
 @MODIFIED   : 
  * $Log: group.h,v $
- * Revision 6.4  2005-03-04 00:08:08  bert
+ * Revision 6.5  2005-03-11 22:05:29  bert
+ * Implement _acr_name_proc to allow printing of field names in dump_acr_nema
+ *
+ * Revision 6.4  2005/03/04 00:08:08  bert
  * Cleanup headers, mostly by getting rid of the infernal 'public' and using extern instead
  *
  * Revision 6.3  2001/11/08 14:17:06  neelin
@@ -145,4 +148,8 @@
                                       Acr_Element itemlist);
 extern Acr_Status acr_test_dicom_file(Acr_File *afp);
 
+typedef char *(*acr_name_proc_t)(unsigned int grp_id, unsigned int el_id);
+
+extern acr_name_proc_t _acr_name_proc;
+
 #endif /* _ACR_GROUP_H_ */
--- a/conversion/Acr_nema/element.c
+++ b/conversion/Acr_nema/element.c
@@ -6,7 +6,10 @@
 @CREATED    : November 10, 1993 (Peter Neelin)
 @MODIFIED   : 
  * $Log: element.c,v $
- * Revision 6.5  2005-03-04 00:25:54  bert
+ * Revision 6.6  2005-03-11 22:05:29  bert
+ * Implement _acr_name_proc to allow printing of field names in dump_acr_nema
+ *
+ * Revision 6.5  2005/03/04 00:25:54  bert
  * Avoid memory leak by freeing unused elements in a sequence.  Fix order of initialization in acr_create_element() to set variable length property correctly. Don't change VR encoding when parsing a sequence, rely on the new handling of 0xfffe group items by the acr_io functions
  *
  * Revision 6.4  2004/10/29 13:08:41  rotor
@@ -1565,11 +1568,23 @@
 
       /* Print the element id */
       (void) fprintf(file_pointer, 
-                     "0x%04x  0x%04x  length = %d :",
+                     "0x%04x  0x%04x  length = %d ",
                      acr_get_element_group(cur_element),
                      acr_get_element_element(cur_element),
                      (int) acr_get_element_length(cur_element));
 
+      if (_acr_name_proc != NULL) {
+          char *name_ptr;
+
+          name_ptr = (*_acr_name_proc)(acr_get_element_group(cur_element),
+                                       acr_get_element_element(cur_element));
+
+          if (name_ptr != NULL) {
+              fprintf(file_pointer, "(%s)", name_ptr);
+          }
+      }
+      fprintf(file_pointer, ":");
+
       /* Print value if needed */
       vr_code = acr_get_element_vr(cur_element);
       if (acr_element_is_sequence(cur_element)) {
--- a/conversion/Acr_nema/group.c
+++ b/conversion/Acr_nema/group.c
@@ -6,7 +6,10 @@
 @CREATED    : November 10, 1993 (Peter Neelin)
 @MODIFIED   : 
  * $Log: group.c,v $
- * Revision 6.8  2005-03-04 17:09:11  bert
+ * Revision 6.9  2005-03-11 22:05:29  bert
+ * Implement _acr_name_proc to allow printing of field names in dump_acr_nema
+ *
+ * Revision 6.8  2005/03/04 17:09:11  bert
  * Change several functions to return Acr_Status instead of void; lose public and private; Make insert_element() check the return value of acr_get_element_total_length()
  *
  * Revision 6.7  2004/10/29 13:08:42  rotor
@@ -136,6 +139,8 @@
 static Acr_Status acr_input_group_with_max(Acr_File *afp, Acr_Group *group, 
                                            int max_group_id);
 
+acr_name_proc_t _acr_name_proc = NULL;
+
 
 /* ----------------------------- MNI Header -----------------------------------
 @NAME       : acr_create_group