Skip to content

Commit

Permalink
Merge pull request #6 from bioinformatics-ua/imp/v2
Browse files Browse the repository at this point in the history
Sample plugin revamped
  • Loading branch information
bastiao committed Sep 23, 2015
2 parents 0b17a45 + 314a74d commit d0ff371
Show file tree
Hide file tree
Showing 16 changed files with 561 additions and 326 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
83 changes: 49 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,77 @@
Dicoogle Plugin - Sample
-----------------------
========================

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

Where should I start?
-----------------------
Getting Started
---------------

### Installing and running Dicoogle

Run Dicoogle
---------------
1. Go to http://www.dicoogle.com/?page_id=67
2. Download the version of Dicoogle
3. Run the Dicoogle with: sh Dicoogle.sh or Dicoogle.bat.
4. Is it running? You're ok!
2. Download version 2 (or later) of Dicoogle
3. Extract your contents to its own directory (e.g. "~/dicoogle" or "C:\dicoogle", depending on the platform).
4. Run Dicoogle with: sh Dicoogle.sh (OSX / Linux) or Dicoogle.bat (Windows).
5. You should see your web browser opening the Dicoogle user interface. Is it running? You're ok!

### Downloading and building the plugin

Maven is required in order to build the project. An IDE with Maven support such as Netbeans may also help.

1. Clone the git repository at https://github.com/bioinformatics-ua/dicooglePluginSample.git

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

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

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.
### Developing your own plugin based on this sample

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

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

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

2. Run Dicoogle. The plugin will be automatically included.

Available plugins
-----------------------
- RSIIndex
- RSIStorage
- RSIQuery
- RSIWebService
- RSIJettyPlugin
- Sample HTML5 content and consuming web service: helps to build a web app
Available content
-----------------

- _RSIIndexer_ : a sample indexer, only logs the DIM contents of files
- _RSIStorage_ : a sample storage service, keeps files in memory buffers
- _RSIQuery_ : a sample query provider, returns random data on request
- _RSIJettyPlugin_ : a sample plugin for providing web services, holds `RSIWebService`
- _RSIWebService_ : a sample web service in the form of a servlet, serves a web page and a few other services
- _RSIRestPlugin_ : a sample Restlet server resource, provides dummy data
- Sample HTML5 content and consuming web service: helps you to build a web app

Web service plugin sample and Web App:
--------------------------
--------------------------------------

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

- http://127.0.0.1:8080/sample/hello?uid=1111
- http://127.0.0.1:8080/dashboardSample
- http://127.0.0.1:6060/rsitest (restlet)
- `http://localhost:8080/sample/hello?uid=1111`
- `http://localhost:8080/dashboardSample`
- `http://localhost:8080/ext/rsi-test` (restlet)

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

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

Platforms
----------------
----------

Dicoogle has been tested in:

- Windows
- Linux
- Mac OS X

More information: http://bioinformatics-ua.github.io/dicoogle/


For more information, please visit http://www.dicoogle.com

120 changes: 90 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>pt.ieeta.dicoogle.plugin.demo</groupId>
<artifactId>dicooglePluginRestSample</artifactId>
<version>1.0-SNAPSHOT</version>
<groupId>pt.ua.dicoogle.demo</groupId>
<artifactId>dicoogle-plugin-sample</artifactId>
<name>dicoogle-plugin-sample</name>
<version>2.0.0</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Dicoogle SDK version here -->
<dicoogle.version>2.0.0</dicoogle.version>

<!-- Jetty server version here -->
<jetty.version>9.0.3.v20130506</jetty.version>
</properties>

<build>

<resources>
<resource>
<directory>src/main/java/pt/ieeta/dicoogle/plugin/demo/dicooglepluginsample/html5/</directory>
</resource>
<resources>
<!-- Resources to be included -->
<resource>
<directory>src/main/resources/html5/</directory>
</resource>
</resources>

<plugins>
Expand All @@ -19,20 +31,20 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<!-- For access to Java 8 capabilities, replace source
and target versions to 1.8
-->
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>


<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>

</archive>
</configuration>
<executions>
Expand All @@ -45,8 +57,27 @@
</execution>
</executions>
</plugin>


<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.4</version>
<configuration>
<header>./short-license.txt</header>
<includes>
<include>**/*.java</include>
</includes>
<excludes>
<exclude>**/package-info.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
Expand All @@ -55,30 +86,59 @@
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
<repository>
<id>mavencentral</id>
<url>http://repo1.maven.org/maven2/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>dcm4che</id>
<url>http://www.dcm4che.org/maven2/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

<repository>
<id>mi</id>
<url>http://bioinformatics.ua.pt/maven/content/repositories/mi</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>

<repository>
<id>mi-snapshots</id>
<url>http://bioinformatics.ua.pt/maven/content/repositories/mi-snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

<repository>
<id>sourceforge-releases</id>
<name>Sourceforge Releases</name>
<url>https://oss.sonatype.org/content/repositories/sourceforge-releases</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>pt.ua.ieeta</groupId>
<artifactId>dicoogle-sdk</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet.ext.json</artifactId>
<version>2.1.2</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.0.3.v20130506</version>
</dependency>
<groupId>pt.ua.ieeta</groupId>
<artifactId>dicoogle-sdk</artifactId>
<version>${dicoogle.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<name>dicooglePluginSample</name>
</project>
16 changes: 16 additions & 0 deletions short-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/

This file is part of Dicoogle/${project.name}.

Dicoogle/${project.name} is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Dicoogle/${project.name} is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

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

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

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

import java.util.ArrayList;
import java.util.List;

/**
/** An in-memory DICOM storage.
*
* @author Luís A. Bastião Silva - <[email protected]>
* @author Luís A. Bastião Silva <[email protected]>
* @author Eduardo Pinho <[email protected]>
*/
public class MemoryDICOMDB {

private List<String> patientNames = null;
private List<String> studies = null;
private List<String> series = null;
private List<String> sopInstanceUIDs = null;
private final List<String> patientNames;
private final List<String> studies;
private final List<String> series;
private final List<String> sopInstanceUIDs;

public MemoryDICOMDB ()
{
patientNames = new ArrayList<>();
studies = new ArrayList<>();
series = new ArrayList<>();
sopInstanceUIDs = new ArrayList<>();
}

Expand Down
Loading

0 comments on commit d0ff371

Please sign in to comment.