Hello, everyone! I'm very excited that Github's community is interested in my project. Unfortunatly, this project needs improvements in performance and stability. I plan to rewrite some code and replace technologies which I used in first version. It would be great if you bring new fresh ideas to enhance application.
NeurDICOM is portable and easy-to-deploy RESTful DICOM and PACS server that allows physicians to use state-of-the-art methods of machine learning and neural networks to make a diagnosis based on medical images processing and interpetating.
1.1. Patients
1.2. Studies
1.3. Series
1.4. Instances
1.5. Plugins
Base URL: /api
Resource | Description |
---|---|
GET /patients | Find all patients |
GET /patients/:id | Find patient by id |
GET /patients/:id/studies | Find studies for patient |
PUT /patients/:id | Update patient |
DELETE /patients/:id | Delete patient |
Description: Find all patients
Description: Find patient by id
Description: Find patient's studies
Description: Update patient
Description: Delete patient
Base URL: /api
Resource | Description |
---|---|
GET /studies | Find all patients |
GET /studies/:id | Find patient by id |
GET /studies/:id/series | Find studies for patient |
PUT /studies/:id | Update study |
DELETE /studies/:id | Delete study |
Description: Find all studies
Description: Find study by id
Description: Find study's series
Description: Update study
Description: Delete study
Base URL: /api
Resource | Description |
---|---|
GET /series | Find all series |
GET /series/:id | Find series by id |
GET /series/:id/instances | Find series' instances |
PUT /series/:id | Update series |
DELETE /series/:id | Delete series |
Description: Find all series
Description: Find series by id
Description: Find series' instances
Description: Update series
Description: Delete series
Base URL: /api
Resource | Description |
---|---|
GET /instances | Find all instance |
GET /instances/:id | Find instance by id |
GET /instances/:id/tags | Get instance's tags |
GET /instances/:id/image | Get instance's image |
GET /instances/:id/raw | Get instance's raw pixel data in bytes |
GET /instances/:instance_id/process/by_plugin/:plugin_id | Process instance by plugin |
PUT /instances/:id | Update instance |
DELETE /instances/:id | Delete instance |
Description: Find all instances
Description: Find instances by id
Description: Get instance's tags
Description: Get instance's image
Description: Get instance's raw pixel data in bytes
Description: Process instance by plugin
Description: Save instance
Description: Update instance
Description: Delete instance
Base URL: /api
Resource | Description |
---|---|
GET /plugins | Find all plugins |
GET /plugins/:id | Find plugin by id |
POST /plugins | Upload plugin |
DELETE /plugins/:id | Delete plugin |
Description: Find all plugins
Description: Find plugin by id
Description: Upload plugin
Description: Delete plugin
Neurdicom provides API for creating plugins to extend the functionality of DICOM files processing. Plugins should be written in Python and packed as ZIP archive. Plugin should have at least two files 'META.json' and 'plugin.py'. 'META.json' describes the plugin, author and main plugin information. Expected strusture of 'META.json' is shown below:
{
"plugin_guid": "...",
"author": "John Doe",
"name": "hello",
"info": "Print hello greeting",
"help": "To greet say 'Hello'",
"params": {
"name": {
"type": "text"
}
}
}
Field "params" list all parameters which plugin expects. Each "params" field has one of several options "type", "isarray", "values", "isnull". Field "type" is obligatory and takes one of the following values:
[
"text",
"int",
"double"
]
Fields "isarray", "isnull" are boolearn or nullable. Nullable value are is considered as false.
Plugin should have a public "Plugin" class. "Plugin" class should have at least three of the following methods "init", "process" and "destory". Example of "Plugin" class is shown below:
class Plugin:
def init(self):
print('Init method called')
def process(self, ds: Dataset = None, *args, **kwargs):
print('Hello,', kwargs['name'], '!')
return {
'greeting': 'Hello, %s!' % kwargs['name']
}
def destroy(self):
print('Destroy method called')
Also you can write plugins in C/C++. All C/C++ plugins should be createad as a shared library and compiled at the specific target. Library should contain exposed extern C-functions to provide an access to plugin class. For example:
Our library contains 4 files: library.h, library.cpp, plugin.h, plugin.cpp library.h and library.cpp contain defintions of C-functions which provide access to plugin initialization, processing and destruction:
library.h
#include "Plugin.h"
extern "C" Plugin* InitPlugin();
extern "C" double* Process(Plugin *plugin, double *img, int width, int height, const char* params);
extern "C" void DestroyPlugin(Plugin* plugin);
library.cpp
#include "library.h"
extern "C" {
Plugin* InitPlugin(){
return new Plugin;
}
double* Process(Plugin *plugin, double *img, int width, int height, const char* params) {
return plugin->process(img, width, height, params);
}
void DestroyPlugin(Plugin *plugin){
delete plugin;
}
}
Plugin class should contain constructor, processing function and destructor. Processing function should accept at least 4 parameters: image as double array, width, height and additional parameters passed as json string.
plugin.h
class Plugin {
public:
Plugin();
double *process(double *, int, int, const char *params);
~Plugin();
};
plugin.cpp
#include "Plugin.h"
#include "json.hpp"
#include <iostream>
#include "json.hpp"
// for convenience
using json = nlohmann::json;
using namespace std;
double *Plugin::process(double *img, int w, int h, const char *params) {
cout << "Processing image" << endl;
cout << params << endl;
auto j = json::parse(params);
double factor = j["factor"].get<double>();
for (int r = 0; r < w * h; r++) {
img[r] = factor - img[r];
}
return img;
}
Plugin::Plugin() {
cout << "Initializing plugin" << endl;
}
Plugin::~Plugin() {
cout << "Destroying plugin" << endl;
}