Skip to content

Commit

Permalink
feat: C GET DIMSE Service
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Aug 21, 2023
1 parent e3a5378 commit bfa8926
Show file tree
Hide file tree
Showing 115 changed files with 5,465 additions and 5,017 deletions.
114 changes: 114 additions & 0 deletions dimse/c-get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
const { UID } = require("@dcm4che/data/UID");
const { createCGetSCPInjectProxy } = require("@java-wrapper/org/github/chinlinlee/dcm777/net/CGetSCPInject");
const { default: SimpleCGetSCP } = require("@java-wrapper/org/github/chinlinlee/dcm777/net/SimpleCGetSCP");
const { PATIENT_ROOT_LEVELS, STUDY_ROOT_LEVELS, PATIENT_STUDY_ONLY_LEVELS } = require("./level");
const { getInstancesFromKeysAttr } = require("./utils");
const { default: RetrieveTaskImpl } = require("@dcm4che/tool/dcmqrscp/RetrieveTaskImpl");
const { Dimse } = require("@dcm4che/net/Dimse");
const { EnumSet } = require("@java-wrapper/java/util/EnumSet");
const { default: QueryRetrieveLevel2 } = require("@dcm4che/net/service/QueryRetrieveLevel2");

class JsCGetScp {
constructor() { }

getPatientRootLevel() {
const cGetScpInject = createCGetSCPInjectProxy(this.getCGetScpInjectProxyMethods(), {
keepAsDaemon: true
});

let simpleCGetScp = new SimpleCGetSCP(
cGetScpInject,
UID.PatientRootQueryRetrieveInformationModelGet,
PATIENT_ROOT_LEVELS
);

this.scpObj = simpleCGetScp;

return simpleCGetScp;
}

getStudyRootLevel() {
const cGetScpInject = createCGetSCPInjectProxy(this.getCGetScpInjectProxyMethods(), {
keepAsDaemon: true
});

let simpleCGetScp = new SimpleCGetSCP(
cGetScpInject,
UID.StudyRootQueryRetrieveInformationModelGet,
STUDY_ROOT_LEVELS
);

this.scpObj = simpleCGetScp;

return simpleCGetScp;
}

getPatientStudyOnlyLevel() {
const cGetScpInject = createCGetSCPInjectProxy(this.getCGetScpInjectProxyMethods(), {
keepAsDaemon: true
});

let simpleCGetScp = new SimpleCGetSCP(
cGetScpInject,
UID.PatientStudyOnlyQueryRetrieveInformationModelGet,
PATIENT_STUDY_ONLY_LEVELS
);

this.scpObj = simpleCGetScp;

return simpleCGetScp;
}

getCompositeLevel() {
const cGetScpInject = createCGetSCPInjectProxy(this.getCGetScpInjectProxyMethods(), {
keepAsDaemon: true
});

let simpleCGetScp = new SimpleCGetSCP(
cGetScpInject,
UID.CompositeInstanceRetrieveWithoutBulkDataGet,
EnumSet.ofSync(QueryRetrieveLevel2.IMAGE)
);

this.scpObj = simpleCGetScp;

return simpleCGetScp;
}

getCGetScpInjectProxyMethods() {
const cGetScpInjectProxyMethods = {
/**
*
* @param {Association} as
* @param {PresentationContext} pc
* @param {Attributes} rq
* @param {Attributes} keys
*/
calculateMatches: async (as, pc, rq, keys) => {
let instances = await getInstancesFromKeysAttr(keys);
if (await instances.isEmpty()) {
return null;
}

let withoutBulkData = await (await this.scpObj.getQrLevels()).size() == 1;
let retrieveTask = await RetrieveTaskImpl.newInstanceAsync(
Dimse.C_GET_RQ,
as,
pc,
rq,
instances,
as,
withoutBulkData,
0
);
await retrieveTask.setSendPendingRSP(false);

return retrieveTask;
}
};

return cGetScpInjectProxyMethods;
};
}

