0 Replies Latest reply: Jan 31, 2011 3:48 AM by tnakaguc RSS

    How do I change Transfer Syntax for DICOM images using sample Java sources?

    tnakaguc
      Hi,

      I tested using Note:876534.1 Java API samples. It works fine when I put the "Implicit VR Little Endian" DICOM file.
      I could insert the DICOM file, also I could get the all DICOM tags correctly by SQL.

      But I could not get all DICOM tags when inserted "Explicit VR Little Endian" and "JPEG Lossy" DICOM file.
      Also I could not find how to change the Transfer Syntax to orddicom Java API.
      How do I change following simple java source for inserting different Transfer Syntax DICOM file?

      --
      Connection conn = DriverManager.getConnection(args[0], args[1], args[2]);
      System.out.println("Got database connection");
      conn.setAutoCommit(false);
      Statement stmt = conn.createStatement();
      CallableStatement cs = null;

      cs = conn.prepareCall("begin ord_dicom.setDataModel(); end; ");
      cs.execute();
      cs.close();

      String rowInsertSQL = "insert into dicom_test (id, dcmobj) values (" + args[3] + ",ordsys.orddicom())";
      stmt.execute(rowInsertSQL);

      System.out.println("Inserted empty dicom object ...");

      String rowSelectSQL = "select dcmobj from dicom_test where id = " + args[3] + " for update";
      OracleResultSet rset = (OracleResultSet)stmt.executeQuery(rowSelectSQL);
      rset.next();
      OrdDicom dcmProxy = (OrdDicom)rset.getORAData("dcmobj", OrdDicom.getORADataFactory());
      rset.close();

      System.out.println("selected row for update...");
      File testFile = new File(args[4]);

      boolean success = dcmProxy.loadContent(testFile, true);
      dcmProxy.setProperties();
      if (success) {            
      String updateSQL = "update dicom_test set dcmobj=? where id=" + args[3];
      OraclePreparedStatement opstmt =
      (OraclePreparedStatement)conn.prepareStatement(updateSQL);
      opstmt.setORAData(1, dcmProxy);
      opstmt.execute();

      int contentLength = dcmProxy.getContentLength();
      String SOPInstanceUID = dcmProxy.getSOPInstanceUid();
      System.out.println("contentLength: " + contentLength);
      System.out.println("SOPInstanceUID: " + SOPInstanceUID);
      opstmt.close();
      }
      --

      Thanks,
      Tatsuya

      Edited by: user13490925 on 2011/01/31 1:48