@@ -334,7 +334,7 @@ private void SelectPlan_Click(object sender, RoutedEventArgs e)
334334 foreach ( var img in MainStructureSet . Image . Series . Study . Images3D )
335335 {
336336 //We do not want to calculate on a MIP
337- if ( img . Series . Comment . ToString ( ) . ToUpper ( ) . Contains ( "MIP" ) || img . Series . Id . ToUpper ( ) . Contains ( "MIP" ) )
337+ if ( img . Series . Comment . ToString ( ) . ToUpper ( ) . Contains ( "MIP" ) || img . Id . ToUpper ( ) . Contains ( "MIP" ) )
338338 {
339339 continue ;
340340 }
@@ -508,96 +508,6 @@ private void SelectPlan_Click(object sender, RoutedEventArgs e)
508508 Errors_txt . Text = errormessages ;
509509 }
510510
511- /// <summary>
512- /// The plans are copied to the phases and new buttons are enabled.
513- /// The copy process depends on the plan type.
514- /// </summary>
515- private void CopyPlan_btn_Click ( object sender , RoutedEventArgs e )
516- {
517- ScriptInfo . Patient . BeginModifications ( ) ;
518-
519- string [ ] body = new string [ 10 ] ;
520- string [ ] calib = new string [ 10 ] ;
521- string [ ] overwrite = new string [ 10 ] ;
522-
523- VMS . TPS . Common . Model . API . Image [ ] imageList = new VMS . TPS . Common . Model . API . Image [ 10 ] { img00 , img10 , img20 , img30 , img40 , img50 , img60 , img70 , img80 , img90 } ;
524-
525- AdjustPhaseImages adjustPhaseImages = new AdjustPhaseImages ( imageList , ScriptInfo , MainStructureSet ) ;
526-
527- if ( body_chb . IsChecked == true )
528- {
529- progress_lb . Content = "... creating structure sets and BODY ..." ;
530- AllowUIToUpdate ( ) ;
531-
532- body = adjustPhaseImages . CreateBody ( ) ;
533- }
534-
535- if ( copybody_chb . IsChecked == true )
536- {
537- progress_lb . Content = "... copying BODY ..." ;
538- AllowUIToUpdate ( ) ;
539-
540- body = adjustPhaseImages . CopyBody ( ) ;
541- }
542-
543- if ( calib_chb . IsChecked == true )
544- {
545- progress_lb . Content = "... Setting calibration curves ..." ;
546- AllowUIToUpdate ( ) ;
547- calib = adjustPhaseImages . CopyCalibration ( ) ;
548- }
549-
550- if ( overw_chb . IsChecked == true )
551- {
552- progress_lb . Content = "... Copying and overwriting structures ..." ;
553- AllowUIToUpdate ( ) ;
554- overwrite = adjustPhaseImages . OverwriteStructures ( ) ;
555- }
556-
557- for ( int i = 0 ; i < 10 ; i ++ )
558- {
559- if ( body [ i ] != "" || calib [ i ] != "" || overwrite [ i ] != "" )
560- {
561- errormessages += " PHASE " + i . ToString ( ) + " : \n " ;
562- errormessages += body [ i ] ;
563- errormessages += calib [ i ] ;
564- errormessages += overwrite [ i ] ;
565- }
566- }
567-
568- Errors_txt . Text = errormessages ;
569-
570- if ( SelectedPlan != null && SelectedPlan . PlanType . ToString ( ) . Contains ( "Proton" ) ) //single plan and proton plan
571- {
572- progress_lb . Content = "... Copying proton plans ..." ;
573- AllowUIToUpdate ( ) ;
574- CopyProtons ( ) ;
575- }
576- else if ( SelectedPlan != null ) // single plan and photon plan
577- {
578- progress_lb . Content = "... Copying photon plans ..." ;
579- AllowUIToUpdate ( ) ;
580- CopyPhotons ( ) ;
581- }
582- if ( SelectedPlanSum != null && SelectedPlanSum . PlanSetups . First ( ) . PlanType . ToString ( ) . Contains ( "Proton" ) ) //Sum plan and proton plan
583- {
584- progress_lb . Content = "... Copying proton sum plans ..." ;
585- AllowUIToUpdate ( ) ;
586- CopyProtonsSum ( ) ;
587- }
588- else if ( SelectedPlanSum != null ) //Sum plan and photon plan
589- {
590- progress_lb . Content = "... Copying photon sum plans ..." ;
591- AllowUIToUpdate ( ) ;
592- CopyPhotonsSum ( ) ;
593- }
594-
595- // The evaluation button is pressed automatically in this case.
596- EvalDoseE_btn . RaiseEvent ( new RoutedEventArgs ( ButtonBase . ClickEvent ) ) ;
597- EvalDoseE_btn . IsEnabled = true ;
598- Errors_txt . Text = errormessages ;
599- }
600-
601511 #endregion SelectPlans
602512
603513 #region FindAndSelectImages
@@ -880,6 +790,99 @@ private void SelectImages(bool writeYN)
880790
881791 #endregion FindAndSelectImages
882792
793+ #region AdjustImages
794+ /// <summary>
795+ /// The plans are copied to the phases and new buttons are enabled.
796+ /// The copy process depends on the plan type.
797+ /// </summary>
798+ private void CopyPlan_btn_Click ( object sender , RoutedEventArgs e )
799+ {
800+ ScriptInfo . Patient . BeginModifications ( ) ;
801+
802+ string [ ] body = new string [ 10 ] ;
803+ string [ ] calib = new string [ 10 ] ;
804+ string [ ] overwrite = new string [ 10 ] ;
805+
806+ VMS . TPS . Common . Model . API . Image [ ] imageList = new VMS . TPS . Common . Model . API . Image [ 10 ] { img00 , img10 , img20 , img30 , img40 , img50 , img60 , img70 , img80 , img90 } ;
807+
808+ AdjustPhaseImages adjustPhaseImages = new AdjustPhaseImages ( imageList , ScriptInfo , MainStructureSet ) ;
809+
810+ if ( body_chb . IsChecked == true )
811+ {
812+ progress_lb . Content = "... creating structure sets and BODY ..." ;
813+ AllowUIToUpdate ( ) ;
814+
815+ body = adjustPhaseImages . CreateBody ( ) ;
816+ }
817+
818+ if ( copybody_chb . IsChecked == true )
819+ {
820+ progress_lb . Content = "... copying BODY ..." ;
821+ AllowUIToUpdate ( ) ;
822+
823+ body = adjustPhaseImages . CopyBody ( ) ;
824+ }
825+
826+ if ( calib_chb . IsChecked == true )
827+ {
828+ progress_lb . Content = "... Setting calibration curves ..." ;
829+ AllowUIToUpdate ( ) ;
830+ calib = adjustPhaseImages . CopyCalibration ( ) ;
831+ }
832+
833+ if ( overw_chb . IsChecked == true )
834+ {
835+ progress_lb . Content = "... Copying and overwriting structures ..." ;
836+ AllowUIToUpdate ( ) ;
837+ overwrite = adjustPhaseImages . OverwriteStructures ( ) ;
838+ }
839+
840+ for ( int i = 0 ; i < 10 ; i ++ )
841+ {
842+ if ( body [ i ] != "" || calib [ i ] != "" || overwrite [ i ] != "" )
843+ {
844+ errormessages += " PHASE " + i . ToString ( ) + " : \n " ;
845+ errormessages += body [ i ] ;
846+ errormessages += calib [ i ] ;
847+ errormessages += overwrite [ i ] ;
848+ }
849+ }
850+
851+ Errors_txt . Text = errormessages ;
852+
853+ if ( SelectedPlan != null && SelectedPlan . PlanType . ToString ( ) . Contains ( "Proton" ) ) //single plan and proton plan
854+ {
855+ progress_lb . Content = "... Copying proton plans ..." ;
856+ AllowUIToUpdate ( ) ;
857+ CopyProtons ( ) ;
858+ }
859+ else if ( SelectedPlan != null ) // single plan and photon plan
860+ {
861+ progress_lb . Content = "... Copying photon plans ..." ;
862+ AllowUIToUpdate ( ) ;
863+ CopyPhotons ( ) ;
864+ }
865+ if ( SelectedPlanSum != null && SelectedPlanSum . PlanSetups . First ( ) . PlanType . ToString ( ) . Contains ( "Proton" ) ) //Sum plan and proton plan
866+ {
867+ progress_lb . Content = "... Copying proton sum plans ..." ;
868+ AllowUIToUpdate ( ) ;
869+ CopyProtonsSum ( ) ;
870+ }
871+ else if ( SelectedPlanSum != null ) //Sum plan and photon plan
872+ {
873+ progress_lb . Content = "... Copying photon sum plans ..." ;
874+ AllowUIToUpdate ( ) ;
875+ CopyPhotonsSum ( ) ;
876+ }
877+
878+ // The evaluation button is pressed automatically in this case.
879+ EvalDoseE_btn . RaiseEvent ( new RoutedEventArgs ( ButtonBase . ClickEvent ) ) ;
880+ EvalDoseE_btn . IsEnabled = true ;
881+ Errors_txt . Text = errormessages ;
882+ }
883+
884+ #endregion AdjustImages
885+
883886 #region CopyPhotonPlans
884887
885888 /// <summary>
@@ -913,57 +916,46 @@ private void CopyPhotonsSum()
913916 {
914917 var copyFrom = SelectedPlanSum . PlanSetups . ElementAt ( i ) ;
915918
916-
917- progress_lb . Content = "... Copying to phase 00 ..." ;
919+ progress_lb . Content = "... Copying to phase 00 for plan no. " + i . ToString ( ) + " ..." ;
918920 AllowUIToUpdate ( ) ;
919921 list0 . Add ( CalcPhoton ( img00 , rec_00 , ph_prefix + "00_" + i . ToString ( ) , copyFrom ) ) ;
920922
921-
922- progress_lb . Content = "... Copying to phase 10 ..." ;
923+ progress_lb . Content = "... Copying to phase 10 for plan no. " + i . ToString ( ) + " ..." ;
923924 AllowUIToUpdate ( ) ;
924925 list1 . Add ( CalcPhoton ( img10 , rec_10 , ph_prefix + "10_" + i . ToString ( ) , copyFrom ) ) ;
925926
926-
927- progress_lb . Content = "... Copying to phase 20 ..." ;
927+ progress_lb . Content = "... Copying to phase 20 for plan no. " + i . ToString ( ) + " ..." ;
928928 AllowUIToUpdate ( ) ;
929929 list2 . Add ( CalcPhoton ( img20 , rec_20 , ph_prefix + "20_" + i . ToString ( ) , copyFrom ) ) ;
930930
931-
932- progress_lb . Content = "... Copying to phase 30 ..." ;
931+ progress_lb . Content = "... Copying to phase 30 for plan no. " + i . ToString ( ) + " ..." ;
933932 AllowUIToUpdate ( ) ;
934933 list3 . Add ( CalcPhoton ( img30 , rec_30 , ph_prefix + "30_" + i . ToString ( ) , copyFrom ) ) ;
935934
936-
937- progress_lb . Content = "... Copying to phase 40 ..." ;
935+ progress_lb . Content = "... Copying to phase 40 for plan no. " + i . ToString ( ) + " ..." ;
938936 AllowUIToUpdate ( ) ;
939937 list4 . Add ( CalcPhoton ( img40 , rec_40 , ph_prefix + "40_" + i . ToString ( ) , copyFrom ) ) ;
940938
941-
942- progress_lb . Content = "... Copying to phase 50 ..." ;
939+ progress_lb . Content = "... Copying to phase 50 for plan no. " + i . ToString ( ) + " ..." ;
943940 AllowUIToUpdate ( ) ;
944941 list5 . Add ( CalcPhoton ( img50 , rec_50 , ph_prefix + "50_" + i . ToString ( ) , copyFrom ) ) ;
945942
946-
947- progress_lb . Content = "... Copying to phase 60 ..." ;
943+ progress_lb . Content = "... Copying to phase 60 for plan no. " + i . ToString ( ) + " ..." ;
948944 AllowUIToUpdate ( ) ;
949945 list6 . Add ( CalcPhoton ( img60 , rec_60 , ph_prefix + "60_" + i . ToString ( ) , copyFrom ) ) ;
950946
951-
952- progress_lb . Content = "... Copying to phase 70 ..." ;
947+ progress_lb . Content = "... Copying to phase 70 for plan no. " + i . ToString ( ) + " ..." ;
953948 AllowUIToUpdate ( ) ;
954949 list7 . Add ( CalcPhoton ( img70 , rec_70 , ph_prefix + "70_" + i . ToString ( ) , copyFrom ) ) ;
955950
956-
957- progress_lb . Content = "... Copying to phase 80 ..." ;
951+ progress_lb . Content = "... Copying to phase 80 for plan no. " + i . ToString ( ) + " ..." ;
958952 AllowUIToUpdate ( ) ;
959953 list8 . Add ( CalcPhoton ( img80 , rec_80 , ph_prefix + "80_" + i . ToString ( ) , copyFrom ) ) ;
960954
961-
962- progress_lb . Content = "... Copying to phase 90 ..." ;
955+ progress_lb . Content = "... Copying to phase 90 for plan no. " + i . ToString ( ) + " ..." ;
963956 AllowUIToUpdate ( ) ;
964957 list9 . Add ( CalcPhoton ( img90 , rec_90 , ph_prefix + "90_" + i . ToString ( ) , copyFrom ) ) ;
965958
966-
967959 progress_lb . Content = "...All plans are copied ..." ;
968960 AllowUIToUpdate ( ) ;
969961 }
@@ -1272,54 +1264,54 @@ private void CopyProtonsSum()
12721264 {
12731265 var copyFrom = SelectedPlanSum . PlanSetups . ElementAt ( i ) ;
12741266
1275- progress_lb . Content = "... Copying to phase 00 ..." ;
1267+ progress_lb . Content = "... Copying to phase 00 for plan no. " + i . ToString ( ) + " ...";
12761268 AllowUIToUpdate ( ) ;
12771269 list0 . Add ( CalcProton ( img00 , rec_00 , pro_prefix + "00_" + i . ToString ( ) , copyFrom ) ) ;
12781270
12791271
1280- progress_lb . Content = "... Copying to phase 10 ..." ;
1272+ progress_lb . Content = "... Copying to phase 10 for plan no. " + i . ToString ( ) + " ...";
12811273 AllowUIToUpdate ( ) ;
1282- list0 . Add ( CalcProton ( img10 , rec_10 , pro_prefix + "10_" + i . ToString ( ) , copyFrom ) ) ;
1274+ list1 . Add ( CalcProton ( img10 , rec_10 , pro_prefix + "10_" + i . ToString ( ) , copyFrom ) ) ;
12831275
12841276
1285- progress_lb . Content = "... Copying to phase 20 ..." ;
1277+ progress_lb . Content = "... Copying to phase 20 for plan no. " + i . ToString ( ) + " ...";
12861278 AllowUIToUpdate ( ) ;
1287- list0 . Add ( CalcProton ( img20 , rec_20 , pro_prefix + "20_" + i . ToString ( ) , copyFrom ) ) ;
1279+ list2 . Add ( CalcProton ( img20 , rec_20 , pro_prefix + "20_" + i . ToString ( ) , copyFrom ) ) ;
12881280
12891281
1290- progress_lb . Content = "... Copying to phase 30 ..." ;
1282+ progress_lb . Content = "... Copying to phase 30 for plan no. " + i . ToString ( ) + " ...";
12911283 AllowUIToUpdate ( ) ;
1292- list0 . Add ( CalcProton ( img30 , rec_30 , pro_prefix + "30_" + i . ToString ( ) , copyFrom ) ) ;
1284+ list3 . Add ( CalcProton ( img30 , rec_30 , pro_prefix + "30_" + i . ToString ( ) , copyFrom ) ) ;
12931285
12941286
1295- progress_lb . Content = "... Copying to phase 40 ..." ;
1287+ progress_lb . Content = "... Copying to phase 40 for plan no. " + i . ToString ( ) + " ...";
12961288 AllowUIToUpdate ( ) ;
1297- list0 . Add ( CalcProton ( img40 , rec_40 , pro_prefix + "40_" + i . ToString ( ) , copyFrom ) ) ;
1289+ list4 . Add ( CalcProton ( img40 , rec_40 , pro_prefix + "40_" + i . ToString ( ) , copyFrom ) ) ;
12981290
12991291
1300- progress_lb . Content = "... Copying to phase 50 ..." ;
1292+ progress_lb . Content = "... Copying to phase 50 for plan no. " + i . ToString ( ) + " ...";
13011293 AllowUIToUpdate ( ) ;
1302- list0 . Add ( CalcProton ( img50 , rec_50 , pro_prefix + "50_" + i . ToString ( ) , copyFrom ) ) ;
1294+ list5 . Add ( CalcProton ( img50 , rec_50 , pro_prefix + "50_" + i . ToString ( ) , copyFrom ) ) ;
13031295
13041296
1305- progress_lb . Content = "... Copying to phase 60 ..." ;
1297+ progress_lb . Content = "... Copying to phase 60 for plan no. " + i . ToString ( ) + " ...";
13061298 AllowUIToUpdate ( ) ;
1307- list0 . Add ( CalcProton ( img60 , rec_60 , pro_prefix + "60_" + i . ToString ( ) , copyFrom ) ) ;
1299+ list6 . Add ( CalcProton ( img60 , rec_60 , pro_prefix + "60_" + i . ToString ( ) , copyFrom ) ) ;
13081300
13091301
1310- progress_lb . Content = "... Copying to phase 70 ..." ;
1302+ progress_lb . Content = "... Copying to phase 70 for plan no. " + i . ToString ( ) + " ...";
13111303 AllowUIToUpdate ( ) ;
1312- list0 . Add ( CalcProton ( img70 , rec_70 , pro_prefix + "70_" + i . ToString ( ) , copyFrom ) ) ;
1304+ list7 . Add ( CalcProton ( img70 , rec_70 , pro_prefix + "70_" + i . ToString ( ) , copyFrom ) ) ;
13131305
13141306
1315- progress_lb . Content = "... Copying to phase 80 ..." ;
1307+ progress_lb . Content = "... Copying to phase 80 for plan no. " + i . ToString ( ) + " ...";
13161308 AllowUIToUpdate ( ) ;
1317- list0 . Add ( CalcProton ( img80 , rec_80 , pro_prefix + "80_" + i . ToString ( ) , copyFrom ) ) ;
1309+ list8 . Add ( CalcProton ( img80 , rec_80 , pro_prefix + "80_" + i . ToString ( ) , copyFrom ) ) ;
13181310
13191311
1320- progress_lb . Content = "... Copying to phase 90 ..." ;
1312+ progress_lb . Content = "... Copying to phase 90 for plan no. " + i . ToString ( ) + " ...";
13211313 AllowUIToUpdate ( ) ;
1322- list0 . Add ( CalcProton ( img90 , rec_90 , pro_prefix + "90_" + i . ToString ( ) , copyFrom ) ) ;
1314+ list9 . Add ( CalcProton ( img90 , rec_90 , pro_prefix + "90_" + i . ToString ( ) , copyFrom ) ) ;
13231315
13241316
13251317 progress_lb . Content = "...All plans are copied ..." ;
0 commit comments