L_DicomWaveGrpSaveAudio
#include "Ltdic.h"
L_UINT16 EXT_FUNCTION L_DicomWaveGrpSaveAudio(hDICOMWaveFormGroup, pszFilename, uFlags)
HDICOMWAVEFORMGROUP hDICOMWaveFormGroup; |
/* a DICOM waveform group handle*/ |
L_CHAR * pszFilename; |
/* file name */ |
L_UINT16 uFlags; |
/* reserved for future use */ |
Creates an audio (wave) file from the channels in the waveform group.
Parameter |
Description |
hDICOMWaveFormGroup |
A DICOM waveform group handle |
pszFilename |
Name of the audio file to be created. |
uFlags |
Reserved for future use. Pass 0. |
Returns
0 |
The function was successful. |
> 0 |
An error occurred. Refer to Return Codes. |
Comments
This function is very useful for extracting audio (wave) data from a DICOM object of type "Basic Voice Audio" (1.2.840.10008.5.1.4.1.1.9.4.1), which is typically used for report dictation.
The resulting wave file has the following characteristics:
1. |
Number of channels: will either be 1 or 2, based on the value of the number of channels for this multiplex group. You can call L_DicomWaveGrpGetNumberOfChannels to get the number of channels in a multiplex group. |
2. |
Bits per sample (sample size) will always be 8. |
3. |
Samples per second (sampling rate): This will be the same as the sampling frequency for the waveform group, call L_DicomWaveGrpGetSamplingFrequency to get this value. |
4. |
Format category: PCM, mu-Law or a-Law, based on the value of the waveform sample interpretation which can be retrieved by calling L_DicomWaveGrpGetSampleInterpretation. |
Required DLLs and Libraries
LTDIC For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
See Also
Functions: |
L_DicomWaveGrpLoadAudio |
Topics: |
|
|
|
Example
// The following sample shows how to extract a
// wave stream from a dataset:
BOOL GetWaveFileFromDataset(HDICOMDS hInputDS, L_CHAR * pszResultingWaveFileName)
{
HDICOMWAVEFORMGROUP hAudioWaveformGroup = NULL;
// Our new waveform group
hAudioWaveformGroup = L_DicomWaveGrpCreate();
if(hAudioWaveformGroup == NULL)
{
return FALSE;
}
// Do we have any waveforms in the dataset?
if(L_DicomGetWaveformGroupCount(hInputDS) <1)
{
L_DicomWaveGrpFree(hAudioWaveformGroup);
return FALSE;
}
// Extract the first waveform group
if(L_DicomGetWaveformGroup(hInputDS,0,hAudioWaveformGroup) != DICOM_SUCCESS)
{
L_DicomWaveGrpFree(hAudioWaveformGroup);
return FALSE;
}
// Extract the wave stream from the waveform group and save it to disk
if(L_DicomWaveGrpSaveAudio(hAudioWaveformGroup, pszResultingWaveFileName,0) != DICOM_SUCCESS)
{
L_DicomWaveGrpFree(hAudioWaveformGroup);
return FALSE;
}
L_DicomWaveGrpFree(hAudioWaveformGroup);
return TRUE;
}