Installation
Include in project
- Add the API dependency to pom.xml
- Build the project
- Download JAR file (via 'wget' or manually)
-
Include JAR file in project
- For Command Line (w/out Maven):
# Compile your Java class with the local JAR file javac -cp path/to/neuropacs-java-api-<version>.jar -d out src/com/yourpackage/YourMainClass.java # Run the program java -cp path/to/neuropacs-java-api-<version>.jar:out com.yourpackage.YourMainClass
- For an IDE
Option 1: Install via Maven
<dependency>
<groupId>com.neuropacs</groupId>
<artifactId>neuropacs-java-api</artifactId>
<version>1.0.1</version>
</dependency>
mvn clean install
Option 2: Add JAR file to the project
Version | Size | Description | URL |
---|---|---|---|
1.0.0 | 6.2MB | neuropacs™ Java API initial release. | https://d3tequ3xv41td3.cloudfront.net/java/neuropacs-java-api-1.0.0.jar |
1.0.1 | 8.3MB | Added DICOMweb integration and upload optimizations. | https://d3tequ3xv41td3.cloudfront.net/java/neuropacs-java-api-1.0.1.jar |
1.0.2 | 8.3MB | Added upload optimzations and error handling improvements. | https://d3tequ3xv41td3.cloudfront.net/java/neuropacs-java-api-1.0.2.jar |
1.0.3 | 8.5MB | neuropacs™ Java API latest release. Added upload optimzations and retry logic. | https://d3tequ3xv41td3.cloudfront.net/java/neuropacs-java-api-1.0.3.jar |
IntelliJ IDEA: Go to File > Project Structure > Libraries and add the JAR file.
Eclipse: Right-click on the project > Build Path > Add External Archives... and select the JAR file.
Usage
Initialization
Initialize the neuropacs™ API.
import com.neuropacs.Neuropacs
// Define neuropacs parameters
String apiKey = "your_api_key"; // API key
String serverUrl = "server_url"; // neuropacs™ serverl URL
String productName = "Atypical/MSAp/PSP-v1.0"; // Desired neuropacs™ product
String predictionFormat = "JSON"; // Output format of results
String originType = "my_application"; // Requestor origin
// Initialize the API
Neuropacs npcs = new Neuropacs(serverUrl, apiKey, originType);
Example
Working example using the neuropacs™ API.
// Create a session
String conn = npcs.connect();
// Create a new order
String conn = npcs.newJob();
// Upload a dataset from path
boolean upload = npcs.uploadDatasetFromPath(
orderId,
"/path/to/dataset",
System.out::println // optional progress callback
);
// Start an order
String orderStart = npcs.runJob(orderId, productName);
// Check order status
String status = npcs.checkStatus(orderId);
// Retrieve job results
String results = npcs.getResults(orderId, predictionFormat);
// Retrieve job results in PNG
byte[] resultsPng = npcs.getResultsPng(orderId);
Example viewing a PNG result
Download a PNG result file and view it.
// Import required packages
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInpudtStream;
import java.io.File;
// Retrieve job results in PNG
byte[] resultsPng = npcs.getResultsPng(orderId);
// Convert byte[] to an InputStream
ByteArrayInputStream bais = new ByteArrayInputStream(resultsPng);
// Read the input stream into a BufferedImage
BufferedImage image = ImageIO.read(bais);
// Save the image to a file
ImageIO.write(image, "png", new File("neuropacs_report.png"));
DICOMweb Integration
The API retrieves and processes images directly from DICOMweb WADO-RS servers, enabling neuropacs™ analysis for streamlined diagnostic workflows.
// Define DICOMweb parameters
String wadoUrl = "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs";
String studyUid = "1.3.12.2.1107.5.2.32.35162.30000022041820573832300000043";
String username = "username"; // If not required, use null
String password = "password"; // If not required, use null
// Upload a dataset from DICOMweb
boolean upload = await npcs.uploadDatasetFromDicomWeb(
orderId,
wadoUrl,
studyUid,
username,
password,
System.out::println // optional progress callback
);
Contact
Kerrick Cavanaugh (Lead Software Engineer) - kerrick@neuropacs.com
License
This project is licensed under the MIT.
Explore
Integrations
Explore the different systems and software that our product integrates with. Click each integration for detailed setup and usage instructions.
Supported Programming Languages
Our product supports various programming languages to offer flexibility in development. Click each language for APIs, libraries, and examples.