| 1 |
/* Waveform Module Interface */ |
| 2 |
|
| 3 |
package DICOM.Module; |
| 4 |
import DICOM.Module.WaveformChannel; |
| 5 |
|
| 6 |
public class WaveformModule { |
| 7 |
public native void setChannelAttributes(long dcmObj, int ordinalNumber, |
| 8 |
DICOM.Module.WaveformChannel channel); |
| 9 |
public native void getSamplesByte(long dcmObj, byte samples[], |
| 10 |
int channels, int numberOfSamples); |
| 11 |
public native void getSamplesShort(long dcmObj, short samples[], |
| 12 |
int channels, int numberOfSamples); |
| 13 |
|
| 14 |
private int NumberOfChannels; |
| 15 |
private int NumberOfSamples; |
| 16 |
private float SamplingFrequency; |
| 17 |
private String GroupLabel; |
| 18 |
private String WaveformSampleValueRepresentation; |
| 19 |
|
| 20 |
//private int FrameCount; |
| 21 |
private long DCMObject; // To allow access to pixel data |
| 22 |
|
| 23 |
/* |
| 24 |
static { |
| 25 |
System.loadLibrary("javactn"); |
| 26 |
} |
| 27 |
*/ |
| 28 |
|
| 29 |
public WaveformModule() { |
| 30 |
|
| 31 |
} |
| 32 |
|
| 33 |
public int getNumberOfChannels() { |
| 34 |
return NumberOfChannels; |
| 35 |
} |
| 36 |
public int getNumberOfSamples() { |
| 37 |
return NumberOfSamples; |
| 38 |
} |
| 39 |
public float getSamplingFrequency() { |
| 40 |
return SamplingFrequency; |
| 41 |
} |
| 42 |
public String getGroupLabel() { |
| 43 |
return GroupLabel; |
| 44 |
} |
| 45 |
public String getWaveformSampleValueRepresentation() { |
| 46 |
return WaveformSampleValueRepresentation; |
| 47 |
} |
| 48 |
public DICOM.Module.WaveformChannel getChannel(int ordinalNumber) { |
| 49 |
DICOM.Module.WaveformChannel channel = new DICOM.Module.WaveformChannel(); |
| 50 |
setChannelAttributes(DCMObject, ordinalNumber, channel); |
| 51 |
DICOM.Misc.CodedValue v = channel.getChannelSource(); |
| 52 |
return channel; |
| 53 |
} |
| 54 |
public void getSamples(byte samples[], int channels, int numberOfSamples) { |
| 55 |
getSamplesByte(DCMObject, samples, channels, numberOfSamples); |
| 56 |
} |
| 57 |
public void getSamples(short samples[], int channels, int numberOfSamples) { |
| 58 |
getSamplesShort(DCMObject, samples, channels, numberOfSamples); |
| 59 |
} |
| 60 |
public byte[] samplesByte(int channels, int numberOfSamples) { |
| 61 |
byte samples[] = new byte[channels * numberOfSamples]; |
| 62 |
getSamplesByte(DCMObject, samples, channels, numberOfSamples); |
| 63 |
return samples; |
| 64 |
} |
| 65 |
public short[] samplesShort(int channels, int numberOfSamples) { |
| 66 |
short samples[] = new short[channels * numberOfSamples]; |
| 67 |
getSamplesShort(DCMObject, samples, channels, numberOfSamples); |
| 68 |
return samples; |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
public void dumpState() { |
| 73 |
System.out.println(" Number of Channels: " + NumberOfChannels); |
| 74 |
System.out.println(" Number of Samples: " + NumberOfSamples); |
| 75 |
System.out.println(" Sampling Frequency: " + SamplingFrequency); |
| 76 |
System.out.println(" Group Label: " + GroupLabel); |
| 77 |
System.out.println("Value Representation: " + WaveformSampleValueRepresentation); |
| 78 |
} |
| 79 |
} |