144. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:39 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

144.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomDataSet\main\src\java\gov\va\med\imaging\dicom\dataset\elements DataElement.java Mon Dec 4 21:35:26 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomDataSet\main\src\java\gov\va\med\imaging\dicom\dataset\elements DataElement.java Mon Dec 4 21:59:26 2017 UTC

144.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 748
Changed 1 2
Inserted 0 0
Removed 0 0

144.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

144.4 Active regular expressions

No regular expressions were active.

144.5 Comparison detail

  1   package go v.va.med.i maging.dic om.dataset .elements;
  2  
  3   import gov .va.med.im aging.dico m.dataset. ValueRepre sentation;
  4   import gov .va.med.im aging.dico m.dictiona ry.DicomDi ctionaryEn try;
  5   import gov .va.med.im aging.dico m.exceptio ns.DicomFo rmatExcept ion;
  6   import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onInterpre tationExce ption;
  7   import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onValueLen gthExceede dException ;
  8   import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onValueLen gthInsuffi cientExcep tion;
  9  
  10   import jav a.io.Seria lizable;
  11   import org .apache.lo gging.log4 j.LogManag er;
  12   import org .apache.lo gging.log4 j.Logger;
  13  
  14   import com .google.gw t.user.cli ent.rpc.Is Serializab le;
  15  
  16   /**
  17    * From th e DICOM Sp ecificatio n, Part 5:
  18    * 
  19    * A Data  Element is  made up o f fields.  Three fiel ds are com mon to all  three Dat a Element  structures
  20    * these a re the Dat a Element  Tag, Value  Length, a nd Value F ield. 
  21    * A fourt h field, V alue Repre sentation,  is only p resent in  the two Ex plicit VR  Data Eleme nt structu res. 
  22    * The Dat a Element  structures  are defin ed in Sect ions 7.1.2 . and 7.1. 3. The def initions o f the fiel ds are:
  23    * 
  24    * Data El ement Tag:  An ordere d pair of  16-bit uns igned inte gers repre senting th e Group Nu mber follo wed by Ele ment Numbe r.
  25    * 
  26    * Value R epresentat ion: A two -byte char acter stri ng contain ing the VR  of the Da ta Element
  27    * The VR  for a give n Data Ele ment Tag s hall be as  defined b y the Data  Dictionar y as speci fied in PS  3.6. 
  28    * The two  character  VR shall  be encoded  using cha racters fr om the DIC OM default  character  set.
  29    * 
  30    * Value L ength: 
  31    * Either:
  32    * - a 16  or 32-bit  (dependent  on VR and  whether V R is expli cit or imp licit) uns igned inte ger 
  33    * contain ing the Ex plicit Len gth of the  Value Fie ld as the  number of  bytes (eve n) that ma ke up the  Value. 
  34    * It does  not inclu de the len gth of the  Data Elem ent Tag, V alue Repre sentation,  and Value  Length Fi elds.
  35    * - a 32- bit Length  Field set  to Undefi ned Length  (FFFFFFFF H). Undefi ned Length s may be u sed for Da ta Element
  36    * having  the Value  Representa tion (VR)  Sequence o f Items (S Q) and Unk nown (UN).  
  37    * For Dat a Elements  with Valu e Represen tation OW  or OB Unde fined Leng th may be  used depen ding on th e negotiat ed 
  38    * Transfe r Syntax ( see Sectio n 10 and A nnex A).
  39    * 
  40    * A unit  of informa tion as de fined by a  single en try in the  data dict ionary. 
  41    * An enco ded Inform ation Obje ct Definit ion (IOD)  Attribute  that is co mposed of,  at a mini mum, 
  42    * three f ields: a D ata Elemen t Tag, a V alue Lengt h, and a V alue Field . For some  specific 
  43    * Transfe r Syntaxes , a Data E lement als o contains  a VR Fiel d where th e Value Re presentati on of 
  44    * that Da ta Element  is specif ied explic itly.
  45    * 
  46    * REPEATI NG GROUP:  Standard D ata Elemen ts within  a particul ar range o f Group Nu mbers wher e elements  
  47    * that ha ve identic al Element  Numbers h ave the sa me meaning  within ea ch Group ( and the sa me VR, VM,  
  48    * and Dat a Element  Type). Rep eating Gro ups shall  only exist  for Curve s and Over lay Planes  (Group Nu mbers 
  49    * (50xx,e eee) and ( 60xx,eeee) , respecti vely) and  are a remn ant of ver sions of t his standa rd prior t o V3.0.
  50    * 
  51    * RETIRED  DATA ELEM ENT: A Dat a Element  that is un supported  beginning  with Versi on 3.0 of  this stand ard. 
  52    * Impleme ntations m ay continu e to suppo rt Retired  Data Elem ents for t he purpose  of backwa rd compati bility 
  53    * with ve rsions pri or to V3.0 , but this  is not a  requiremen t of this  version of  the stand ard.
  54    * 
  55    * A Data  Element sh all have o ne of thre e structur es. 
  56    * Two of  these stru ctures con tain the V R of the D ata Elemen t (Explici t VR) but  differ in  the way th eir 
  57    * lengths  are expre ssed, whil e the othe r structur e does not  contain t he VR (Imp licit VR).  
  58    * All thr ee structu res contai n the Data  Element T ag, Value  Length and  Value for  the Data  Element. S ee Figure  7.1-1.
  59    * Implici t and Expl icit VR Da ta Element s shall no t coexist  in a Data  Set and Da ta Sets ne sted withi n it 
  60    * (see Se ction 7.5) . Whether  a Data Set  uses Expl icit or Im plicit VR,  among oth er charact eristics, 
  61    * is dete rmined by  the negoti ated Trans fer Syntax  (see Sect ion 10 and  Annex A).
  62    * Note: V Rs are not  contained  in Data E lements wh en using D ICOM Defau lt Transfe r Syntax ( DICOM Impl icit VR 
  63    * Little  Endian Tra nsfer Synt ax).
  64    * 
  65    * This im plementati on include s a refere nce to a D ataDiction aryEntry,  which cont ains the i mplicit VR .
  66    * 
  67    * The met hods equal s(), hashC ode() and  compareTo( ) are all  consistent
  68    * The met hods equal s(), hashC ode() and  compareTo( ) are all  sensitive  only to th e dataElem entTag mem ber.
  69    * 
  70    * 
  71    * @author         
BECKEC
  72    *
  73    */
  74   public abs tract clas s DataElem ent<T>
  75   implements  Comparabl e<DataElem ent<T>>, S erializabl e, IsSeria lizable
  76   {
  77       privat e static f inal long  serialVers ionUID = 1 L;
  78       
  79           pr ivate Data ElementTag  dataEleme ntTag;                    // the  actual gr oup and el ement numb ers
  80           pr ivate Dico mDictionar yEntry dic tionaryEnt ry;            // nul l for expl icit VR, n ot-null fo r implicit  VR
  81           pr ivate Valu eRepresent ation[] ex plicitVRFi eld;  // n ot null fo r explicit  VR, null  for implic it VR
  82           pr ivate long  valueLeng th;                                                            //  will alwa ys be pres ent, 16 or  32 bit un signed, mu st be stor ed as long
  83           pr ivate byte [] rawValu e;                                                             //
  84           pu blic final  static lo ng INDETER MINATE_LEN GTH = -1L;
  85           
  86           pr ivate fina l transien t Logger l ogger = Lo gManager.g etLogger(t his.getCla ss().getNa me());
  87           
  88           /* *
  89            *  Required  for GWT's  use
  90            * /
  91           pu blic DataE lement(){}
  92           
  93           /* *
  94            *  The const ructor of  DataElemen t instance s using ex plicit VR.   
  95            *  This shou ld be call ed only fr om a DataE lementFact ory.
  96            *  
  97            *  @param da taElementT ag
  98            *  @param ex plicitVRFi eld
  99            *  @param va lueLength
  100            *  @param va lue
  101            * /
  102           pr otected Da taElement(
  103                             DataEl ementTag d ataElement Tag, 
  104                             ValueR epresentat ion explic itVRField,  
  105                             long v alueLength
  106                             byte[]  value)
  107           th rows Dicom FormatExce ption
  108           {
  109                    if(e xplicitVRF ield == nu ll)
  110                             throw  new Illega lArgumentE xception(" Explicit V R Field mu st be spec ified when  encoding  specifies  that expli cit VR is  being used .");
  111                    
  112                    this .dataEleme ntTag = da taElementT ag;
  113                    this .dictionar yEntry = n ull;
  114                    this .explicitV RField = n ew ValueRe presentati on[]{expli citVRField };
  115                    this .valueLeng th = value Length;
  116                    setR awValue(va lue);
  117                    
  118                    try{ validateLe ngthValues ();}
  119                    catc h(DicomFor matExcepti on dfX){lo gger.warn( "DICOM com pliance ex ception-"  + dfX.getM essage() +  "'.");}
  120                    
  121                    //pa rseRawValu e();
  122           }
  123           
  124           /* *
  125            *  The const ructor of  DataElemen t instance s using im plicit VR.   
  126            *  This shou ld be call ed only fr om a DataE lementFact ory.
  127            *  
  128            *  @param da taElementT ag
  129            *  @param di ctionaryEn try
  130            *  @param va lueLength
  131            *  @param va lue
  132            *  @param da taElementF actory 
  133            * /
  134           pr otected Da taElement(
  135                    Data ElementTag  dataEleme ntTag, 
  136                    Dico mDictionar yEntry dic tionaryEnt ry, 
  137                    long  valueLeng th, 
  138                    byte [] value)
  139           th rows Dicom FormatExce ption
  140       {
  141                    if(d ictionaryE ntry == nu ll)
  142                             throw  new Illega lArgumentE xception(" Dictionary  Entry fie ld must be  specified  when enco ding speci fies that  implicit V R is being  used.");
  143                    
  144                this.dat aElementTa g = dataEl ementTag;
  145                this.dic tionaryEnt ry = dicti onaryEntry ;
  146                this.val ueLength =  valueLeng th;
  147                setRawVa lue(value) ;
  148                    this .explicitV RField = n ull;
  149  
  150                    try{ validateLe ngthValues ();}
  151                    catc h(DicomFor matExcepti on dfX){lo gger.warn( "DICOM com pliance ex ception-"  + dfX.getM essage() +  "'.");}
  152                    
  153                    //pa rseRawValu e();
  154       }
  155  
  156           /* *
  157            *  Do basic  validation  of the le ngth field  and the l ength of t he value a gainst the
  158            *  specified  values.
  159            *   
  160            *  @throws V alueRepres entationIn terpretati onExceptio n
  161            * /
  162           pr otected vo id validat eLengthVal ues() 
  163           th rows Value Representa tionInterp retationEx ception
  164           {
  165                    if(g etValueLen gth() < ge tValueRepr esentation ()[0].getM inLengthOf Value() &&
  166                                      !getValu eRepresent ation()[0] .isAllowUn definedLen gth())
  167                             throw  new ValueR epresentat ionValueLe ngthInsuff icientExce ption(
  168                                      "Element  '" + getD ataElement Tag() + "'  " + getVa lueReprese ntation()[ 0].toStrin g() + 
  169                                      " length  of " + va lueLength  + " is out side range  of [" + 
  170                                      getValue Representa tion()[0]. getMinLeng thOfValue( ) + "-" + 
  171                                      getValue Representa tion()[0]. getMaxLeng thOfValue( ) + "].");
  172                    
  173                    if(g etValueLen gth() > ge tValueRepr esentation ()[0].getM axLengthOf Value() &&
  174                                      !getValu eRepresent ation()[0] .isAllowUn definedLen gth())
  175                             throw  new ValueR epresentat ionValueLe ngthExceed edExceptio n(
  176                                      "Element  '" + getD ataElement Tag() + "'  " + getVa lueReprese ntation()[ 0].toStrin g() + 
  177                                      " length  of " + va lueLength  + " is out side range  of [" + 
  178                                      getValue Representa tion()[0]. getMinLeng thOfValue( ) + "-" + 
  179                                      getValue Representa tion()[0]. getMaxLeng thOfValue( ) + "].");
  180                    
  181                    if(g etRawValue () == null )
  182                             return ;
  183                    
  184                    if(g etRawValue ().length  < getValue Representa tion()[0]. getMinLeng thOfValue( ) &&
  185                                      !getValu eRepresent ation()[0] .isAllowUn definedLen gth())
  186                             throw  new ValueR epresentat ionValueLe ngthInsuff icientExce ption(
  187                                      "Element  '" + getD ataElement Tag() + "'  " + getVa lueReprese ntation()[ 0].toStrin g() + 
  188                                      " raw va lue length  of " + ge tRawValue( ).length +  " is outs ide range  of [" + 
  189                                      getValue Representa tion()[0]. getMinLeng thOfValue( ) + "-" + 
  190                                      getValue Representa tion()[0]. getMaxLeng thOfValue( ) + "].");
  191                    
  192                    if(g etValueLen gth() > ge tRawValue( ).length & &
  193                                      !getValu eRepresent ation()[0] .isAllowUn definedLen gth())
  194                             throw  new ValueR epresentat ionValueLe ngthExceed edExceptio n(
  195                                      "Element  '" + getD ataElement Tag() + "'  " + getVa lueReprese ntation()[ 0].toStrin g() + 
  196                                      " raw va lue length  of " + ge tRawValue( ).length +  " is outs ide range  of [" + 
  197                                      getValue Representa tion()[0]. getMinLeng thOfValue( ) + "-" + 
  198                                      getValue Representa tion()[0]. getMaxLeng thOfValue( ) + "].");
  199           }
  200           
  201           /* *
  202            *  Called fr om the con structor,
  203            *  The imple menting cl ass must t ake the ra w value as  a byte ar ray and cr eate a imp lememntati on
  204            *  specific  representa tion from  it.
  205            *  The resul ting value  must be m ade availa ble throug h the getV alue() met hod.
  206            *  
  207            * /
  208           // protected  abstract v oid parseR awValue()
  209           // throws Dic omFormatEx ception;
  210  
  211       /**
  212        * Get  the value  of this f ield accor ding to th e interpre tation of  the
  213        * ass ociated Va lueReprese ntation
  214        * @re turn
  215        * @th rows Value Representa tionInterp retationEx ception 
  216        */
  217       public  abstract  T getValue () 
  218       throws  ValueRepr esentation Interpreta tionExcept ion;
  219       
  220       /**
  221        * Hav ing a sett er allows  the RawVal ueParsers  to set the  value.
  222        * 
  223        * @pa ram value
  224        * @th rows Value Representa tionInterp retationEx ception
  225        */
  226       public  abstract  void setVa lue(T valu e) 
  227       throws  ValueRepr esentation Interpreta tionExcept ion;
  228       
  229       /**
  230        * 
  231        * @re turn
  232        */
  233           pr otected Lo gger getLo gger()
  234       {
  235           re turn logge r;
  236       }
  237  
  238           /* *
  239        * @re turn the t ag
  240        */
  241       public  DataEleme ntTag getD ataElement Tag()
  242       {
  243           re turn dataE lementTag;
  244       }
  245  
  246           /* *
  247            *  Will alwa ys return  a non-null  value.  I f using ex plicit VR  then this
  248            *  will retu rn a singl e element  array that  contains  the VR spe cified 
  249            *  when this  instance  was create d.
  250            *  If using  implicit V R then thi s will ret urn an arr ay of VR m apped to
  251            *  the entry  in the Di comDiction ary that t he element  tag value s were
  252            *  mapped to  when this  instance  was create d.
  253            *  
  254        * @re turn the V alueRepres entation a rray
  255        */
  256       public  ValueRepr esentation [] getValu eRepresent ation()
  257       {
  258           if (isExplici tVR())
  259                    retu rn this.ex plicitVRFi eld;
  260           el se
  261                    retu rn this.ge tDictionar yEntry().g etVr();
  262       }
  263       
  264       public  boolean i sExplicitV R()
  265       {
  266           re turn this. explicitVR Field != n ull;
  267       }
  268       
  269           /* *
  270            *  Will retu rn null if  isExplici tVR() is t rue.
  271            *  
  272        * @re turn the d ictionaryE ntry
  273        */
  274       public  DicomDict ionaryEntr y getDicti onaryEntry ()
  275       {
  276           re turn dicti onaryEntry ;
  277       }
  278  
  279  
  280           /* *
  281            *  Will retu rn null if  isExplici tVR() is f alse.
  282            *  
  283        * @re turn the e xplicitVRF ield
  284        */
  285       public  ValueRepr esentation [] getExpl icitVRFiel d()
  286       {
  287           re turn expli citVRField ;
  288       }
  289  
  290  
  291           /* *
  292        * @re turn the v alue
  293        */
  294       public  byte[] ge tRawValue( )
  295       {
  296           re turn rawVa lue;
  297       }
  298  
  299       /**
  300        * In  some cases  the deriv ed classes  use the r aw value a s the inte rpreted
  301        * val ue, option ally havin g manipula ted the co ntents.
  302        * @pa ram rawVal ue
  303        */
  304       protec ted void s etRawValue (byte[] ra wValue)
  305       {
  306           th is.rawValu e = rawVal ue;
  307       }
  308       
  309           /* *
  310        * @re turn the v alueLength
  311        */
  312       public  long getV alueLength ()
  313       {
  314           re turn value Length;
  315       }
  316       
  317           /* *
  318            *  The natur al orderin g of this  class is t he natural  ordering  of the Dat aElementTa g within t his class.
  319            *  
  320        * @se e java.lan g.Comparab le#compare To(java.la ng.Object)
  321        */
  322       public  int compa reTo(DataE lement<T>  that)
  323       {
  324           re turn this. dataElemen tTag.compa reTo(that. dataElemen tTag);
  325       }
  326  
  327           @O verride
  328       public  int hashC ode()
  329       {
  330                final in t prime =  31;
  331                int resu lt = 1;
  332                result =  prime * r esult + (( dataElemen tTag == nu ll) ? 0 :  dataElemen tTag.hashC ode());
  333                return r esult;
  334       }
  335  
  336           @O verride
  337       public  boolean e quals(Obje ct obj)
  338       {
  339                if (this  == obj)
  340                         return tru e;
  341                if (obj  == null)
  342                         return fal se;
  343                if (getC lass() !=  obj.getCla ss())
  344                         return fal se;
  345                final Da taElement< ?> other =  (DataElem ent<?>) ob j;
  346                if (data ElementTag  == null)
  347                {
  348                         if (other. dataElemen tTag != nu ll)
  349                                 re turn false ;
  350                } else i f (!dataEl ementTag.e quals(othe r.dataElem entTag))
  351                         return fal se;
  352                return t rue;
  353       }
  354  
  355           //  ========= ========== ========== ========== ========== ========== ========== ========== =========
  356           //  Helper Me thods to d o various,  usually b it or byte  level, ma nipulation s
  357           //  ========= ========== ========== ========== ========== ========== ========== ========== =========
  358       protec ted static  String tr ansformVal ueToString RemoveNull s(byte[] r awValue, l ong valueL ength)
  359       {
  360                    for  (int j = 0 ; j < valu eLength; j ++)
  361                             if (ra wValue[j]  == 0) rawV alue[j] =  20;
  362                    retu rn new Str ing(rawVal ue);
  363       }
  364       
  365       protec ted String  getRawVal ueCharacte rRepresent ation()
  366       {
  367           St ringBuffer  sb = new  StringBuff er();
  368           
  369           by te[] raw =  getRawVal ue();
  370           if (raw != nu ll)
  371                    for( byte c : g etRawValue ())
  372                             sb.app end("0x" +  Integer.t oHexString (c) + " ") ;
  373           re turn sb.to String();
  374       }
  375   }