Skip to content

Commit d0ff371

Browse files
committed
Merge pull request #6 from bioinformatics-ua/imp/v2
Sample plugin revamped
2 parents 0b17a45 + 314a74d commit d0ff371

16 files changed

Lines changed: 561 additions & 326 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/

README.md

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,77 @@
11
Dicoogle Plugin - Sample
2-
-----------------------
2+
========================
33

4+
This is a Dicoogle plugin to serve as an example. Those that are interested in developing a new
5+
plugin may use this one as a template.
46

5-
Where should I start?
6-
-----------------------
7+
Getting Started
8+
---------------
79

10+
### Installing and running Dicoogle
811

9-
Run Dicoogle
10-
---------------
1112
1. Go to http://www.dicoogle.com/?page_id=67
12-
2. Download the version of Dicoogle
13-
3. Run the Dicoogle with: sh Dicoogle.sh or Dicoogle.bat.
14-
4. Is it running? You're ok!
13+
2. Download version 2 (or later) of Dicoogle
14+
3. Extract your contents to its own directory (e.g. "~/dicoogle" or "C:\dicoogle", depending on the platform).
15+
4. Run Dicoogle with: sh Dicoogle.sh (OSX / Linux) or Dicoogle.bat (Windows).
16+
5. You should see your web browser opening the Dicoogle user interface. Is it running? You're ok!
17+
18+
### Downloading and building the plugin
19+
20+
Maven is required in order to build the project. An IDE with Maven support such as Netbeans may also help.
21+
22+
1. Clone the git repository at https://github.com/bioinformatics-ua/dicooglePluginSample.git
1523

24+
2. Go to the project's base directory in a command line and run `mvn install`. Alternatively, open
25+
the Maven project of the plugin with your IDE, then force it to build your project.
1626

17-
Use your own plugin
18-
--------------------
27+
3. If the building task is successful, you will have a new jar with dependencies in the target
28+
folder (target/dicoogle-plugin-sample-2.0-jar-with-dependencies.jar).
1929

20-
You should use Netbeans to compile the project and maven is necessary. Then, the first class to look is RSIPluginSet. It is the place where the magic starts.
30+
### Developing your own plugin based on this sample
2131

22-
You can compile and run in the command line:
32+
The first class to look into is RSIPluginSet. It is the main entry point for everything else.
33+
Once modified to suit your needs, build the plugin again and re-deploy it to Dicoogle (see below).
2334

24-
1. https://github.com/bioinformatics-ua/dicooglePluginSample.git
25-
2. cd dicooglePluginSample
26-
3. ```$ mvn install```
27-
4. copy target/dicooglePluginRestSample-1.0-SNAPSHOT-jar-with-dependencies.jar to the folder Plugins inside Dicoogle project.
28-
5. Run Dicoogle with: sh Dicoogle.sh or Dicoogle.bat.
35+
### Using your plugin
2936

37+
1. Copy your plugin's package with dependencies (target/dicoogle-plugin-sample-2.0-jar-with-dependencies.jar)
38+
to the "Plugins" folder inside the root folder of Dicoogle.
3039

40+
2. Run Dicoogle. The plugin will be automatically included.
3141

32-
Available plugins
33-
-----------------------
34-
- RSIIndex
35-
- RSIStorage
36-
- RSIQuery
37-
- RSIWebService
38-
- RSIJettyPlugin
39-
- Sample HTML5 content and consuming web service: helps to build a web app
42+
Available content
43+
-----------------
44+
45+
- _RSIIndexer_ : a sample indexer, only logs the DIM contents of files
46+
- _RSIStorage_ : a sample storage service, keeps files in memory buffers
47+
- _RSIQuery_ : a sample query provider, returns random data on request
48+
- _RSIJettyPlugin_ : a sample plugin for providing web services, holds `RSIWebService`
49+
- _RSIWebService_ : a sample web service in the form of a servlet, serves a web page and a few other services
50+
- _RSIRestPlugin_ : a sample Restlet server resource, provides dummy data
51+
- Sample HTML5 content and consuming web service: helps you to build a web app
4052

4153
Web service plugin sample and Web App:
42-
--------------------------
54+
--------------------------------------
4355

44-
To test the webservice plugin, you should go to Services and Enable Dicoogle Web Services.
56+
To test the webservice plugin, you may open your browser and navigate to these URLs:
4557

