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
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class PatientsController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Search for patients. Supported querying conditions:
|
9
|
+
# name
|
10
|
+
# pid
|
11
|
+
# pid_issuer
|
12
|
+
# studies.study_at
|
13
|
+
# studies.accession_no
|
14
|
+
# studies.series.modality
|
15
|
+
# studies.series.source_aet
|
16
|
+
#
|
17
|
+
# Check {DataMapper::Searcher::ClassMethods} for supported
|
18
|
+
# querying operators.
|
19
|
+
#
|
20
|
+
# pagination:
|
21
|
+
# page # default 1
|
22
|
+
# limit # default 20
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# # Request
|
26
|
+
# GET /api/patients?q[name.like]=... HTTP/1.1
|
27
|
+
# Accept: application/vnd.menglifang.org; version=1
|
28
|
+
#
|
29
|
+
# # Response
|
30
|
+
# HTTP/1.1 200 OK
|
31
|
+
# {
|
32
|
+
# "page": ...,
|
33
|
+
# "limit": ...,
|
34
|
+
# "patients": [{
|
35
|
+
# "id": ...,
|
36
|
+
# "pid": ...,
|
37
|
+
# "pid_issuer": ...,
|
38
|
+
# "name": ...,
|
39
|
+
# "birthday": ...,
|
40
|
+
# "gender": ...,
|
41
|
+
# "dcm_elements": [{
|
42
|
+
# "name": ...,
|
43
|
+
# "value": ...,
|
44
|
+
# "tag": ...,
|
45
|
+
# "value_representation": ...,
|
46
|
+
# "length": ...
|
47
|
+
# }, ...]
|
48
|
+
# }, ...]
|
49
|
+
# }
|
50
|
+
def index
|
51
|
+
patients = Patient.search(params[:q]).
|
52
|
+
page(params[:page] || 1, per_page: params[:limit] || 20)
|
53
|
+
|
54
|
+
render json: { patients: patients, total: patients.pager.total }
|
55
|
+
end
|
56
|
+
|
57
|
+
# Restore a patient from the trash.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# # Request
|
61
|
+
# POST /api/patients HTTP/1.1
|
62
|
+
# Accept: application/vnd.menglifang.org; version=1
|
63
|
+
#
|
64
|
+
# { "trashed_patient_id": ... }
|
65
|
+
#
|
66
|
+
# # Response
|
67
|
+
# HTTP/1.1 201 Created
|
68
|
+
def create
|
69
|
+
trashed_patient = TrashedPatient.get!(params[:trashed_patient_id])
|
70
|
+
trashed_patient.restore_from_trash
|
71
|
+
|
72
|
+
head :created
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class SeriesController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Search for series. Supported querying conditions:
|
9
|
+
# study_id
|
10
|
+
#
|
11
|
+
# Check {DataMapper::Searcher::ClassMethods} for supported
|
12
|
+
# querying operators.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# # Request
|
16
|
+
# GET /api/series?q[study_id]=... HTTP/1.1
|
17
|
+
# Accept: application/vnd.menglifang.org; version=1
|
18
|
+
#
|
19
|
+
# # Response
|
20
|
+
# HTTP/1.1 200 OK
|
21
|
+
# {
|
22
|
+
# "series": [{
|
23
|
+
# "id": ...,
|
24
|
+
# "study_id": ...,
|
25
|
+
# "study_iuid": ...,
|
26
|
+
# "series_iuid": ...,
|
27
|
+
# "series_no": ...,
|
28
|
+
# "source_aet": ...,
|
29
|
+
# "modality": ...,
|
30
|
+
# "description": ...,
|
31
|
+
# "num_instances": ...,
|
32
|
+
# "availability": ...,
|
33
|
+
# "dcm_elements": [{
|
34
|
+
# "name": ...,
|
35
|
+
# "value": ...,
|
36
|
+
# "tag": ...,
|
37
|
+
# "value_representation": ...,
|
38
|
+
# "length": ...
|
39
|
+
# }, ...]
|
40
|
+
# }, ...]
|
41
|
+
# }
|
42
|
+
def index
|
43
|
+
series = Series.search(params[:q])
|
44
|
+
|
45
|
+
respond_with series: series
|
46
|
+
end
|
47
|
+
|
48
|
+
# Restore a series from the trash.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# # Request
|
52
|
+
# POST /api/series HTTP/1.1
|
53
|
+
# Accept: application/vnd.menglifang.org; version=1
|
54
|
+
# Content-Type: application/json
|
55
|
+
#
|
56
|
+
# { "trashed_series_id": ... }
|
57
|
+
#
|
58
|
+
# # Response
|
59
|
+
# HTTP/1.1 201 Created
|
60
|
+
def create
|
61
|
+
trashed_series = TrashedSeries.get!(params[:trashed_series_id])
|
62
|
+
trashed_series.restore_from_trash
|
63
|
+
|
64
|
+
head :created
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Dcm4chee
|
2
|
+
module Api
|
3
|
+
module V1
|
4
|
+
class SourceAetsController < BaseController
|
5
|
+
respond_to :json
|
6
|
+
|
7
|
+
# List AET
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# # Request
|
11
|
+
# GET /api/source_aets HTTP/1.1
|
12
|
+
# Accept: application/vnd.menglifang.org; version=1
|
13
|
+
#
|
14
|
+
# # Response
|
15
|
+
# HTTP/1.1 200 OK
|
16
|
+
# {
|
17
|
+
# "source_aets": [{
|
18
|
+
# "name": ...
|
19
|
+
# }, ...]
|
20
|
+
# }
|
21
|
+
def index
|
22
|
+
source_aets = SourceAet.all
|
23
|
+
|
24
|
+
render json: { source_aets: source_aets }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class StudiesController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Search for studies. Suppported querying conditions:
|
9
|
+
# patient_id
|
10
|
+
#
|
11
|
+
# Check {DataMapper::Searcher::ClassMethods} for supported
|
12
|
+
# querying operators.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# # Request
|
16
|
+
# GET /api/studies?q[patient_id]=... HTTP/1.1
|
17
|
+
# Accept: application/vnd.menglifang.org; version=1
|
18
|
+
#
|
19
|
+
# # Response
|
20
|
+
# HTTP/1.1 200 OK
|
21
|
+
# {
|
22
|
+
# "studies": [{
|
23
|
+
# "id": ...,
|
24
|
+
# "patient_id": ...,
|
25
|
+
# "study_iuid": ...,
|
26
|
+
# "sid": ...,
|
27
|
+
# "study_at": ...,
|
28
|
+
# "accession_no": ...,
|
29
|
+
# "description": ...,
|
30
|
+
# "num_series": ...,
|
31
|
+
# "num_instances": ...,
|
32
|
+
# "availability": ...,
|
33
|
+
# "dcm_elements": [{
|
34
|
+
# "name": ...,
|
35
|
+
# "value": ...,
|
36
|
+
# "tag": ...,
|
37
|
+
# "value_representation": ...,
|
38
|
+
# "length": ...
|
39
|
+
# }, ...]
|
40
|
+
# }, ...]
|
41
|
+
# }
|
42
|
+
def index
|
43
|
+
studies = Study.search(params[:q])
|
44
|
+
|
45
|
+
respond_with studies: studies
|
46
|
+
end
|
47
|
+
|
48
|
+
# Restore a study from the trash.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# # Request
|
52
|
+
# POST /api/studies HTTP/1.1
|
53
|
+
# Accept: application/vnd.menglifang.org; version=1
|
54
|
+
# Content-Type: application/json
|
55
|
+
#
|
56
|
+
# { "trashed_studies_id": ... }
|
57
|
+
#
|
58
|
+
# # Response
|
59
|
+
# HTTP/1.1 201 Created
|
60
|
+
def create
|
61
|
+
trashed_studies = TrashedStudy.get!(params[:trashed_study_id])
|
62
|
+
trashed_studies.restore_from_trash
|
63
|
+
|
64
|
+
head :created
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class TrashedInstancesController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Search for instances from the trash. Supported querying
|
9
|
+
# conditions:
|
10
|
+
# trashed_series_id
|
11
|
+
#
|
12
|
+
# Check {DataMapper::Searcher::ClassMethods} for supported
|
13
|
+
# querying operators.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# # Request
|
17
|
+
# GET /api/trashed_instances?q[trashed_series_id]=... HTTP/1.1
|
18
|
+
# Accept: application/vnd.menglifang.org; version=1
|
19
|
+
#
|
20
|
+
# # Response
|
21
|
+
# HTTP/1.1 200 OK
|
22
|
+
# {
|
23
|
+
# "trashed_instances": [{
|
24
|
+
# "id": ...,
|
25
|
+
# "trashed_series_id": ...,
|
26
|
+
# "created_at": ...,
|
27
|
+
# "sop_iuid": ...,
|
28
|
+
# "series_iuid": ...,
|
29
|
+
# "study_iuid": ...,
|
30
|
+
# "dcm_elements": [{
|
31
|
+
# "name": ...,
|
32
|
+
# "value": ...,
|
33
|
+
# "tag": ...,
|
34
|
+
# "value_representation": ...,
|
35
|
+
# "length": ...
|
36
|
+
# }, ...]
|
37
|
+
# }, ...]
|
38
|
+
# }
|
39
|
+
def index
|
40
|
+
instances = TrashedInstance.search(params[:q])
|
41
|
+
|
42
|
+
respond_with trashed_instances: instances
|
43
|
+
end
|
44
|
+
|
45
|
+
# Move a instance to the trash.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# # Request
|
49
|
+
# POST /api/trashed_instances HTTP/1.1
|
50
|
+
# Accept: application/vnd.menglifang.org; version=1
|
51
|
+
# Content-Type: application/json
|
52
|
+
#
|
53
|
+
# { "instance_id": ... }
|
54
|
+
#
|
55
|
+
# # Response
|
56
|
+
# HTTP/1.1 201 Created
|
57
|
+
def create
|
58
|
+
instance = Instance.get!(params[:instance_id])
|
59
|
+
instance.move_to_trash
|
60
|
+
|
61
|
+
head :created
|
62
|
+
end
|
63
|
+
|
64
|
+
# Delete an instance from the trash.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# # Request
|
68
|
+
# DELETE /api/trashed_instances/... HTTP/1.1
|
69
|
+
# Accept: application/vnd.menglifang.org; version=1
|
70
|
+
#
|
71
|
+
# # Response
|
72
|
+
# HTTP/1.1 200 OK
|
73
|
+
def destroy
|
74
|
+
instance = TrashedInstance.get!(params[:id])
|
75
|
+
instance.remove_from_trash
|
76
|
+
|
77
|
+
head :ok
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class TrashedPatientsController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Search for patients from the trash. Supported querying
|
9
|
+
# conditions:
|
10
|
+
# name
|
11
|
+
# pid
|
12
|
+
# pid_issuer
|
13
|
+
# trashed_studies.accession_no
|
14
|
+
# trashed_studies.series.source_aet
|
15
|
+
#
|
16
|
+
# Check {DataMapper::Searcher::ClassMethods} for supported
|
17
|
+
# querying operators.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# # Request
|
21
|
+
# GET /api/trashed_patients?q[name.like]=... HTTP/1.1
|
22
|
+
# Accept: application/vnd.menglifang.org; version=1
|
23
|
+
#
|
24
|
+
# # Response
|
25
|
+
# HTTP/1.1 200 OK
|
26
|
+
# {
|
27
|
+
# "trashed_patients": [{
|
28
|
+
# "id": ...,
|
29
|
+
# "pid": ...,
|
30
|
+
# "pid_issuer": ...,
|
31
|
+
# "name": ...,
|
32
|
+
# "dcm_elements": [{
|
33
|
+
# "name": ...,
|
34
|
+
# "value": ...,
|
35
|
+
# "tag": ...,
|
36
|
+
# "value_representation": ...,
|
37
|
+
# "length": ...
|
38
|
+
# }, ...]
|
39
|
+
# }, ...]
|
40
|
+
# }
|
41
|
+
def index
|
42
|
+
patients = TrashedPatient.search(params[:q])
|
43
|
+
|
44
|
+
respond_with trashed_patients: patients
|
45
|
+
end
|
46
|
+
|
47
|
+
# Move a patient to the trash including the related studies, series, instances and files.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# # Request
|
51
|
+
# POST /api/trashed_patients HTTP/1.1
|
52
|
+
# Accept: application/vnd.menglifang.org; version=1
|
53
|
+
# Content-Type: application/json
|
54
|
+
#
|
55
|
+
# { "patient_id": ... }
|
56
|
+
#
|
57
|
+
# # Response
|
58
|
+
# HTTP/1.1 201 Created
|
59
|
+
def create
|
60
|
+
patient = Patient.get!(params[:patient_id])
|
61
|
+
patient.move_to_trash
|
62
|
+
|
63
|
+
head :created
|
64
|
+
end
|
65
|
+
|
66
|
+
# Delete a patient from the trash.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# # Request
|
70
|
+
# DELETE /api/trashed_patients/... HTTP/1.1
|
71
|
+
# Accept: application/vnd.menglifang.org; version=1
|
72
|
+
#
|
73
|
+
# # Response
|
74
|
+
# HTTP/1.1 200 OK
|
75
|
+
def destroy
|
76
|
+
patient = TrashedPatient.get!(params[:id])
|
77
|
+
patient.remove_from_trash
|
78
|
+
|
79
|
+
head :ok
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Dcm4chee
|
3
|
+
module Api
|
4
|
+
module V1
|
5
|
+
class TrashedSeriesController < BaseController
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# Search for series from the trash. Supported querying
|
9
|
+
# conditions:
|
10
|
+
# trashed_study_id
|
11
|
+
#
|
12
|
+
# Check {DataMapper::Searcher::ClassMethods} for supported
|
13
|
+
# querying operators.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# # Request
|
17
|
+
# GET /api/trashed_series?q[trashed_study_id]=... HTTP/1.1
|
18
|
+
# Accept: application/vnd.menglifang.org; version=1
|
19
|
+
#
|
20
|
+
# # Response
|
21
|
+
# HTTP/1.1 200 OK
|
22
|
+
# {
|
23
|
+
# "trashed_series": [{
|
24
|
+
# "id": ...,
|
25
|
+
# "trashed_study_id": ...,
|
26
|
+
# "series_iuid": ...,
|
27
|
+
# "source_aet": ...,
|
28
|
+
# "dcm_elements": [{
|
29
|
+
# "name": ...,
|
30
|
+
# "value": ...,
|
31
|
+
# "tag": ...,
|
32
|
+
# "value_representation": ...,
|
33
|
+
# "length": ...
|
34
|
+
# }, ...]
|
35
|
+
# }, ...]
|
36
|
+
# }
|
37
|
+
def index
|
38
|
+
series = TrashedSeries.search(params[:q])
|
39
|
+
|
40
|
+
respond_with trashed_series: series
|
41
|
+
end
|
42
|
+
|
43
|
+
# Move a series to the trash including the related instances and
|
44
|
+
# files.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# # Request
|
48
|
+
# POST /api/trashed_series HTTP/1.1
|
49
|
+
# Accept: application/vnd.menglifang.org; version=1
|
50
|
+
# Content-Type: application/json
|
51
|
+
#
|
52
|
+
# { "series_id": ... }
|
53
|
+
#
|
54
|
+
# # Response
|
55
|
+
# HTTP/1.1 201 Created
|
56
|
+
def create
|
57
|
+
series = Series.get!(params[:series_id])
|
58
|
+
series.move_to_trash
|
59
|
+
|
60
|
+
head :created
|
61
|
+
end
|
62
|
+
|
63
|
+
# Delete a series from the trash.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# # Request
|
67
|
+
# DELETE /api/trashed_series/... HTTP/1.1
|
68
|
+
# Accept: application/vnd.menglifang.org; version=1
|
69
|
+
#
|
70
|
+
# # Response
|
71
|
+
# HTTP/1.1 200 OK
|
72
|
+
def destroy
|
73
|
+
series = TrashedSeries.get!(params[:id])
|
74
|
+
series.remove_from_trash
|
75
|
+
|
76
|
+
head :ok
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|