Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
java-version: ['8', '11']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Java (JDK ${{ matrix.java-version }})
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: Build with Maven
Expand Down
53 changes: 38 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Getting Started

### Installing and running Dicoogle

1. Go to http://www.dicoogle.com/downloads
2. Download version 2 (or later) of Dicoogle
1. Make sure that you have Java installed in your system. Versions 8 and 11 are known to work.
1. Go to https://www.dicoogle.com/downloads and get version 3 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 DicoogleClient.sh (OSX / Linux) or DicoogleClient.bat (Windows).
5. You should see your web browser opening the Dicoogle user interface. Is it running? You're ok!
Expand All @@ -21,33 +21,39 @@ Maven is required in order to build the project. An IDE with Maven support such

1. Clone the git repository at https://github.com/bioinformatics-ua/dicoogle-plugin-sample.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.
2. Go to the project's base directory in a command line and run `mvn package`.
Alternatively, open the Maven project of the plugin with your IDE, then force it to build your project.

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).
3. If the building task is successful, you will have a new shaded jar (with the necessary dependencies)
in the `target` folder (e.g. `target/dicoogle-plugin-sample-3.1.0.jar`)

### Developing your own plugin based on this sample

The first class to look into is RSIPluginSet. It is the main entry point for everything else.
The first class to look into is [`RSIPluginSet`][pluginset].
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).

Be sure to consult the [Dicoogle Learning Pack][learningpack] for more information.

[pluginset]: src/main/java/pt/ieeta/dicoogle/plugin/demo/dicooglepluginsample/RSIPluginSet.java
[learningpack]: https://bioinformatics-ua.github.io/dicoogle-learning-pack/docs/developing-plugins/

### Using your plugin

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

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

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
- `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:
Expand All @@ -62,6 +68,23 @@ To test the webservice plugin, you may open your browser and navigate to these U
You may also use the built-in Dicoogle services for testing other plugins:

- GET `http://localhost:8080/search?query=test&provider=dicoogle-plugin-sample` to test the query provider
- Note: You will need to record `dicoogle-plugin-sample`
as a DIM provider first. In `confs/server.xml`,
add the query provider in `config/archive/dim-providers`
like this:
```xml
<config>
<!-- ... -->
<archive>
<!-- ... -->
<dim-providers>
<dim-provider>dicoogle-plugin-sample</dim-provider>
</dim-providers>
<!-- ... -->
```
Then restart Dicoogle.
Remember to remove the provider from the list after testing
if you do not want to keep it.
- POST `http://localhost:8080/management/tasks/index?plugin=dicoogle-plugin-sample&uri=<file:/path/to/DICOM/dir>` to test the indexer

Platforms
Expand All @@ -73,5 +96,5 @@ Dicoogle has been tested in:
- Linux
- Mac OS X

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

43 changes: 25 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<groupId>pt.ua.dicoogle.demo</groupId>
<artifactId>dicoogle-plugin-sample</artifactId>
<name>dicoogle-plugin-sample</name>
<version>3.0.0</version>
<version>3.1.0</version>
<packaging>jar</packaging>

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

<!-- Dicoogle SDK version here -->
<dicoogle.version>3.2.2</dicoogle.version>
<dicoogle.version>3.4.1</dicoogle.version>

<!-- Jetty server version here -->
<jetty.version>9.0.3.v20130506</jetty.version>
Expand All @@ -24,7 +24,7 @@
<directory>src/main/resources/html5/</directory>
</resource>
<resource>
<directory>src/main/resources/webplugin-sample</directory>
<directory>src/main/resources/webplugin-sample/dist</directory>
<targetPath>WebPlugins/webplugin-sample</targetPath>
<filtering>false</filtering>
<includes>
Expand All @@ -38,37 +38,46 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
</archive>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/*.SF</exclude>
<exclude>**/*.DSA</exclude>
<exclude>**/*.RSA</exclude>
<exclude>**/module-info.class</exclude>
<exclude>**/module-info.java</exclude>
</excludes>
</filter>
</filters>
<minimizeJar>true</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.4</version>
<version>2.9</version>
<configuration>
<header>./short-license.txt</header>
<header>short-license.txt</header>
<includes>
<include>**/*.java</include>
</includes>
Expand Down Expand Up @@ -140,7 +149,5 @@
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>


</dependencies>
</project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package pt.ieeta.dicoogle.plugin.demo.dicooglepluginsample;

import java.net.URL;
import javax.servlet.http.HttpServlet;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

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

import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -61,7 +60,7 @@ private SearchResult generateSearchResult()
map.put("SeriesDate","20150120");

SearchResult r = new SearchResult(
URI.create("file:" + File.separatorChar + UUID.randomUUID().toString() ), 1, map);
URI.create("file://" + UUID.randomUUID().toString() ), 1, map);
return r;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
import pt.ua.dicoogle.sdk.StorageInputStream;
import pt.ua.dicoogle.sdk.StorageInterface;
import pt.ua.dicoogle.sdk.settings.ConfigurationHolder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
Expand All @@ -45,13 +44,13 @@
public class RSIStorage implements StorageInterface {
private static final Logger logger = LoggerFactory.getLogger(RSIStorage.class);

private final Map<String, ByteArrayOutputStream> mem = new HashMap<>();
private final Map<String, byte[]> mem = new HashMap<>();
private boolean enabled = true;
private ConfigurationHolder settings;

@Override
public String getScheme() {
return "mem://";
return "mem";
}

@Override
Expand All @@ -67,7 +66,6 @@ public Iterable<StorageInputStream> at(final URI location, Object... objects) {

@Override
public Iterator<StorageInputStream> iterator() {
Collection c2 = new ArrayList<>();
StorageInputStream s = new StorageInputStream() {

@Override
Expand All @@ -77,18 +75,17 @@ public URI getURI() {

@Override
public InputStream getInputStream() throws IOException {
ByteArrayOutputStream bos = mem.get(location.toString());
ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray());
byte[] data = mem.get(location.toString());
ByteArrayInputStream bin = new ByteArrayInputStream(data);
return bin;
}

@Override
public long getSize() throws IOException {
return mem.get(location.toString()).size();
return mem.get(location.toString()).length;
}
};
c2.add(s);
return c2.iterator();
return Collections.singletonList(s).iterator();
}
};
return c;
Expand All @@ -97,16 +94,14 @@ public long getSize() throws IOException {
@Override
public URI store(DicomObject dicomObject, Object... objects) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DicomOutputStream dos = new DicomOutputStream(bos);
try {
try (DicomOutputStream dos = new DicomOutputStream(bos)) {
dos.writeDicomFile(dicomObject);
} catch (IOException ex) {
logger.warn("Failed to store object", ex);
}
bos.toByteArray();
URI uri = URI.create("mem://" + UUID.randomUUID().toString());
mem.put(uri.toString(), bos);
mem.put(uri.toString(), bos.toByteArray());

return uri;
}

Expand Down
Loading
Loading