| 1 |
package DICOM.DDR; |
| 2 |
|
| 3 |
import DICOM.DICOMWrapper; |
| 4 |
import DICOM.DDR.Patient; |
| 5 |
import DICOM.DDR.Study; |
| 6 |
import java.util.Vector; |
| 7 |
|
| 8 |
/* |
| 9 |
* DIRInterface |
| 10 |
*/ |
| 11 |
|
| 12 |
|
| 13 |
public class DIRInterface extends DICOM.DICOMWrapper { |
| 14 |
public native int getPatientCount(long dcmObj); |
| 15 |
public native void setPatientAttributes(long dcmObj, int index, DICOM.DDR.Patient p); |
| 16 |
public native int getStudyCount(long dcmObj, String patientID); |
| 17 |
public native void setStudyAttributes(long dcmObj, String patientID, |
| 18 |
int index, DICOM.DDR.Study study); |
| 19 |
public native int getSeriesCount(long dcmObj, String patientID, |
| 20 |
String studyInstanceUID); |
| 21 |
public native void setSeriesAttributes(long dcmObj, String patientID, |
| 22 |
String studyInstanceUID, int index, DICOM.DDR.Series series); |
| 23 |
public native int getLeafCount(long dcmObj, String patientID, |
| 24 |
String studyInstanceUID, String seriesInstanceUID); |
| 25 |
public native void setLeafAttributes(long dcmObj, String patientID, |
| 26 |
String studyInstanceUID, String seriesInstanceUID, |
| 27 |
int index, DICOM.DDR.SeriesLeaf leaf); |
| 28 |
/* |
| 29 |
static { |
| 30 |
System.loadLibrary("javactn"); |
| 31 |
} |
| 32 |
*/ |
| 33 |
|
| 34 |
// private long fDCMObject; |
| 35 |
|
| 36 |
public DIRInterface(String fileName) { |
| 37 |
/*dcmFile = new DICOMWrapper(fileName);*/ |
| 38 |
fDCMObject = openFileJNI(fileName); |
| 39 |
} |
| 40 |
|
| 41 |
public int getPatientCount() { |
| 42 |
return getPatientCount(fDCMObject); |
| 43 |
} |
| 44 |
public DICOM.DDR.Patient getPatient(int index) { |
| 45 |
DICOM.DDR.Patient p = new DICOM.DDR.Patient(); |
| 46 |
setPatientAttributes(fDCMObject, index, p); |
| 47 |
return p; |
| 48 |
} |
| 49 |
public Vector getPatientVector() { |
| 50 |
int count = getPatientCount(fDCMObject); |
| 51 |
Vector v = new Vector(count, 1); |
| 52 |
int index; |
| 53 |
for (index = 0; index < count; index++) { |
| 54 |
DICOM.DDR.Patient patient = new DICOM.DDR.Patient(); |
| 55 |
setPatientAttributes(fDCMObject, index, patient); |
| 56 |
v.insertElementAt(patient, index); |
| 57 |
} |
| 58 |
return v; |
| 59 |
} |
| 60 |
|
| 61 |
public Vector getStudyVector(String patientID) { |
| 62 |
int count = getStudyCount(fDCMObject, patientID); |
| 63 |
Vector v = new Vector(count, 1); |
| 64 |
int index; |
| 65 |
for (index = 0; index < count; index++) { |
| 66 |
DICOM.DDR.Study study = new DICOM.DDR.Study(); |
| 67 |
setStudyAttributes(fDCMObject, patientID, index, study); |
| 68 |
v.insertElementAt(study, index); |
| 69 |
} |
| 70 |
|
| 71 |
return v; |
| 72 |
} |
| 73 |
public Vector getSeriesVector(String patientID, String studyInstanceUID) { |
| 74 |
int count = getSeriesCount(fDCMObject, patientID, studyInstanceUID); |
| 75 |
Vector v = new Vector(count, 1); |
| 76 |
System.out.println("Series count = " + count); |
| 77 |
int index; |
| 78 |
for (index = 0; index < count; index++) { |
| 79 |
DICOM.DDR.Series series = new DICOM.DDR.Series(); |
| 80 |
setSeriesAttributes(fDCMObject, patientID, studyInstanceUID, index, series); |
| 81 |
v.insertElementAt(series, index); |
| 82 |
} |
| 83 |
return v; |
| 84 |
} |
| 85 |
|
| 86 |
public Vector getLeafVector(String patientID, String studyInstanceUID, |
| 87 |
String seriesInstanceUID) { |
| 88 |
int count = getLeafCount(fDCMObject, patientID, studyInstanceUID, |
| 89 |
seriesInstanceUID); |
| 90 |
Vector v = new Vector(count, 1); |
| 91 |
int index; |
| 92 |
for (index = 0; index < count; index++) { |
| 93 |
DICOM.DDR.SeriesLeaf leaf = new DICOM.DDR.SeriesLeaf(); |
| 94 |
setLeafAttributes(fDCMObject, patientID, studyInstanceUID, |
| 95 |
seriesInstanceUID, index, leaf); |
| 96 |
v.insertElementAt(leaf, index); |
| 97 |
} |
| 98 |
return v; |
| 99 |
} |
| 100 |
|
| 101 |
} |