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