dcm4chee 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -0
- data/Rakefile +9 -0
- data/app/controllers/dcm4chee/api/v1/application_entities_controller.rb +178 -0
- data/app/controllers/dcm4chee/api/v1/base_controller.rb +15 -0
- data/app/controllers/dcm4chee/api/v1/dicom_objects_controller.rb +58 -0
- data/app/controllers/dcm4chee/api/v1/file_systems_controller.rb +37 -0
- data/app/controllers/dcm4chee/api/v1/instances_controller.rb +68 -0
- data/app/controllers/dcm4chee/api/v1/modalities_controller.rb +29 -0
- data/app/controllers/dcm4chee/api/v1/patients_controller.rb +77 -0
- data/app/controllers/dcm4chee/api/v1/series_controller.rb +69 -0
- data/app/controllers/dcm4chee/api/v1/source_aets_controller.rb +29 -0
- data/app/controllers/dcm4chee/api/v1/studies_controller.rb +69 -0
- data/app/controllers/dcm4chee/api/v1/trashed_instances_controller.rb +82 -0
- data/app/controllers/dcm4chee/api/v1/trashed_patients_controller.rb +84 -0
- data/app/controllers/dcm4chee/api/v1/trashed_series_controller.rb +81 -0
- data/app/controllers/dcm4chee/api/v1/trashed_studies_controller.rb +81 -0
- data/app/controllers/dcm4chee/api/v1/trashes_controller.rb +23 -0
- data/app/controllers/dcm4chee/application_controller.rb +4 -0
- data/app/models/dcm4chee/application_entity.rb +129 -0
- data/app/models/dcm4chee/dicom_file.rb +62 -0
- data/app/models/dcm4chee/file_system.rb +95 -0
- data/app/models/dcm4chee/instance.rb +69 -0
- data/app/models/dcm4chee/modality.rb +17 -0
- data/app/models/dcm4chee/patient.rb +42 -0
- data/app/models/dcm4chee/series.rb +78 -0
- data/app/models/dcm4chee/source_aet.rb +17 -0
- data/app/models/dcm4chee/study.rb +60 -0
- data/app/models/dcm4chee/trashed_dicom_file.rb +58 -0
- data/app/models/dcm4chee/trashed_instance.rb +56 -0
- data/app/models/dcm4chee/trashed_patient.rb +40 -0
- data/app/models/dcm4chee/trashed_series.rb +50 -0
- data/app/models/dcm4chee/trashed_study.rb +40 -0
- data/config/routes.rb +27 -0
- data/lib/dcm4chee.rb +58 -0
- data/lib/dcm4chee/api_constraints.rb +12 -0
- data/lib/dcm4chee/dicom_object_manager.rb +48 -0
- data/lib/dcm4chee/engine.rb +5 -0
- data/lib/dcm4chee/models/has_dicom_object.rb +71 -0
- data/lib/dcm4chee/services/application_entity_service.rb +113 -0
- data/lib/dcm4chee/services/content_edit_service.rb +37 -0
- data/lib/dcm4chee/services/file_system_management.rb +16 -0
- data/lib/dcm4chee/services/mbean.rb +11 -0
- data/lib/dcm4chee/services/move_scu_service.rb +54 -0
- data/lib/dcm4chee/version.rb +3 -0
- data/lib/tasks/dcm4chee_tasks.rake +4 -0
- metadata +241 -0
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
## Dcm4chee
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/menglifang/dcm4chee?branch=develop)](http://travis-ci.org/menglifang/dcm4chee)
|
4
|
+
[![Dependency Status](https://gemnasium.com/menglifang/dcm4chee.png)](https://gemnasium.com/menglifang/dcm4chee)
|
5
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/menglifang/dcm4chee)
|
6
|
+
|
7
|
+
dcm4chee is a [rails
|
8
|
+
engine](http://api.rubyonrails.org/classes/Rails/Engine.html)
|
9
|
+
which provides RESTful APIs for the most famous
|
10
|
+
[dcm4chee](http://www.dcm4che.org).
|
11
|
+
|
12
|
+
### Installation
|
13
|
+
|
14
|
+
The engine interfaces with the dcm4chee archive through Jolokia (http://www.jolokia.org/), which provides a JMX interface with JSON over HTTP. To install Jolokia, simply download the .war and drop it in your archive's /server/default/deploy directory.
|
15
|
+
|
16
|
+
Add the dcm4chee to your Gemfile.
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'dcm4chee'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then, run `bundle install` to install. That's it.
|
23
|
+
|
24
|
+
### Development
|
25
|
+
|
26
|
+
#### Check the docs
|
27
|
+
|
28
|
+
```bash
|
29
|
+
# Generated the docs
|
30
|
+
yardoc
|
31
|
+
|
32
|
+
# Start a web server for serving the docs
|
33
|
+
yard server
|
34
|
+
|
35
|
+
# Visit http://localhost:8808
|
36
|
+
```
|
37
|
+
|
38
|
+
#### Tests
|
39
|
+
|
40
|
+
```bash
|
41
|
+
bundle exec rspec
|
42
|
+
|
43
|
+
# Or
|
44
|
+
bundle exec rake spec
|
45
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class ApplicationEntitiesController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# List the application entities
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# # Request
|
12
|
+
# GET /api/application_entities HTTP/1.1
|
13
|
+
# Accept: application/vnd.menglifang.org; version=1
|
14
|
+
#
|
15
|
+
# # Response
|
16
|
+
# HTTP/1.1 200 OK
|
17
|
+
# {
|
18
|
+
# "application_entities": [{
|
19
|
+
# "id": ...,
|
20
|
+
# "title": ...,
|
21
|
+
# "host": ...,
|
22
|
+
# "port": ...,
|
23
|
+
# "cipher_suites": ...,
|
24
|
+
# "patient_id_issuer": ...,
|
25
|
+
# "accession_number_issuer": ...,
|
26
|
+
# "username": ...,
|
27
|
+
# "password": ...,
|
28
|
+
# "fs_group": ...,
|
29
|
+
# "group": ...,
|
30
|
+
# "description": ...,
|
31
|
+
# "wado_url": ...,
|
32
|
+
# "station_name": ...,
|
33
|
+
# "institution": ...,
|
34
|
+
# "department": ...,
|
35
|
+
# "installed": ...,
|
36
|
+
# "check_host": ...
|
37
|
+
# }, ...]
|
38
|
+
# }
|
39
|
+
def index
|
40
|
+
entities = Dcm4chee::ApplicationEntity.all(order: [:id.desc])
|
41
|
+
|
42
|
+
respond_with application_entities: entities
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create a new application entity
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# # Request
|
49
|
+
# POST /api/application_entities HTTP/1.1
|
50
|
+
# Accept: application/vnd.menglifang.org; version=1
|
51
|
+
# Content-Type: application/json
|
52
|
+
#
|
53
|
+
# {
|
54
|
+
# "application_entity": {
|
55
|
+
# "title": ...,
|
56
|
+
# "host": ...,
|
57
|
+
# "port": ...,
|
58
|
+
# "cipher_suites": ...,
|
59
|
+
# "patient_id_issuer": ...,
|
60
|
+
# "accession_number_issuer": ...,
|
61
|
+
# "username": ...,
|
62
|
+
# "password": ...,
|
63
|
+
# "fs_group": ...,
|
64
|
+
# "group": ...,
|
65
|
+
# "description": ...,
|
66
|
+
# "wado_url": ...,
|
67
|
+
# "station_name": ...,
|
68
|
+
# "institution": ...,
|
69
|
+
# "department": ...,
|
70
|
+
# "installed": ...
|
71
|
+
# }
|
72
|
+
# }
|
73
|
+
#
|
74
|
+
# # Response
|
75
|
+
# HTTP/1.1 201 Created
|
76
|
+
#
|
77
|
+
# {
|
78
|
+
# "id": ...,
|
79
|
+
# "title": ...,
|
80
|
+
# "host": ...,
|
81
|
+
# "port": ...,
|
82
|
+
# "cipher_suites": ...,
|
83
|
+
# "patient_id_issuer": ...,
|
84
|
+
# "accession_number_issuer": ...,
|
85
|
+
# "username": ...,
|
86
|
+
# "password": ...,
|
87
|
+
# "fs_group": ...,
|
88
|
+
# "group": ...,
|
89
|
+
# "description": ...,
|
90
|
+
# "wado_url": ...,
|
91
|
+
# "station_name": ...,
|
92
|
+
# "institution": ...,
|
93
|
+
# "department": ...,
|
94
|
+
# "installed": ...
|
95
|
+
# }
|
96
|
+
def create
|
97
|
+
entity = Dcm4chee::ApplicationEntity.create_by_service(params[:application_entity])
|
98
|
+
|
99
|
+
render json: entity, status: :created
|
100
|
+
end
|
101
|
+
|
102
|
+
# Update an application entity
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# # Request
|
106
|
+
# PUT /api/application_entities/... HTTP/1.1
|
107
|
+
# Accept: application/vnd.menglifang.org; version=1
|
108
|
+
# Content-Type: application/json
|
109
|
+
#
|
110
|
+
# {
|
111
|
+
# "application_entity": {
|
112
|
+
# "title": ...,
|
113
|
+
# "host": ...,
|
114
|
+
# "port": ...,
|
115
|
+
# "cipher_suites": ...,
|
116
|
+
# "patient_id_issuer": ...,
|
117
|
+
# "accession_number_issuer": ...,
|
118
|
+
# "username": ...,
|
119
|
+
# "password": ...,
|
120
|
+
# "fs_group": ...,
|
121
|
+
# "group": ...,
|
122
|
+
# "description": ...,
|
123
|
+
# "wado_url": ...,
|
124
|
+
# "station_name": ...,
|
125
|
+
# "institution": ...,
|
126
|
+
# "department": ...,
|
127
|
+
# "installed": ...
|
128
|
+
# }
|
129
|
+
# }
|
130
|
+
#
|
131
|
+
# # Response
|
132
|
+
# HTTP/1.1 200 OK
|
133
|
+
#
|
134
|
+
# {
|
135
|
+
# "id": ...,
|
136
|
+
# "title": ...,
|
137
|
+
# "host": ...,
|
138
|
+
# "port": ...,
|
139
|
+
# "cipher_suites": ...,
|
140
|
+
# "patient_id_issuer": ...,
|
141
|
+
# "accession_number_issuer": ...,
|
142
|
+
# "username": ...,
|
143
|
+
# "password": ...,
|
144
|
+
# "fs_group": ...,
|
145
|
+
# "group": ...,
|
146
|
+
# "description": ...,
|
147
|
+
# "wado_url": ...,
|
148
|
+
# "station_name": ...,
|
149
|
+
# "institution": ...,
|
150
|
+
# "department": ...,
|
151
|
+
# "installed": ...
|
152
|
+
# }
|
153
|
+
def update
|
154
|
+
entity = Dcm4chee::ApplicationEntity.get!(params[:id])
|
155
|
+
entity.update_by_service(params[:application_entity])
|
156
|
+
|
157
|
+
render json: entity, status: :ok
|
158
|
+
end
|
159
|
+
|
160
|
+
# Delete an application entity
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# # Request
|
164
|
+
# DELETE /api/application_entities/... HTTP/1.1
|
165
|
+
# Accept: application/vnd.menglifang.org; version=1
|
166
|
+
#
|
167
|
+
# # Response
|
168
|
+
# HTTP/1.1 200 OK
|
169
|
+
def destroy
|
170
|
+
entity = Dcm4chee::ApplicationEntity.get!(params[:id])
|
171
|
+
entity.destroy_by_service
|
172
|
+
|
173
|
+
head :ok
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class DicomObjectsController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Move dicom objects
|
9
|
+
#
|
10
|
+
# Arguments:
|
11
|
+
# destination_aet: The application entity which the dicom objects will be moved to.
|
12
|
+
# study_iuids: The studies will be moved.
|
13
|
+
# series_iuids: The series will be moved.
|
14
|
+
# instance_iuids: The instances will be moved.
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# # Request
|
18
|
+
# POST /api/dicom_objects/move HTTP/1.1
|
19
|
+
# Accept: application/vnd.menglifang.org; version=1
|
20
|
+
#
|
21
|
+
# {
|
22
|
+
# "destination_aet": ...,
|
23
|
+
# "study_iuids": [...],
|
24
|
+
# "series_iuids": {
|
25
|
+
# "...": [...],
|
26
|
+
# ...
|
27
|
+
# },
|
28
|
+
# "instance_iuids": {
|
29
|
+
# "...": {
|
30
|
+
# "...": [...],
|
31
|
+
# ...
|
32
|
+
# },
|
33
|
+
# ...
|
34
|
+
# }
|
35
|
+
# }
|
36
|
+
#
|
37
|
+
# # Response
|
38
|
+
# HTTP/1.1 200 OK
|
39
|
+
def move
|
40
|
+
dicom_object_manager.move(
|
41
|
+
params[:destination_aet],
|
42
|
+
params[:study_iuids],
|
43
|
+
params[:series_iuids],
|
44
|
+
params[:instance_iuids]
|
45
|
+
)
|
46
|
+
|
47
|
+
head :ok
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def dicom_object_manager
|
53
|
+
@manager ||= DicomObjectManager.new
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class FileSystemsController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# List the file systems including the status of them.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# # Request
|
12
|
+
# GET /api/file_systems HTTP/1.1
|
13
|
+
# Accept: application/vnd.menglifang.org; version=1
|
14
|
+
#
|
15
|
+
# # 响应
|
16
|
+
# HTTP/1.1 200 OK
|
17
|
+
# {
|
18
|
+
# "file_systems": [{
|
19
|
+
# "id": ...,
|
20
|
+
# "path": ...,
|
21
|
+
# "total_space": ...,
|
22
|
+
# "free_space": ...,
|
23
|
+
# "used_space": ...,
|
24
|
+
# "min_free_space": ...,
|
25
|
+
# "expected_space_per_day": ...,
|
26
|
+
# "remaining_days": ...
|
27
|
+
# }, ...]
|
28
|
+
# }
|
29
|
+
def index
|
30
|
+
file_systems = FileSystem.online
|
31
|
+
|
32
|
+
respond_with file_systems: file_systems
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class InstancesController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Search for instances. Supported querying conditions:
|
9
|
+
# series_id ID of a series
|
10
|
+
#
|
11
|
+
# Check {DataMapper::Searcher::ClassMethods} for supported
|
12
|
+
# querying operators.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# # Request
|
16
|
+
# GET /api/instances?q[series_id]=... HTTP/1.1
|
17
|
+
# Accept: application/vnd.menglifang.org; version=1
|
18
|
+
#
|
19
|
+
# # Response
|
20
|
+
# HTTP/1.1 200 OK
|
21
|
+
# {
|
22
|
+
# "instances": [{
|
23
|
+
# "id": ...,
|
24
|
+
# "series_id": ...,
|
25
|
+
# "created_at": ...,
|
26
|
+
# "instance_no": ...,
|
27
|
+
# "sop_cuid": ...,
|
28
|
+
# "sop_iuid": ...,
|
29
|
+
# "series_iuid": ...,
|
30
|
+
# "study_iuid": ...,
|
31
|
+
# "availability": ...,
|
32
|
+
# "dcm_elements": [{
|
33
|
+
# "name": ...,
|
34
|
+
# "value": ...,
|
35
|
+
# "tag": ...,
|
36
|
+
# "value_representation": ...,
|
37
|
+
# "length": ...
|
38
|
+
# }, ...]
|
39
|
+
# }, ...]
|
40
|
+
# }
|
41
|
+
def index
|
42
|
+
instances = Instance.search(params[:q])
|
43
|
+
|
44
|
+
respond_with instances: instances
|
45
|
+
end
|
46
|
+
|
47
|
+
# Restore an instance from the trash.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# # Request
|
51
|
+
# POST /api/instances HTTP/1.1
|
52
|
+
# Accept: application/vnd.menglifang.org; version=1
|
53
|
+
# Content-Type: application/json
|
54
|
+
#
|
55
|
+
# { "trashed_instance_id": ... }
|
56
|
+
#
|
57
|
+
# # Response
|
58
|
+
# HTTP/1.1 201 Created
|
59
|
+
def create
|
60
|
+
trashed_instance = TrashedInstance.get!(params[:trashed_instance_id])
|
61
|
+
trashed_instance.restore_from_trash
|
62
|
+
|
63
|
+
head :created
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Dcm4chee
|
2
|
+
module Api
|
3
|
+
module V1
|
4
|
+
class ModalitiesController < BaseController
|
5
|
+
respond_to :json
|
6
|
+
|
7
|
+
# List modalities
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# # Request
|
11
|
+
# GET /api/modalities HTTP/1.1
|
12
|
+
# Accept: application/vnd.menglifang.org; version=1
|
13
|
+
#
|
14
|
+
# # Response
|
15
|
+
# HTTP/1.1 200 OK
|
16
|
+
# {
|
17
|
+
# "modalities": [{
|
18
|
+
# "name": ...
|
19
|
+
# }, ...]
|
20
|
+
# }
|
21
|
+
def index
|
22
|
+
modalities = Modality.all
|
23
|
+
|
24
|
+
render json: { modalities: modalities }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|