46-
- http://127.0.0.1:8080/sample/hello?uid=1111
47-
- http://127.0.0.1:8080/dashboardSample
48-
- http://127.0.0.1:6060/rsitest (restlet)
58+
- `http://localhost:8080/sample/hello?uid=1111`
59+
- `http://localhost:8080/dashboardSample`
60+
- `http://localhost:8080/ext/rsi-test` (restlet)
4961

62+
You may also use the built-in Dicoogle services for testing other plugins:
5063

64+
- GET `http://localhost:8080/search?query=test&provider=RSI` to test the query provider
65+
- POST `http://localhost:8080/management/tasks/index?plugin=RSI&uri=<file:/path/to/DICOM/dir>` to test the indexer
5166

5267
Platforms
53-
----------------
68+
----------
69+
70+
Dicoogle has been tested in:
5471

5572
- Windows
5673
- Linux
5774
- Mac OS X
5875

59-
More information: http://bioinformatics-ua.github.io/dicoogle/
60-
61-
76+
For more information, please visit http://www.dicoogle.com
6277

pom.xml

Lines changed: 90 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<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">
33
<modelVersion>4.0.0</modelVersion>
4-
<groupId>pt.ieeta.dicoogle.plugin.demo</groupId>
5-
<artifactId>dicooglePluginRestSample</artifactId>
6-
<version>1.0-SNAPSHOT</version>
4+
<groupId>pt.ua.dicoogle.demo</groupId>
5+
<artifactId>dicoogle-plugin-sample</artifactId>
6+
<name>dicoogle-plugin-sample</name>
7+
<version>2.0.0</version>
78
<packaging>jar</packaging>
9+
10+
<properties>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
13+
<!-- Dicoogle SDK version here -->
14+
<dicoogle.version>2.0.0</dicoogle.version>
15+
16+
<!-- Jetty server version here -->
17+
<jetty.version>9.0.3.v20130506</jetty.version>
18+
</properties>
19+
820
<build>
9-
10-
<resources>
11-
<resource>
12-
<directory>src/main/java/pt/ieeta/dicoogle/plugin/demo/dicooglepluginsample/html5/</directory>
13-
</resource>
21+
<resources>
22+
<!-- Resources to be included -->
23+
<resource>
24+
<directory>src/main/resources/html5/</directory>
25+
</resource>
1426
</resources>
1527

1628
<plugins>
@@ -19,20 +31,20 @@
1931
<artifactId>maven-compiler-plugin</artifactId>
2032
<version>2.3.2</version>
2133
<configuration>
34+
<!-- For access to Java 8 capabilities, replace source
35+
and target versions to 1.8
36+
-->
2237
<source>1.7</source>
2338
<target>1.7</target>
2439
</configuration>
2540
</plugin>
2641
<plugin>
27-
28-
2942
<artifactId>maven-assembly-plugin</artifactId>
3043
<configuration>
3144
<descriptorRefs>
3245
<descriptorRef>jar-with-dependencies</descriptorRef>
3346
</descriptorRefs>
3447
<archive>
35-
3648
</archive>
3749
</configuration>
3850
<executions>
@@ -45,8 +57,27 @@
4557
</execution>
4658
</executions>
4759
</plugin>
48-
49-
60+
<plugin>
61+
<groupId>com.mycila</groupId>
62+
<artifactId>license-maven-plugin</artifactId>
63+
<version>2.4</version>
64+
<configuration>
65+
<header>./short-license.txt</header>
66+
<includes>
67+
<include>**/*.java</include>
68+
</includes>
69+
<excludes>
70+
<exclude>**/package-info.java</exclude>
71+
</excludes>
72+
</configuration>
73+
<executions>
74+
<execution>
75+
<goals>
76+
<goal>check</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
</plugin>
5081
</plugins>
5182
</build>
5283
<repositories>
@@ -55,30 +86,59 @@
5586
<name>Public online Restlet repository</name>
5687
<url>http://maven.restlet.org</url>
5788
</repository>
58-
</repositories>
89+
<repository>
90+
<id>mavencentral</id>
91+
<url>http://repo1.maven.org/maven2/</url>
92+
<snapshots>
93+
<enabled>true</enabled>
94+
</snapshots>
95+
</repository>
96+
<repository>
97+
<id>dcm4che</id>
98+
<url>http://www.dcm4che.org/maven2/</url>
99+
<snapshots>
100+
<enabled>true</enabled>
101+
</snapshots>
102+
</repository>
103+
104+
<repository>
105+
<id>mi</id>
106+
<url>http://bioinformatics.ua.pt/maven/content/repositories/mi</url>
107+
<snapshots>
108+
<enabled>false</enabled>
109+
</snapshots>
110+
</repository>
111+
112+
<repository>
113+
<id>mi-snapshots</id>
114+
<url>http://bioinformatics.ua.pt/maven/content/repositories/mi-snapshots</url>
115+
<snapshots>
116+
<enabled>true</enabled>
117+
</snapshots>
118+
</repository>
119+
120+
<repository>
121+
<id>sourceforge-releases</id>
122+
<name>Sourceforge Releases</name>
123+
<url>https://oss.sonatype.org/content/repositories/sourceforge-releases</url>
124+
</repository>
125+
</repositories>
59126

