| 1 |
/* |
| 2 |
* DICOMWrapper |
| 3 |
*/ |
| 4 |
|
| 5 |
package DICOM.Query; |
| 6 |
|
| 7 |
import java.util.Vector; |
| 8 |
import DICOM.DICOMWrapper; |
| 9 |
import DICOM.Network.Association; |
| 10 |
|
| 11 |
public class CFindSCU { |
| 12 |
public native long newObjectJNI(); |
| 13 |
public native long openFileJNI(String fileName); |
| 14 |
public native long sendQuery(long objReference); |
| 15 |
|
| 16 |
static { |
| 17 |
System.loadLibrary("javactn"); |
| 18 |
} |
| 19 |
|
| 20 |
private java.util.Vector fResponseVector; |
| 21 |
|
| 22 |
public CFindSCU( ) { |
| 23 |
} |
| 24 |
|
| 25 |
public int callbackCFind(long objReference) { |
| 26 |
DICOM.DICOMWrapper w = new DICOM.DICOMWrapper(objReference); |
| 27 |
|
| 28 |
fResponseVector.addElement(w); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
public int sendCFind(String callingAETitle, |
| 34 |
String calledAETitle, |
| 35 |
String hostName, |
| 36 |
String port, |
| 37 |
String SOPClass, |
| 38 |
DICOMWrapper cfind, |
| 39 |
java.util.Vector responseVector) { |
| 40 |
System.out.println(callingAETitle); |
| 41 |
DICOM.Network.Association assoc = new DICOM.Network.Association(); |
| 42 |
fResponseVector = responseVector; |
| 43 |
|
| 44 |
String modSOPClass; |
| 45 |
|
| 46 |
if (SOPClass.equals("Patient")) |
| 47 |
modSOPClass = new String("1.2.840.10008.5.1.4.1.2.1.1"); |
| 48 |
else if (SOPClass.equals("Study")) |
| 49 |
modSOPClass = new String("1.2.840.10008.5.1.4.1.2.2.1"); |
| 50 |
else if (SOPClass.equals("MWL")) |
| 51 |
modSOPClass = new String("1.2.840.10008.5.1.4.31"); |
| 52 |
else |
| 53 |
modSOPClass = new String(SOPClass); |
| 54 |
|
| 55 |
int rslt = assoc.openAssociation(callingAETitle, |
| 56 |
calledAETitle, |
| 57 |
hostName, |
| 58 |
port, |
| 59 |
modSOPClass); |
| 60 |
if (rslt != 0) |
| 61 |
return -1; |
| 62 |
|
| 63 |
long objReference = cfind.getObjectReference(); |
| 64 |
|
| 65 |
sendQuery(objReference); |
| 66 |
|
| 67 |
assoc.closeAssociation(); |
| 68 |
|
| 69 |
return 0; |
| 70 |
} |
| 71 |
} |