11
2- function setupDicomForm ( patientDict , callback ) {
2+ function setupDicomForm ( patients , callback ) {
33 const patientSelect = document . getElementById ( "patientSelect" )
44 const studySelect = document . getElementById ( "studySelect" )
55 const serieSelect = document . getElementById ( "serieSelect" )
66
77 // Remove options
8- var patients = [ ]
9- var studies = [ ]
10- var series = [ ]
8+ var patientList = [ ]
9+ var studyList = [ ]
10+ var serieList = [ ]
1111 patientSelect . length = 1 ;
1212
1313 // 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
1818 patientSelect . options [ patientSelect . options . length ] = new Option ( value , value ) ;
1919 }
2020
2121 patientSelect . onchange = function ( ) {
2222 // Remove options
23- studies = [ ]
24- series = [ ]
23+ studyList = [ ]
24+ serieList = [ ]
2525 studySelect . length = 1 ;
2626 serieSelect . length = 1 ;
2727
2828 if ( this . selectedIndex < 1 ) return ; // done
2929
3030 // Add underneath studies
3131 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
3737 studySelect . options [ studySelect . options . length ] = new Option ( value , value ) ;
3838 }
3939 }
4040 patientSelect . onchange ( ) ; // reset in case page is reloaded
4141
4242 studySelect . onchange = function ( ) {
4343 // Remove options
44- series = [ ]
44+ serieList = [ ]
4545 serieSelect . length = 1 ;
4646
4747 if ( this . selectedIndex < 1 ) return ; // done
4848
4949 // Add underneath series
5050 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
5656 serieSelect . options [ serieSelect . options . length ] = new Option ( value , value ) ;
5757 }
5858 }
@@ -62,8 +62,9 @@ function setupDicomForm(patientDict, callback) {
6262
6363 // Return files for serie
6464 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 )
6768 }
6869}
6970
0 commit comments