module.exports.JsCGetScp = JsCGetScp;
15 changes: 15 additions & 0 deletions dimse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const { JsCFindScp } = require("./c-find");
const { default: CLIUtils } = require("@dcm4che/tool/common/CLIUtils");
const { JsCMoveScp } = require("./c-move");
const fileExist = require("@root/utils/file/fileExist");
const { JsCGetScp } = require("./c-get");

const aeTitle = "FKQRSCP";
const host = "0.0.0.0";
Expand All @@ -44,16 +45,30 @@ class DcmQrScp {
let dicomServiceRegistry = new DicomServiceRegistry();

await dicomServiceRegistry.addDicomService(new BasicCEchoSCP());

// #region C-STORE
let jsCStoreScp = new JsCStoreScp();
await dicomServiceRegistry.addDicomService(jsCStoreScp.get());
// #endregion

// #region C-FIND
await dicomServiceRegistry.addDicomService(new JsCFindScp().getPatientRootLevel());
await dicomServiceRegistry.addDicomService(new JsCFindScp().getStudyRootLevel());
await dicomServiceRegistry.addDicomService(new JsCFindScp().getPatientStudyOnlyLevel());
// #endregion

// #region C-MOVE
await dicomServiceRegistry.addDicomService(new JsCMoveScp(this).getPatientRootLevel());
await dicomServiceRegistry.addDicomService(new JsCMoveScp(this).getStudyRootLevel());
await dicomServiceRegistry.addDicomService(new JsCMoveScp(this).getPatientStudyOnlyLevel());
// #endregion

// #region C-GET
await dicomServiceRegistry.addDicomService(new JsCGetScp().getPatientRootLevel());
await dicomServiceRegistry.addDicomService(new JsCGetScp().getStudyRootLevel());
await dicomServiceRegistry.addDicomService(new JsCGetScp().getPatientStudyOnlyLevel());
await dicomServiceRegistry.addDicomService(new JsCGetScp().getCompositeLevel());
// #endregion

return dicomServiceRegistry;
}
Expand Down
Binary file not shown.
16 changes: 8 additions & 8 deletions models/DICOM/dcm4che/wrapper/java/io/Reader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ export declare class ReaderClass extends JavaClass {
* @return original return type: 'void'
*/
resetSync(): void;
/**
* @return original return type: 'boolean'
*/
ready(): Promise<boolean>;
/**
* @return original return type: 'boolean'
*/
readySync(): boolean;
/**
* @return original return type: 'java.io.Reader'
*/
Expand All @@ -122,6 +114,14 @@ export declare class ReaderClass extends JavaClass {
* @return original return type: 'java.io.Reader'
*/
static nullReaderSync(): Reader | null;
/**
* @return original return type: 'boolean'
*/
ready(): Promise<boolean>;
/**
* @return original return type: 'boolean'
*/
readySync(): boolean;
/**
* @param var0 original type: 'long'
* @param var1 original type: 'int'
Expand Down
2 changes: 1 addition & 1 deletion models/DICOM/dcm4che/wrapper/java/io/Reader.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions models/DICOM/dcm4che/wrapper/java/net/DatagramPacket.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ export declare class DatagramPacketClass extends JavaClass {
* @return original return type: 'int'
*/
getOffsetSync(): number;
/**
* @param var0 original type: 'int'
* @return original return type: 'void'
*/
setPort(var0: java_lang_Integer | number): Promise<void>;
/**
* @param var0 original type: 'int'
* @return original return type: 'void'
*/
setPortSync(var0: java_lang_Integer | number): void;
/**
* @param var0 original type: 'byte[]'
* @return original return type: 'void'
Expand Down Expand Up @@ -123,6 +113,16 @@ export declare class DatagramPacketClass extends JavaClass {
* @return original return type: 'java.net.SocketAddress'
*/
getSocketAddressSync(): java_net_SocketAddress | null;
/**
* @param var0 original type: 'int'
* @return original return type: 'void'
*/
setPort(var0: java_lang_Integer | number): Promise<void>;
/**
* @param var0 original type: 'int'
* @return original return type: 'void'
*/
setPortSync(var0: java_lang_Integer | number): void;
/**
* @param var0 original type: 'long'
* @param var1 original type: 'int'
Expand Down
Loading

0 comments on commit bfa8926

Please sign in to comment.