154. 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.

154.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomServiceProvider\main\src\java\gov\va\med\imaging\dicom\parser\io Part10DataSetLoader.java Mon Dec 4 21:35:22 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomServiceProvider\main\src\java\gov\va\med\imaging\dicom\parser\io Part10DataSetLoader.java Mon Dec 4 21:59:36 2017 UTC

154.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 586
Changed 2 4
Inserted 0 0
Removed 0 0

154.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

154.4 Active regular expressions

No regular expressions were active.

154.5 Comparison detail

  1   /**
  2    * Package : MAG - Vi stA Imagin g
  3    * WARNING : Per VHA  Directive  2004-038,  this routi ne should  not be mod ified.
  4    * Date Cr eated: Jul  23, 2008
  5    * Site Na me:  Washi ngton OI F ield Offic e, Silver  Spring, MD
  6    * @author         
BECKEC
  7    * @versio n 1.0
  8    *
  9    * ------- ---------- ---------- ---------- ---------- ---------- -------
  10    * Propert y of the U S Governme nt.
  11    * No perm ission to  copy or re distribute  this soft ware is gi ven.
  12    * Use of  unreleased  versions  of this so ftware req uires the  user
  13    * to exec ute a writ ten test a greement w ith the Vi stA Imagin g
  14    * Develop ment Offic e of the D epartment  of Veteran s Affairs,
  15    * telepho ne (301) 7 34-0100.
  16    * 
  17    * The Foo d and Drug  Administr ation clas sifies thi s software  as
  18    * a Class  II medica l device.   As such,  it may not  be change d
  19    * in any  way.  Modi fications  to this so ftware may  result in  an
  20    * adulter ated medic al device  under 21CF R820, the  use of whi ch
  21    * is cons idered to  be a viola tion of US  Federal S tatutes.
  22    * ------- ---------- ---------- ---------- ---------- ---------- -------
  23    */
  24   package go v.va.med.i maging.dic om.parser. io;
  25  
  26   import gov .va.med.im aging.dico m.dataset. DataSet;
  27   import gov .va.med.im aging.dico m.dataset. TransferSy ntaxUid;
  28   import gov .va.med.im aging.dico m.dataset. elements.D ataElement ;
  29   import gov .va.med.im aging.dico m.exceptio ns.DicomFo rmatExcept ion;
  30   import gov .va.med.im aging.dico m.exceptio ns.Incompa tibleValue LengthFiel d;
  31   import gov .va.med.im aging.dico m.exceptio ns.Invalid VRExceptio n;
  32   import gov .va.med.im aging.dico m.exceptio ns.Invalid VRModeExce ption;
  33   import gov .va.med.im aging.dico m.exceptio ns.Missing DicmPreamb leExceptio n;
  34   import gov .va.med.im aging.dico m.exceptio ns.Missing DicmPrefix Exception;
  35   import gov .va.med.im aging.dico m.exceptio ns.Missing TransferSy ntaxExcept ion;
  36   import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onInterpre tationExce ption;
  37   import gov .va.med.im aging.dico m.parser.i mpl.DataEl ementFacto ry;
  38   import gov .va.med.im aging.dico m.parser.i mpl.DataEl ementFacto ryImpl;
  39   import gov .va.med.im aging.dico m.parser.i mpl.Transf erSyntaxUi dUtility;
  40  
  41   import jav a.io.Buffe redInputSt ream;
  42   import jav a.io.DataI nputStream ;
  43   import jav a.io.EOFEx ception;
  44   import jav a.io.File;
  45   import jav a.io.FileI nputStream ;
  46   import jav a.io.FileN otFoundExc eption;
  47   import jav a.io.IOExc eption;
  48   import jav a.io.Input Stream;
  49   import jav a.net.URL;
  50   import jav a.net.URLC onnection;
  51   import org .apache.lo gging.log4 j.LogManag er;
  52   import org .apache.lo gging.log4 j.Logger;
  53  
  54   /**
  55    * @author         
BECKEC
  56    *
  57    */
  58   public cla ss Part10D ataSetLoad er
  59   {
  60           pr ivate stat ic Logger  logger = L ogManager. getLogger( Part10Data SetLoader. class.getN ame());
  61           
  62           /* *
  63            *  
  64            *  @param di comFile
  65            *  @return
  66            *  @throws I nvalidVREx ception 
  67            *  @throws I nvalidVRMo deExceptio
  68            *  @throws D icomFormat Exception 
  69            *  @throws U nsupported OperationE xception 
  70            *  @throws V alueRepres entationIn terpretati onExceptio
  71            *  @throws I ncompatibl eValueLeng thField 
  72            * /
  73           pu blic stati c Part10Da taSetLoade r load(Fil e dicomFil e) 
  74           th rows Unsup portedOper ationExcep tion, Dico mFormatExc eption, 
  75           In validVRMod eException , InvalidV RException , ValueRep resentatio nInterpret ationExcep tion, Inco mpatibleVa lueLengthF ield
  76           {
  77                    Data InputStrea m din = nu ll;
  78                    try
  79           {
  80                             System .out.print ln("Openin g DICOM fi le '" + di comFile.to String() +  "'.");
  81                    din  = new Data InputStrea m(  new Bu fferedInpu tStream( n ew FileInp utStream(d icomFile)  ) );
  82                             System .out.print ln("DICOM  file '" +  dicomFile. toString()  + "' open ed.");
  83                    
  84                             Part10 DataSetLoa der loader  = load(di n);
  85                    
  86                    retu rn loader;
  87           } 
  88                    catc h (FileNot FoundExcep tion e)
  89           {
  90                    e.pr intStackTr ace();
  91           } 
  92                    catc h (IOExcep tion e)
  93           {
  94                    e.pr intStackTr ace();
  95           }
  96                    fina lly
  97                    {
  98                             try{di n.close(); }catch(Thr owable t){ }
  99                    }
  100                    
  101                    retu rn null;
  102           }
  103           
  104           /* *
  105            *  
  106            *  @param im ageUrl
  107            *  @return
  108            * /
  109           pu blic stati c Part10Da taSetLoade r load(URL  imageUrl)
  110           {
  111                    Data InputStrea m din = nu ll;
  112                    try
  113                    {
  114                             URLCon nection co nnection =  imageUrl. openConnec tion();
  115                             System .out.print ln("Connec ting to UR L '" + ima geUrl.toSt ring() + " '.");
  116                             connec tion.conne ct();
  117                             System .out.print ln("Connec ted to URL  '" + imag eUrl.toStr ing() + "' , reading  from input  stream.") ;
  118  
  119                             // Inp utStream
  120                             // Buf feredInput Stream
  121                             // Inp utStream i nS = urlCo nn.openStr eam();
  122                             din =  new DataIn putStream(  new Buffe redInputSt ream(conne ction.getI nputStream ()) );
  123                             
  124                             // }el se{
  125                             // Sys tem.out.pr intln("fil e");
  126                             // Fin S = new Fi leInputStr eam(imgURL );
  127                             // inS  = new Buf feredInput Stream(Fin S);
  128                             // din  = new Dat aInputStre am(inS);
  129                             // Sys tem.out.pr intln("fil e");
  130                             // }
  131  
  132                             return  load(din) ;
  133                    } 
  134                    catc h (EOFExce ption eof)
  135                    {
  136                             System .out.print ln("DicomF ile.EOFExc eption: "  + eof.getM essage());
  137                    } 
  138                    catc h (IOExcep tion ioe)
  139                    {
  140                             System .out.print ln("DicomF ile.IOExce ption: " +  ioe.getMe ssage());
  141                    } 
  142                    catc h (Excepti on e)
  143                    {
  144                             System .out.print ln("DicomF ile.Except ion: " + e .getMessag e());
  145                    }
  146                    fina lly
  147                    {
  148                             try{di n.close(); }catch(Thr owable x){ }
  149                    }
  150  
  151                    retu rn null;
  152           }
  153           
  154           /* *
  155            *  
  156            *  @param in putStream
  157            *  @return
  158            *  @throws I OException
  159            *  @throws D icomFormat Exception
  160            *  @throws U nsupported OperationE xception
  161            *  @throws I nvalidVRMo deExceptio n
  162            *  @throws I nvalidVREx ception
  163            *  @throws V alueRepres entationIn terpretati onExceptio n
  164            *  @throws I ncompatibl eValueLeng thField
  165            * /
  166       public  static Pa rt10DataSe tLoader lo ad(InputSt ream input Stream) 
  167       throws  IOExcepti on, 
  168                DicomFor matExcepti on, 
  169                Unsuppor tedOperati onExceptio n, 
  170                InvalidV RModeExcep tion, Inva lidVRExcep tion, Valu eRepresent ationInter pretationE xception,  Incompatib leValueLen gthField
  171       {
  172           if (inputStre am instanc eof DataEl ementLimit edInputStr eam)
  173                    retu rn load((D ataElement LimitedInp utStream)i nputStream );
  174           
  175           re turn load( new DataEl ementLimit edInputStr eam( new D ataInputSt ream(input Stream), T ransferSyn taxUid.RAW _EXPLICIT_ VR_LITTLEE NDIAN));
  176       }
  177       
  178           /* *
  179        * @pa ram dicomI nputStream
  180        * @th rows IOExc eption
  181            *  @throws D icomFormat Exception 
  182            *  @throws I nvalidVREx ception 
  183            *  @throws I nvalidVRMo deExceptio
  184            *  @throws U nsupported OperationE xception 
  185            *  @throws V alueRepres entationIn terpretati onExceptio
  186            *  @throws I ncompatibl eValueLeng thField 
  187        */
  188       public  static Pa rt10DataSe tLoader lo ad(DataEle mentLimite dInputStre am dicomIn putStream)  
  189       throws  IOExcepti on, 
  190       DicomF ormatExcep tion, 
  191       Unsupp ortedOpera tionExcept ion, 
  192       Invali dVRModeExc eption, In validVRExc eption, Va lueReprese ntationInt erpretatio nException , Incompat ibleValueL engthField
  193       {
  194           
  195           Pa rt10DataSe tLoader lo ader = new  Part10Dat aSetLoader (dicomInpu tStream);
  196           re turn loade r;
  197       }
  198  
  199       /**
  200        * Exc ept for th e 128 byte  preamble  and the 4  byte prefi x, the Fil e Meta Inf ormation 
  201        * sha ll be enco ded using  the Explic it VR Litt le Endian  Transfer S yntax (UID =1.2.840.1 0008.1.2.1
  202        * as  defined in  DICOM PS  3.5. 
  203        * Val ues of eac h File Met a Element  shall be p added when  necessary  to achiev e an even  length as 
  204        * spe cified in  PS 3.5 by  their corr esponding  Value Repr esentation . For comp atibility  with futur e versions  
  205        * of  this Stand ard, any T ag (0002,x xxx) not d efined in  Table 7.1- 1 shall be  ignored.
  206        * @pa ram dicomI nputStream  
  207        * @pa ram dataSe
  208        * @th rows IOExc eption 
  209        */
  210       protec ted static  void read PreambleAn dPrefix(Da taElementL imitedInpu tStream di comInputSt ream) 
  211           th rows IOExc eption, Di comFormatE xception
  212       {
  213                    byte [] preambl e = new by te[128];
  214                    try{ dicomInput Stream.rea dFully(pre amble);}                // read  this into  a buffer,  we may add  some anal ysis later
  215                    catc h(IOExcept ion ioX){t hrow new M issingDicm PreambleEx ception(); }
  216                    
  217                    byte [] dicmPre fix = new  byte[4];
  218                    try{ dicomInput Stream.rea dFully(dic mPrefix);}
  219                    catc h(IOExcept ion ioX){t hrow new M issingDicm PrefixExce ption();}
  220       }
  221  
  222       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ====
  223       //
  224       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ====
  225       
  226       privat e final Pa rt10DataSe tReader pa rt10Reader ;
  227       privat e final Da taSet head erDataSet;
  228       privat e final Da taElement< ?> transfe rSyntaxEle ment;
  229       privat e final Tr ansferSynt axUid tran sferSyntax ;
  230       privat e final Da taElementF actory dat aElementFa ctory;
  231       privat e final Da taSetReade r dataSetR eader;
  232       privat e final Da taSet data Set;
  233  
  234       privat e Part10Da taSetLoade r(DataElem entLimited InputStrea m dicomInp utStream)
  235       throws  IOExcepti on, DicomF ormatExcep tion, Unsu pportedOpe rationExce ption, 
  236           In validVRMod eException , InvalidV RException , ValueRep resentatio nInterpret ationExcep tion, Inco mpatibleVa lueLengthF ield
  237       {
  238           //  read the  header (th e 128 byte s and the  'DICM')
  239           re adPreamble AndPrefix( dicomInput Stream);
  240           
  241           th is.part10R eader = ne w Part10Da taSetReade r(dicomInp utStream);
  242           th is.headerD ataSet = p art10Reade r.readPart 10DataSet( );
  243           th is.transfe rSyntaxEle ment = hea derDataSet .getTransf erSyntaxUI D();
  244           
  245           if (this.tran sferSyntax Element ==  null)
  246                throw ne w MissingT ransferSyn taxExcepti on( "The P art 10 hea der had no  transfer  syntax spe cified.");
  247           
  248           lo gger.info( "Header da ta set rea d, reading  data set  using '" +  new Strin g(transfer SyntaxElem ent.getRaw Value()) +  "' transf er syntax. ");
  249           th is.transfe rSyntax =  this.trans ferSyntaxE lement ==  null ? 
  250                    null  : 
  251                    Tran sferSyntax UidUtility .getByUid(  (String)t ransferSyn taxElement .getValue( ) );
  252           
  253           th is.dataEle mentFactor y = DataEl ementFacto ryImpl.get DataElemen tFactory(t ransferSyn tax);
  254           th is.dataSet Reader = n ew DataSet Reader(dic omInputStr eam, dataE lementFact ory);
  255  
  256           th is.dataSet  = this.da taSetReade r.readData Set();
  257           if (this.data Set.getTra nsferSynta xUID() ==  null)
  258                this.dat aSet.add(t his.transf erSyntaxEl ement);
  259       }
  260  
  261       public  Part10Dat aSetReader  getPart10 Reader()
  262       {
  263           re turn part1 0Reader;
  264       }
  265  
  266       public  DataSet g etHeaderDa taSet()
  267       {
  268           re turn heade rDataSet;
  269       }
  270  
  271       public  DataEleme nt<?> getT ransferSyn taxElement ()
  272       {
  273           re turn trans ferSyntaxE lement;
  274       }
  275  
  276       public  TransferS yntaxUid g etTransfer Syntax()
  277       {
  278           re turn trans ferSyntax;
  279       }
  280  
  281       public  DataEleme ntFactory  getDataEle mentFactor y()
  282       {
  283           re turn dataE lementFact ory;
  284       }
  285  
  286       public  DataSetRe ader getDa taSetReade r()
  287       {
  288           re turn dataS etReader;
  289       }
  290  
  291       public  DataSet g etDataSet( )
  292       {
  293           re turn dataS et;
  294       }
  295   }