Skip to content

Commit

Permalink
Implemented new ImageWorker interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Jesus committed Jun 20, 2022
1 parent e613b3e commit 8738014
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import pt.ua.dicoogle.sdk.datastructs.Report;
import pt.ua.dicoogle.sdk.datastructs.SearchResult;
import pt.ua.dicoogle.sdk.datastructs.dim.DimLevel;
import pt.ua.dicoogle.sdk.imageworker.ImageWorkerInterface;
import pt.ua.dicoogle.sdk.settings.ConfigurationHolder;
import pt.ua.dicoogle.sdk.task.JointQueryTask;
import pt.ua.dicoogle.sdk.task.Task;
Expand Down Expand Up @@ -344,6 +345,19 @@ public Collection<JettyPluginInterface> getServletPlugins() {
return this.getServletPlugins(true);
}

public Collection<ImageWorkerInterface> getImageWorkerPlugins(boolean onlyEnabled) {
List<ImageWorkerInterface> plugins = new ArrayList<>();
for (PluginSet pSet : pluginSets) {
for (ImageWorkerInterface i : pSet.getImageWorkerPlugins()) {
if (!i.isEnabled() && onlyEnabled) {
continue;
}
plugins.add(i);
}
}
return plugins;
}

public Collection<String> getPluginSetNames() {
Collection<String> l = new ArrayList<>();
for (PluginSet s : this.pluginSets) {
Expand Down Expand Up @@ -512,6 +526,17 @@ public StorageInterface getStorageByName(String name, boolean onlyEnabled) {
return null;
}

public ImageWorkerInterface getImageWorkerInterfaceByName(String name, boolean onlyEnabled) {
Collection<ImageWorkerInterface> plugins = getImageWorkerPlugins(onlyEnabled);
for (ImageWorkerInterface p : plugins) {
if (p.getName().equalsIgnoreCase(name)) {
// logger.info("Retrived Query Provider: "+name);
return p;
}
}
logger.debug("No image worker matching name {} for onlyEnabled = {}", name, onlyEnabled);
return null;
}

public JointQueryTask queryAll(JointQueryTask holder, final String query, final Object... parameters) {
List<String> providers = this.getQueryProvidersName(true);
Expand Down
6 changes: 6 additions & 0 deletions sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@
<version>${dcm4che.version}</version>
</dependency>

<dependency>
<artifactId>dcm4che-core</artifactId>
<groupId>org.dcm4che</groupId>
<version>3.3.7</version>
</dependency>

<dependency>
<groupId>dcm4che</groupId>
<artifactId>dcm4che-net</artifactId>
Expand Down
29 changes: 29 additions & 0 deletions sdk/src/main/java/pt/ua/dicoogle/sdk/imageworker/ImageROI.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,33 @@ public class ImageROI {

private URI roi;

public ImageROI(int width, int height, URI roi) {
this.width = width;
this.height = height;
this.roi = roi;
}

public int getWidth() {
return width;
}

public void setWidth(int width) {
this.width = width;
}

public int getHeight() {
return height;
}

public void setHeight(int height) {
this.height = height;
}

public URI getRoi() {
return roi;
}

public void setRoi(URI roi) {
this.roi = roi;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pt.ua.dicoogle.sdk.imageworker;

import org.dcm4che2.io.DicomInputStream;
import pt.ua.dicoogle.sdk.DicooglePlugin;
import pt.ua.dicoogle.sdk.datastructs.SearchResult;
import pt.ua.dicoogle.sdk.datastructs.dim.BulkAnnotation;

public abstract class ImageWorkerInterface {
public interface ImageWorkerInterface extends DicooglePlugin {
public abstract ImageROI extractROI(SearchResult sr, BulkAnnotation annotation);

public abstract ImageROI extractROI(DicomInputStream is, BulkAnnotation annotation);

public abstract Iterable<ImageROI> extractROIs(DicomInputStream is, Iterable<BulkAnnotation> annotations);
public abstract Iterable<ImageROI> extractROIs(SearchResult sr, Iterable<BulkAnnotation> annotations);
}

0 comments on commit 8738014

Please sign in to comment.