-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0344217
Showing
9 changed files
with
499 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.classpath | ||
.project | ||
*.iml | ||
.settings/ | ||
.idea/ | ||
target/ | ||
.recommenders/ | ||
.metadata/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ ***** BEGIN LICENSE BLOCK ***** | ||
~ Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
~ | ||
~ The contents of this file are subject to the Mozilla Public License Version | ||
~ 1.1 (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ http://www.mozilla.org/MPL/ | ||
~ | ||
~ Software distributed under the License is distributed on an "AS IS" basis, | ||
~ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
~ for the specific language governing rights and limitations under the | ||
~ License. | ||
~ | ||
~ The Original Code is part of dcm4che, an implementation of DICOM(TM) in | ||
~ Java(TM), hosted at https://github.com/dcm4che. | ||
~ | ||
~ The Initial Developer of the Original Code is | ||
~ J4Care. | ||
~ Portions created by the Initial Developer are Copyright (C) 2015-2018 | ||
~ the Initial Developer. All Rights Reserved. | ||
~ | ||
~ Contributor(s): | ||
~ See @authors listed below | ||
~ | ||
~ Alternatively, the contents of this file may be used under the terms of | ||
~ either the GNU General Public License Version 2 or later (the "GPL"), or | ||
~ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
~ in which case the provisions of the GPL or the LGPL are applicable instead | ||
~ of those above. If you wish to allow use of your version of this file only | ||
~ under the terms of either the GPL or the LGPL, and not to allow others to | ||
~ use your version of this file under the terms of the MPL, indicate your | ||
~ decision by deleting the provisions above and replace them with the notice | ||
~ and other provisions required by the GPL or the LGPL. If you do not delete | ||
~ the provisions above, a recipient may use your version of this file under | ||
~ the terms of any one of the MPL, the GPL or the LGPL. | ||
~ | ||
~ ***** END LICENSE BLOCK ***** | ||
~ | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quickstart-parent</artifactId> | ||
<groupId>org.dcm4che.quickstart</groupId> | ||
<version>5.13.3</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>c-echo-scp</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.dcm4che</groupId> | ||
<artifactId>dcm4che-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.dcm4che</groupId> | ||
<artifactId>dcm4che-net</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
121 changes: 121 additions & 0 deletions
121
c-echo-scp/src/main/java/org/dcm4che3/quickstart/cechoscp/CEchoSCP.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* | ||
* **** BEGIN LICENSE BLOCK ***** | ||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
* | ||
* The contents of this file are subject to the Mozilla Public License Version | ||
* 1.1 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* http://www.mozilla.org/MPL/ | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" basis, | ||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
* for the specific language governing rights and limitations under the | ||
* License. | ||
* | ||
* The Original Code is part of dcm4che, an implementation of DICOM(TM) in | ||
* Java(TM), hosted at https://github.com/dcm4che. | ||
* | ||
* The Initial Developer of the Original Code is | ||
* J4Care. | ||
* Portions created by the Initial Developer are Copyright (C) 2015-2018 | ||
* the Initial Developer. All Rights Reserved. | ||
* | ||
* Contributor(s): | ||
* See @authors listed below | ||
* | ||
* Alternatively, the contents of this file may be used under the terms of | ||
* either the GNU General Public License Version 2 or later (the "GPL"), or | ||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
* in which case the provisions of the GPL or the LGPL are applicable instead | ||
* of those above. If you wish to allow use of your version of this file only | ||
* under the terms of either the GPL or the LGPL, and not to allow others to | ||
* use your version of this file under the terms of the MPL, indicate your | ||
* decision by deleting the provisions above and replace them with the notice | ||
* and other provisions required by the GPL or the LGPL. If you do not delete | ||
* the provisions above, a recipient may use your version of this file under | ||
* the terms of any one of the MPL, the GPL or the LGPL. | ||
* | ||
* **** END LICENSE BLOCK ***** | ||
* | ||
*/ | ||
|
||
package org.dcm4che3.quickstart.cechoscp; | ||
|
||
import org.dcm4che3.data.UID; | ||
import org.dcm4che3.net.ApplicationEntity; | ||
import org.dcm4che3.net.Connection; | ||
import org.dcm4che3.net.Device; | ||
import org.dcm4che3.net.TransferCapability; | ||
|
||
import java.io.IOException; | ||
import java.security.GeneralSecurityException; | ||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ScheduledExecutorService; | ||
|
||
/** | ||
* @author Gunter Zeilinger <[email protected]> | ||
* @since Jul 2018 | ||
*/ | ||
public class CEchoSCP { | ||
private Device device; | ||
private ApplicationEntity ae; | ||
private Connection conn; | ||
|
||
public CEchoSCP(String calledAET, String bindAddress, int port) { | ||
device = new Device("c-echo-scp"); | ||
ae = new ApplicationEntity(calledAET); | ||
conn = new Connection(null, "127.0.0.1", port); | ||
conn.setBindAddress(bindAddress); | ||
device.addApplicationEntity(ae); | ||
device.addConnection(conn); | ||
ae.addConnection(conn); | ||
ae.addTransferCapability(new TransferCapability(null, | ||
UID.VerificationSOPClass, TransferCapability.Role.SCP, UID.ImplicitVRLittleEndian)); | ||
} | ||
|
||
public void setExecutor(Executor executor) { | ||
device.setExecutor(executor); | ||
} | ||
|
||
public void setScheduledExecutor(ScheduledExecutorService executor) { | ||
device.setScheduledExecutor(executor); | ||
} | ||
|
||
public void start() throws IOException, GeneralSecurityException { | ||
device.bindConnections(); | ||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
CLI cli = CLI.parse(args); | ||
ExecutorService executor = Executors.newCachedThreadPool(); | ||
ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor(); | ||
CEchoSCP scp = new CEchoSCP(cli.calledAET, cli.bindAddress, cli.port); | ||
scp.setExecutor(executor); | ||
scp.setScheduledExecutor(scheduledExecutor); | ||
scp.start(); | ||
} | ||
|
||
private static class CLI { | ||
final String calledAET; | ||
final String bindAddress; | ||
final int port; | ||
|
||
CLI(String[] args) { | ||
calledAET = args[0]; | ||
bindAddress = args[1]; | ||
port = Integer.parseInt(args[2]); | ||
} | ||
|
||
static CLI parse(String[] args) { | ||
try { | ||
return new CLI(args); | ||
} catch (IndexOutOfBoundsException | NumberFormatException e) { | ||
System.out.println("Usage: c-echo-scp <called-aet> <bind-address> <port>"); | ||
System.exit(-1); | ||
return null; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
log4j.rootLogger=DEBUG, stdout | ||
|
||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %-5p - %m\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ ***** BEGIN LICENSE BLOCK ***** | ||
~ Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
~ | ||
~ The contents of this file are subject to the Mozilla Public License Version | ||
~ 1.1 (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ http://www.mozilla.org/MPL/ | ||
~ | ||
~ Software distributed under the License is distributed on an "AS IS" basis, | ||
~ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
~ for the specific language governing rights and limitations under the | ||
~ License. | ||
~ | ||
~ The Original Code is part of dcm4che, an implementation of DICOM(TM) in | ||
~ Java(TM), hosted at https://github.com/dcm4che. | ||
~ | ||
~ The Initial Developer of the Original Code is | ||
~ J4Care. | ||
~ Portions created by the Initial Developer are Copyright (C) 2015-2018 | ||
~ the Initial Developer. All Rights Reserved. | ||
~ | ||
~ Contributor(s): | ||
~ See @authors listed below | ||
~ | ||
~ Alternatively, the contents of this file may be used under the terms of | ||
~ either the GNU General Public License Version 2 or later (the "GPL"), or | ||
~ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
~ in which case the provisions of the GPL or the LGPL are applicable instead | ||
~ of those above. If you wish to allow use of your version of this file only | ||
~ under the terms of either the GPL or the LGPL, and not to allow others to | ||
~ use your version of this file under the terms of the MPL, indicate your | ||
~ decision by deleting the provisions above and replace them with the notice | ||
~ and other provisions required by the GPL or the LGPL. If you do not delete | ||
~ the provisions above, a recipient may use your version of this file under | ||
~ the terms of any one of the MPL, the GPL or the LGPL. | ||
~ | ||
~ ***** END LICENSE BLOCK ***** | ||
~ | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quickstart-parent</artifactId> | ||
<groupId>org.dcm4che.quickstart</groupId> | ||
<version>5.13.3</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>c-echo-scu</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.dcm4che</groupId> | ||
<artifactId>dcm4che-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.dcm4che</groupId> | ||
<artifactId>dcm4che-net</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.