Login  Register

Re: Problem while adding dicom header to a jpeg and save the image as DICOM

Posted by vmunukutla on Aug 27, 2009; 6:41am
URL: http://imagej.273.s1.nabble.com/Problem-while-adding-dicom-header-to-a-jpeg-and-save-the-image-as-DICOM-tp3691389p3691391.html

Hi,
Thanks for your reply .. the code I am using is working fine if I execute it as a standalone program .. but I am using the code in a signed applet which is integrated in a web application ... I am getting the exception when accessed from multiple webclients...  

FYI. I am using dcm4che 1.4.9

-Phanikanth


Johannes Hermen wrote
> Problem while adding dicom header to a jpeg and save the image as DICOM
>
> Hi am getting an exception
> java.lang.ClassCastException: org.dcm4cheri.util.UIDGeneratorImpl cannot
be
> cast to org.dcm4che.util.UIDGenerator
> while adding dicom header to a jpeg and save the image as DICOM.The code
> snippet as well as
> exception stacktrace is as follows:
> I am using Tudor Dicom Tools and dcm4che.jar.

Seems you are using an old version of the DICOM Tools? We are using the
dcm4che2 libs since some time and have done a lot of changes and new
features.
The code for exporting has although changed a bit:

DicomExporter exporter = new DicomExporter();
File dcmFile = new File("/home/hermenj/jhermen.dcm");
ImagePlus ip = new ImagePlus("/home/hermenj/img.jpg");

DicomObject dObj = exporter.createHeader(ip, true, true, true);

// if wanted, set additional tags...
DicomAnonymizer.addTag(dObj, Tag.PatientName, "Testpatient");

exporter.writeImage(dObj, ip, dcmFile);

Please try the latest version from
http://santec.tudor.lu/project/optimage/dicom/start and be sure to exchange
all dcm4che libs with the ones from the new dicom-tools.

Greets
        Johannes


-----------------------------------------------------------------
Johannes Hermen  -  Ingenieur de Recherche
Johannes.Hermen@tudor.lu
-----------------------------------------------------------------
CRP Henri Tudor  http://www.santec.tudor.lu
29, Avenue John F. Kennedy
L-1855 Luxembourg
-----------------------------------------------------------------