60127
<dependencies>
61-
<dependency>
62-
<groupId>pt.ua.ieeta</groupId>
63-
<artifactId>dicoogle-sdk</artifactId>
64-
<version>2.0-SNAPSHOT</version>
65-
</dependency>
66128
<dependency>
67129
<groupId>org.restlet.jse</groupId>
68130
<artifactId>org.restlet.ext.json</artifactId>
69131
<version>2.1.2</version>
70132
</dependency>
71-
72133
<dependency>
73-
<groupId>org.eclipse.jetty</groupId>
74-
<artifactId>jetty-webapp</artifactId>
75-
<version>9.0.3.v20130506</version>
76-
</dependency>
134+
<groupId>pt.ua.ieeta</groupId>
135+
<artifactId>dicoogle-sdk</artifactId>
136+
<version>${dicoogle.version}</version>
137+
</dependency>
138+
<dependency>
139+
<groupId>org.eclipse.jetty</groupId>
140+
<artifactId>jetty-webapp</artifactId>
141+
<version>${jetty.version}</version>
142+
</dependency>
77143
</dependencies>
78-
<properties>
79-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
80-
<maven.compiler.source>1.7</maven.compiler.source>
81-
<maven.compiler.target>1.7</maven.compiler.target>
82-
</properties>
83-
<name>dicooglePluginSample</name>
84144
</project>

short-license.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
2+
3+
This file is part of Dicoogle/${project.name}.
4+
5+
Dicoogle/${project.name} is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
Dicoogle/${project.name} is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with Dicoogle. If not, see <http://www.gnu.org/licenses/>.

src/main/java/pt/ieeta/dicoogle/plugin/demo/dicooglepluginsample/JsonWebService.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
3+
*
4+
* This file is part of Dicoogle/dicoogle-plugin-sample.
5+
*
6+
* Dicoogle/dicoogle-plugin-sample is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Dicoogle/dicoogle-plugin-sample is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with Dicoogle. If not, see <http://www.gnu.org/licenses/>.
18+
*/
119

220
package pt.ieeta.dicoogle.plugin.demo.dicooglepluginsample;
321

src/main/java/pt/ieeta/dicoogle/plugin/demo/dicooglepluginsample/MemoryDICOMDB.java

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,43 @@
1+
/**
2+
* Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
3+
*
4+
* This file is part of Dicoogle/dicoogle-plugin-sample.
5+
*
6+
* Dicoogle/dicoogle-plugin-sample is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Dicoogle/dicoogle-plugin-sample is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with Dicoogle. If not, see <http://www.gnu.org/licenses/>.
18+
*/
119
package pt.ieeta.dicoogle.plugin.demo.dicooglepluginsample;
220

321
import java.util.ArrayList;
422
import java.util.List;
523

6-
/**
24+
/** An in-memory DICOM storage.
725
*
8-
* @author Luís A. Bastião Silva - <bastiao@ua.pt>
26+
* @author Luís A. Bastião Silva <bastiao@ua.pt>
27+
* @author Eduardo Pinho <eduardopinho@ua.pt>
928
*/
1029
public class MemoryDICOMDB {
1130

12-
private List<String> patientNames = null;
13-
private List<String> studies = null;
14-
private List<String> series = null;
15-
private List<String> sopInstanceUIDs = null;
31+
private final List<String> patientNames;
32+
private final List<String> studies;
33+
private final List<String> series;
34+
private final List<String> sopInstanceUIDs;
1635

1736
public MemoryDICOMDB ()
1837
{
38+
patientNames = new ArrayList<>();
39+
studies = new ArrayList<>();
40+
series = new ArrayList<>();
1941
sopInstanceUIDs = new ArrayList<>();
2042
}
2143

0 commit comments

Comments
 (0)