1
1
2
- function setupDicomForm ( patientDict , callback ) {
2
+ function setupDicomForm ( patients , callback ) {
3
3
const patientSelect = document . getElementById ( "patientSelect" )
4
4
const studySelect = document . getElementById ( "studySelect" )
5
5
const serieSelect = document . getElementById ( "serieSelect" )
6
6
7
7
// Remove options
8
- var patients = [ ]
9
- var studies = [ ]
10
- var series = [ ]
8
+ var patientList = [ ]
9
+ var studyList = [ ]
10
+ var serieList = [ ]
11
11
patientSelect . length = 1 ;
12
12
13
13
// Add patients
14
- for ( const key in patientDict ) {
15
- const patient = patientDict [ key ]
16
- patients . push ( patient )
17
- const value = patient . patientName + " - " + patient . patientDateOfBirth
14
+ for ( const key in patients ) {
15
+ const patient = patients [ key ]
16
+ patientList . push ( patient )
17
+ const value = patient . metaData . PatientName + " - " + patient . metaData . PatientBirthDate
18
18
patientSelect . options [ patientSelect . options . length ] = new Option ( value , value ) ;
19
19
}
20
20
21
21
patientSelect . onchange = function ( ) {
22
22
// Remove options
23
- studies = [ ]
24
- series = [ ]
23
+ studyList = [ ]
24
+ serieList = [ ]
25
25
studySelect . length = 1 ;
26
26
serieSelect . length = 1 ;
27
27
28
28
if ( this . selectedIndex < 1 ) return ; // done
29
29
30
30
// Add underneath studies
31
31
const patientId = this . selectedIndex - 1
32
- const patient = patients [ patientId ]
33
- for ( const key in patient . studyDict ) {
34
- const study = patient . studyDict [ key ]
35
- studies . push ( study )
36
- const value = study . studyDescription + " - " + study . studyDate
32
+ const patient = patientList [ patientId ]
33
+ for ( const key in patient . studies ) {
34
+ const study = patient . studies [ key ]
35
+ studyList . push ( study )
36
+ const value = study . metaData . StudyDescription + " - " + study . metaData . StudyDate
37
37
studySelect . options [ studySelect . options . length ] = new Option ( value , value ) ;
38
38
}
39
39
}
40
40
patientSelect . onchange ( ) ; // reset in case page is reloaded
41
41
42
42
studySelect . onchange = function ( ) {
43
43
// Remove options
44
- series = [ ]
44
+ serieList = [ ]
45
45
serieSelect . length = 1 ;
46
46
47
47
if ( this . selectedIndex < 1 ) return ; // done
48
48
49
49
// Add underneath series
50
50
const studyId = this . selectedIndex - 1
51
- const study = studies [ studyId ]
52
- for ( const key in study . serieDict ) {
53
- const serie = study . serieDict [ key ]
54
- series . push ( serie )
55
- const value = serie . seriesDescription + " - " + serie . seriesModality
51
+ const study = studyList [ studyId ]
52
+ for ( const key in study . series ) {
53
+ const serie = study . series [ key ]
54
+ serieList . push ( serie )
55
+ const value = serie . metaData . SeriesDescription + " - " + serie . metaData . Modality
56
56
serieSelect . options [ serieSelect . options . length ] = new Option ( value , value ) ;
57
57
}
58
58
}
@@ -62,8 +62,9 @@ function setupDicomForm(patientDict, callback) {
62
62
63
63
// Return files for serie
64
64
const serieId = this . selectedIndex - 1
65
- const serie = series [ serieId ]
66
- callback ( serie . files )
65
+ const serie = serieList [ serieId ]
66
+ const files = Object . values ( serie . images ) . map ( ( image ) => image . file )
67
+ callback ( files )
67
68
}
68
69
}
69
70
0 commit comments