WAV In Dicom with dcm4che3 lib (in weasis)

86 views
Skip to first unread message

Jeremy Boukenty

unread,
Aug 31, 2017, 1:52:11 PM8/31/17
to dcm4che
Hi,

I try to store wav file in AU DICOM.

I can create only a empty file ... 


I get and store wavfile in attributes dicom

        RandomAccessFile f = null;
        byte[] b = null;
        try {
            f = new RandomAccessFile(soundfile, "r");
            b = new byte[(int) f.length()];
            f.read(b);
        } catch (IOException ex) {
            Logger.getLogger(DicomAudio.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            dicom.getNestedDataset(Tag.WaveformSequence).setBytes(Tag.WaveformData, VR.CS, b);
            if (f != null) {
                try {
                    f.close();
                    b = null;
                } catch (IOException ex) {
                    Logger.getLogger(DicomAudio.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }



And i create dicom file

            DicomOutputStream dos = new DicomOutputStream(f);
            Attributes attr = createDicomHeader();

            dos.writeDataset(null, attr);

            dos.finish();
            dos.flush();



Thanks in advance for help and sorry for my english.

Nicolas Roduit

unread,
Sep 1, 2017, 2:00:43 AM9/1/17
to dcm4che
You cannot do in that way.

Look at this page for the definition of DICOM AU. You can play a sample here which can be exported into a WAV file.

Otherwise you can simply encapsulate the file with the correct mime type - audio/wav - (see this page).

Jeremy Boukenty

unread,
Sep 11, 2017, 10:20:59 AM9/11/17
to dcm4che
Thanks for your answer.

Finally, i used dcm4che.jar library for convert my wav file.
But i wasn't able to use dcm4che-core3.jar ..
Reply all
Reply to author
Forward
0 new messages