-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUMMPPanelController.m
1906 lines (1580 loc) · 85.7 KB
/
UMMPPanelController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// UMMPPanelController.m
// UMMPerfusion
//
// Created by Marcel Reich on 04.10.11.
// Copyright (c) 2012, Marcel Reich & Sven Kaiser & Markus Daab & Patrick Schülein & Engin Aslan
// All rights reserved.
//
#import "UMMPPanelController.h"
#import "UMMPRoiList.h"
#import "UMMPPrefController.h"
#import "UMMPFastDeconvolutionController.h"
#import <OsiriXAPI/Notifications.h>
#import <OsiriXAPI/Wait.h>
#import <OsiriXAPI/ViewerController.h>
#import "DCMObject.h"
#import "DCMCalendarDate.h"
#import "DCMSequenceAttribute.h"
#import "DCMAttributeTag.h"
@implementation UMMPPanelController
BOOL pluginClose = true;
@synthesize viewerController;
@synthesize filter;
@synthesize algorithmController;
@synthesize userDefaults;
@synthesize prefController;
@synthesize mapSelectionPanelController;
@synthesize viewerList;
@synthesize cmControllerList;
@synthesize algorithmPopUpButton;
@synthesize time;
@synthesize dTime;
@synthesize isShuttleMode;
@synthesize roiList;
@synthesize chart;
@synthesize drawer;
@synthesize interpolation;
@synthesize deltaT;
@synthesize max;
@synthesize selectedArterialRoiTag;
@synthesize selectedVenousRoiTag;
@synthesize selectedTissueRoiTag;
@synthesize selectedPresetTag;
@synthesize algorithmIsChoosed;
@synthesize timeArray;
@synthesize dTimeArray;
#define _PLUGIN_VERSION_ @"v1.5.3.2"
#pragma mark -
#pragma mark init and dealloc
- (id)initWithFilter:(UMMPerfusionFilter*)aFilter andViewer:(ViewerController*)aViewerController
{
// opens the PlugIn only if the UMMPerfusion Panel is not already open
if (pluginClose) {
pluginClose = false;
currentPluginVersion = _PLUGIN_VERSION_;
filter = [aFilter retain];
viewerController = [aViewerController retain];
algorithmController = nil;
userDefaults = [[UMMPUserDefaults alloc] init];
cmControllerList = [[NSMutableArray alloc] init];
prefController = [[UMMPPrefController alloc] initWithPanelController:[self retain]];
selectedArterialRoiTag = -1;
selectedVenousRoiTag = -1;
selectedTissueRoiTag = -1;
selectedPresetTag = -1;
alreadyExported = NO;
self = [super initWithWindowNibName:@"UMMPPanel"];
//[self window];
NSString *name = [[[NSBundle bundleForClass:[self class]] infoDictionary] valueForKey:@"CFBundleName"];
NSString *version = [[[NSBundle bundleForClass:[self class]] infoDictionary] valueForKey:@"CFBundleShortVersionString"];
[[self window] setTitle:[NSString stringWithFormat:@"%@ %@", name, version]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setContent:) name:NSWindowWillCloseNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setContent:) name:OsirixCloseViewerNotification object:viewerController];
// Notification when the Panel is closed
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:nil];
// Sends a Notification to windowWillClose by clicking on Database in OsiriX
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewerWillClose:) name:OsirixCloseViewerNotification object:viewerController];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationOutput:) name:OsirixViewerDidChangeNotification object:nil];
[roiList loadViewerROIs];
time = (double*)calloc([viewerController maxMovieIndex]-1, sizeof(double));
dTime = (double*)calloc([viewerController maxMovieIndex]-1, sizeof(double));
interpolation = [self calculateTime];
//check for presets or preferences in current version
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
/* ACHTUNG TEST */
NSString* pluginVersionInList = [userDefaults string:@"UMMPPluginVersion" otherwise:nil];
//NSString* pluginVersion = [defaults objectForKey:@"UMMPPluginVersion"];
if (pluginVersionInList) {
if (![pluginVersionInList isEqualToString:currentPluginVersion]) {
int returnValue = NSRunAlertPanel(@"new Plugin Version", @"You are running a new Version of UMMPerfusion or installed it for the first time. In case you already had UMMPerfusion installed on your device, do you want to keep your old user presets?", @"change to new preset values", @"keep old preset values", nil);
if (returnValue) {
[prefController removeAllPresetItems];
[prefController addPresetItemForNewVersion];
} else {
int returnValue = NSRunAlertPanel(@"Final warning!!", @"You are using an old version of UMMPerfusion preset parameters. This may cause problems while calculating. To void this, please go to the preference window and add a new set of presets. For further information see this website: http://ikrsrv1.medma.uni-heidelberg.de/redmine/projects/ummperfusion/wiki", @"open website", @"OK", nil);
if (returnValue) {
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:@"http://ikrsrv1.medma.uni-heidelberg.de/redmine/projects/ummperfusion/wiki"]];
}
}
[userDefaults setString:currentPluginVersion forKey:@"UMMPPluginVersion"];
if ([defaults objectForKey:@"UMMPPluginVersion"])
[defaults removeObjectForKey:@"UMMPPluginVersion"];
if ([defaults objectForKey:@"UMMPpresets"])
[defaults removeObjectForKey:@"UMMPpresets"];
if ([defaults objectForKey:@"UMMPmaxIterations"])
[defaults removeObjectForKey:@"UMMPmaxIterations"];
if ([defaults objectForKey:@"UMMPmapAK"])
[defaults removeObjectForKey:@"UMMPmapAK"];
if ([defaults objectForKey:@"UMMPmapCS"])
[defaults removeObjectForKey:@"UMMPmapCS"];
if ([defaults objectForKey:@"UMMPmapEF"])
[defaults removeObjectForKey:@"UMMPmapEF"];
if ([defaults objectForKey:@"UMMPmapITT"])
[defaults removeObjectForKey:@"UMMPmapITT"];
if ([defaults objectForKey:@"UMMPmapIV"])
[defaults removeObjectForKey:@"UMMPmapIV"];
if ([defaults objectForKey:@"UMMPmapMTT"])
[defaults removeObjectForKey:@"UMMPmapMTT"];
if ([defaults objectForKey:@"UMMPmapPF"])
[defaults removeObjectForKey:@"UMMPmapPF"];
if ([defaults objectForKey:@"UMMPmapPSA"])
[defaults removeObjectForKey:@"UMMPmapPSA"];
if ([defaults objectForKey:@"UMMPmapPV"])
[defaults removeObjectForKey:@"UMMPmapPV"];
}
} else {
int returnValue = NSRunAlertPanel(@"new Plugin Version", @"You are running a new Version of UMMPerfusion or installed it for the first time. In case you already had UMMPerfusion installed on your device, do you want to keep your old user presets?", @"change to new preset values", @"keep old preset values", nil);
if (returnValue) {
[prefController removeAllPresetItems];
[prefController addPresetItemForNewVersion];
} else {
int returnValue = NSRunAlertPanel(@"Final warning!!", @"You are using an old version of UMMPerfusion preset parameters. This may cause problems while calculating. To void this, please go to the preference window and add a new set of presets. For further information see this website: http://ikrsrv1.medma.uni-heidelberg.de/redmine/projects/ummperfusion/wiki", @"open website", @"OK", nil);
if (returnValue) {
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:@"https://github.com/Computer-Assisted-Clinical-Medicine/UMMPerfusion/wiki"]];
}
}
[userDefaults setString:currentPluginVersion forKey:@"UMMPPluginVersion"];
if ([defaults objectForKey:@"UMMPPluginVersion"])
[defaults removeObjectForKey:@"UMMPPluginVersion"];
if ([defaults objectForKey:@"UMMPpresets"])
[defaults removeObjectForKey:@"UMMPpresets"];
if ([defaults objectForKey:@"UMMPmaxIterations"])
[defaults removeObjectForKey:@"UMMPmaxIterations"];
if ([defaults objectForKey:@"UMMPmapAK"])
[defaults removeObjectForKey:@"UMMPmapAK"];
if ([defaults objectForKey:@"UMMPmapCS"])
[defaults removeObjectForKey:@"UMMPmapCS"];
if ([defaults objectForKey:@"UMMPmapEF"])
[defaults removeObjectForKey:@"UMMPmapEF"];
if ([defaults objectForKey:@"UMMPmapITT"])
[defaults removeObjectForKey:@"UMMPmapITT"];
if ([defaults objectForKey:@"UMMPmapIV"])
[defaults removeObjectForKey:@"UMMPmapIV"];
if ([defaults objectForKey:@"UMMPmapMTT"])
[defaults removeObjectForKey:@"UMMPmapMTT"];
if ([defaults objectForKey:@"UMMPmapPF"])
[defaults removeObjectForKey:@"UMMPmapPF"];
if ([defaults objectForKey:@"UMMPmapPSA"])
[defaults removeObjectForKey:@"UMMPmapPSA"];
if ([defaults objectForKey:@"UMMPmapPV"])
[defaults removeObjectForKey:@"UMMPmapPV"];
}
//check for 32bit pipeline
_32bitPipeline = [[[NSUserDefaults standardUserDefaults] objectForKey:@"FULL32BITPIPELINE"] boolValue];
if (_32bitPipeline) {
int returnValue = NSRunAlertPanel(@"issue with 32bit pipeline", @"32bit pipeline is activated. To avoid circular artifacts you can turn it off ", @"turn off", @"keep settings", nil);
if (returnValue) {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"FULL32BITPIPELINE"];
//NSLog(@"tried to set 32bit pipeline to NO");
}
}
[prefController initValues];
return self;
}
// Alert by trying to open another Panel when a Panel is already open
NSRunAlertPanel(@"UMMPerfusion Panel already open", @"Only one Panel can be used at the same time", @"OK", nil, nil);
return -1;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[filter release]; filter = NULL;
[viewerController release]; viewerController = nil;
[cmControllerList release]; self.cmControllerList = nil;
[userDefaults release]; self.userDefaults = nil;
if (currentPluginVersion) {
[currentPluginVersion release]; self->currentPluginVersion=nil;
}
if (time) free(time);
if (dTime) free(dTime);
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
- (void)awakeFromNib {
// to hide headline in menu
[menuItem1 setTarget:self];
[menuItem2 setTarget:self];
[menuItem3 setTarget:self];
[menuItem4 setTarget:self];
}
#pragma mark -
#pragma mark Notifications
// method which close the UMMPanel plugin
- (void)windowWillClose:(NSNotification *)notification
{
if ([notification object] == [self window]) {
int i;
int counter = [cmControllerList count];
for (i=0; i<counter; i++)
{
[[[cmControllerList objectAtIndex:0] window] close];
}
[[algorithmController mapSelectionPanel] close];
chart.stopDraw = YES;
[[mapSelectionPanelController window] release];
[mapSelectionPanelController release];
[[prefController window] close];
[[self window] release];
[self release];
pluginClose = true;
}
}
// This method deselect all ROIs before taking screenshot for the report
- (void) deselectAllRois {
unsigned i, j, k;
for (i=0; i<[viewerController maxMovieIndex]; i++) {
NSArray *roiTimeList = [[self viewerController] roiList:i];
for (j=0; j<[roiTimeList count]; j++) {
NSArray *roisList = [roiTimeList objectAtIndex:j];
for (k=0; k< [roisList count]; k++) {
ROI *roi = [roisList objectAtIndex:k];
[roi setROIMode:ROI_sleep];
}
}
}
}
- (void)notificationOutput:(NSNotification *)notification
{
NSLog(@"%@", [notification object]);
}
- (void)viewerWillClose:(NSNotification *)notification
{
[[self window] close];
}
#pragma mark -
#pragma mark IBActions
- (IBAction)pushCloseAllViewersButton:(id)sender
{
int i;
int counter = [viewerList count];
for (i=0; i<counter; i++)
{
[[[[[viewerList viewers] objectAtIndex:0] viewer] window] orderOut:self];
[[[[[viewerList viewers] objectAtIndex:0] viewer] window] close];
}
counter = [cmControllerList count];
for (i=0; i<counter; i++)
{
[[[cmControllerList objectAtIndex:0] window] close];
}
[cmControllerList release]; cmControllerList = NULL;
cmControllerList = [[NSMutableArray alloc] init];
}
- (IBAction)viewChoicePopupAction:(id)sender
{
NSMenuItem *item = sender;
[self changeView:[item tag]];
}
- (IBAction)pushPrefButton:(id)sender
{
NSWindow *prefWindow = [prefController window];
if (![prefWindow isVisible]) {
[prefWindow makeKeyAndOrderFront:sender];
}
}
- (IBAction)pushGenerateButton:(id)sender
{
if ([algorithmController checkUserInput]) {
alreadyExported = NO;
[[algorithmController inputParameter] removeAllObjects];
[[algorithmController outputParameter] removeAllObjects];
[[algorithmController presetParameter] removeAllObjects];
[algorithmController saveInputParameter:nil andAlgorithmName:nil];
[algorithmController savePresetParameter:-1];
[algorithmController startCalculation:nil andAlgorithmTag:-1];
[algorithmController saveOutputParameter:-1];
if ([[algorithmController autosaveCheckButton] state]) {
if ([algorithmController class] == [UMMPFastDeconvolutionController class]) {
[self pushExportButton:nil];
}
}
}
}
-(IBAction)pushGenerateAllMapsButton:(id)sender
{
if ([algorithmController checkUserInput]) {
[self pushCloseAllViewersButton:nil];
int taskCounter = 0, validationCounterForMapSel = 0;
//Text for Information-Panel with content of selected maps (selected for calculation and export)
NSMutableString *outputString =[NSMutableString stringWithString:@"The following maps will be calculated and exported:\n"];
if([userDefaults int:@"UMMPcompartmentMapPF" otherwise:NO] || [userDefaults int:@"UMMPcompartmentMapPMTT" otherwise:NO] || [userDefaults int:@"UMMPcompartmentMapPV" otherwise:NO] || [userDefaults int:@"UMMPcompartmentMapAFE" otherwise:NO] || [ userDefaults int:@"UMMPcompartmentMapCS" otherwise:NO])
{
[outputString appendString:@"1-Compartment:\n"];
validationCounterForMapSel++;
}
if([userDefaults int:@"UMMPcompartmentMapPF" otherwise:NO]) [outputString appendString:@"\tPlasma Flow\n"];
if([userDefaults int:@"UMMPcompartmentMapPMTT" otherwise:NO]) [outputString appendString:@"\tPlasma Meant Transit Time\n"];
if([userDefaults int:@"UMMPcompartmentMapPV" otherwise:NO]) [outputString appendString:@"\tPlasma Volume\n"];
if([userDefaults int:@"UMMPcompartmentMapAFE" otherwise:NO]) [outputString appendString:@"\tCorrected Akaike Information Criterion\n"];
if([userDefaults int:@"UMMPcompartmentMapCS" otherwise:NO]) [outputString appendString:@"\tChi Square\n"];
if([ userDefaults int:@"UMMPexchangeMapPF" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapPMTT" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapPV" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapIMTT" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapIV" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapEF"otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapPSAP"otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapAFE" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapCS" otherwise:NO])
{
[outputString appendString:@"2-Compartment Exchange:\n"];
validationCounterForMapSel++;
}
if([userDefaults int:@"UMMPexchangeMapPF" otherwise:NO]) [outputString appendString:@"\tPlasma Flow\n"];
if([userDefaults int:@"UMMPexchangeMapPMTT" otherwise:NO]) [outputString appendString:@"\tPlasma Mean Transit Time\n"];
if([userDefaults int:@"UMMPexchangeMapPV" otherwise:NO]) [outputString appendString:@"\tPlasma Volume\n"];
if([userDefaults int:@"UMMPexchangeMapIMTT" otherwise:NO]) [outputString appendString:@"\tInterstitial Mean Transit Time\n"];
if([userDefaults int:@"UMMPexchangeMapIV" otherwise:NO]) [outputString appendString:@"\tInterstitial Volume\n"];
if([userDefaults int:@"UMMPexchangeMapEF" otherwise:NO]) [outputString appendString:@"\tExtraction Fraction\n"];
if([userDefaults int:@"UMMPexchangeMapPSAP" otherwise:NO]) [outputString appendString:@"\tPermeable Surface Area Product\n"];
if([userDefaults int:@"UMMPexchangeMapAFE" otherwise:NO]) [outputString appendString:@"\tCorrected Akaike Information Criterion\n"];
if([userDefaults int:@"UMMPexchangeMapCS" otherwise:NO]) [outputString appendString:@"\tChi Square\n"];
if ([ userDefaults int:@"UMMPfiltrationMapPF" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapPMTT" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapPV" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapIMTT" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapEF" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapPSAP"otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapAFE"otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapCS" otherwise:NO])
{
[outputString appendString:@"2-Compartment Filtration:\n"];
validationCounterForMapSel++;
}
if([userDefaults int:@"UMMPfiltrationMapPF" otherwise:NO]) [outputString appendString:@"\tPlasma Flow\n"];
if([userDefaults int:@"UMMPfiltrationMapPMTT" otherwise:NO]) [outputString appendString:@"\tPlasma Mean Transit Time\n"];
if([userDefaults int:@"UMMPfiltrationMapPV" otherwise:NO]) [outputString appendString:@"\tPlasma Volume\n"];
if([userDefaults int:@"UMMPfiltrationMapIMTT" otherwise:NO]) [outputString appendString:@"\tInterstitial Mean Transit Time\n"];
if([userDefaults int:@"UMMPfiltrationMapEF" otherwise:NO]) [outputString appendString:@"\tExtraction Fraction\n"];
if([userDefaults int:@"UMMPfiltrationMapPSAP" otherwise:NO]) [outputString appendString:@"\tTubular Flow\n"];
if([userDefaults int:@"UMMPfiltrationMapAFE" otherwise:NO]) [outputString appendString:@"\tCorrected Akaike Information Criterion\n"];
if([userDefaults int:@"UMMPfiltrationMapCS" otherwise:NO]) [outputString appendString:@"\tChi Square\n"];
if ([ userDefaults int:@"UMMPuptakeMapPF" otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapPMTT"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapPV"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapEF"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapPSAP"otherwise:NO]|| [ userDefaults int:@"UMMPuptakeMapAFE"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapCS"otherwise:NO])
{
[outputString appendString:@"2-Compartment Uptake:\n"];
validationCounterForMapSel++;
}
if([userDefaults int:@"UMMPuptakeMapPF" otherwise:NO]) [outputString appendString:@"\tPlasma Flow\n"];
if([userDefaults int:@"UMMPuptakeMapPMTT" otherwise:NO]) [outputString appendString:@"\tPlasma Mean Transit Time\n"];
if([userDefaults int:@"UMMPuptakeMapPV" otherwise:NO]) [outputString appendString:@"\tPlasma Volume\n"];
if([userDefaults int:@"UMMPuptakeMapEF" otherwise:NO]) [outputString appendString:@"\tExtraction Fraction\n"];
if([userDefaults int:@"UMMPuptakeMapPSAP" otherwise:NO]) [outputString appendString:@"\tPermeable Surface Area Product\n"];
if([userDefaults int:@"UMMPuptakeMapAFE" otherwise:NO]) [outputString appendString:@"\tCorrected Akaike Information Criterion\n"];
if([userDefaults int:@"UMMPuptakeMapCS" otherwise:NO]) [outputString appendString:@"\tChi Square\n"];
if ([ userDefaults int:@"UMMPtoftsMapPV"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapIMTT"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapIV" otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapPSAP"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapAFE"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapCS"otherwise:NO])
{
[outputString appendString:@"Modified Tofts:\n"];
validationCounterForMapSel++;
}
if([userDefaults int:@"UMMPtoftsMapPV" otherwise:NO]) [outputString appendString:@"\tPlasma Volume\n"];
if([userDefaults int:@"UMMPtoftsMapIMTT" otherwise:NO]) [outputString appendString:@"\tInterstitial Mean Transit Time\n"];
if([userDefaults int:@"UMMPtoftsMapIV" otherwise:NO]) [outputString appendString:@"\tInterstitial Volume\n"];
if([userDefaults int:@"UMMPexchangeMapEF" otherwise:NO]) [outputString appendString:@"\tExtraction Fraction\n"];
if([userDefaults int:@"UMMPtoftsMapPSAP" otherwise:NO]) [outputString appendString:@"\tKtrans\n"];
if([userDefaults int:@"UMMPtoftsMapAFE" otherwise:NO]) [outputString appendString:@"\tCorrected Akaike Information Criterion\n"];
if([userDefaults int:@"UMMPtoftsMapCS" otherwise:NO]) [outputString appendString:@"\tChi Square\n"];
[outputString appendString:@"\n\nRemember, you can change the map selection settings. Just click on the \"settings\"-menu on the top right corner of the plugin's main window."];
if(validationCounterForMapSel){
//will return to panel when hitting cancel
int returnValue = NSRunInformationalAlertPanel(@"List of used maps", outputString, @"OK", @"Cancel", nil);
if (!returnValue) {
return;
}
}
else {
NSRunAlertPanel(@"No maps selected", @"No maps selected. You can change the map selection settings by clicking on the \"settings\"-menu on the top right corner of the plugin's main window.", @"Return to plugin", nil, nil);
return;
}
Wait *splash =nil;
splash = [[Wait alloc] initWithString:NSLocalizedString(@"Overall progress in map calculation", nil)];
[splash showWindow:self];
[[splash progress] setMaxValue:15];
[splash setCancel: NO];
[splash setElapsedString:@"calculating Maps" ];
int i;
NSInteger tissueRoiTag = [[algorithmController tissueButton] selectedTag];
UMMPROIRec *roiRec = [roiList findRecordByTag:tissueRoiTag];
for(i=0; i<5; i++)
{
BOOL isOK = NO;
switch (i) {
case 0:
if ([userDefaults int:@"UMMPcompartmentMapPF" otherwise:NO] || [userDefaults int:@"UMMPcompartmentMapPMTT" otherwise:NO] || [userDefaults int:@"UMMPcompartmentMapPV" otherwise:NO] || [userDefaults int:@"UMMPcompartmentMapAFE" otherwise:NO] || [ userDefaults int:@"UMMPcompartmentMapCS" otherwise:NO]) {
isOK = YES;
}
break;
case 1:
if ([ userDefaults int:@"UMMPexchangeMapPF" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapPMTT" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapPV" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapIMTT" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapIV" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapEF"otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapPSAP"otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapAFE" otherwise:NO] || [ userDefaults int:@"UMMPexchangeMapCS" otherwise:NO]) {
isOK = YES;
}
break;
case 2:
if ([ userDefaults int:@"UMMPfiltrationMapPF" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapPMTT" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapPV" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapIMTT" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapEF" otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapPSAP"otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapAFE"otherwise:NO] || [ userDefaults int:@"UMMPfiltrationMapCS" otherwise:NO]) {
isOK = YES;
}
break;
case 3:
if ([ userDefaults int:@"UMMPuptakeMapPF" otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapPMTT"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapPV"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapEF"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapPSAP"otherwise:NO]|| [ userDefaults int:@"UMMPuptakeMapAFE"otherwise:NO] || [ userDefaults int:@"UMMPuptakeMapCS"otherwise:NO]) {
isOK = YES;
}
break;
case 4:
if ([ userDefaults int:@"UMMPtoftsMapPV"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapIMTT"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapIV" otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapPSAP"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapAFE"otherwise:NO] || [ userDefaults int:@"UMMPtoftsMapCS"otherwise:NO]) {
isOK = YES;
}
break;
default:
break;
}
[[algorithmController inputParameter] removeAllObjects];
[[algorithmController outputParameter] removeAllObjects];
[[algorithmController presetParameter] removeAllObjects];
switch (i) {
case 0:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"Compartment"];
[splash setElapsedString:@"calculating \"Compartment Maps\"" ];
break;
case 1:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"2C Exchange"];
[splash setElapsedString:@"calculating \"2-Compartment Exchange Maps\"" ];
break;
case 2:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"2C Filtration"];
[splash setElapsedString:@"calculating \"2-Compartment Filtration Maps\"" ];
break;
case 3:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"2C Uptake"];
[splash setElapsedString:@"calculating \"2-Compartment Uptake Maps\"" ];
break;
case 4:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"Modified Tofts"];
[splash setElapsedString:@"calculating \"Modified Tofts Maps\"" ];
break;
default:
break;
}
if (isOK) {
taskCounter++;
[algorithmController savePresetParameter:i];}
[splash incrementBy:1];
if (isOK) {[algorithmController startCalculation:roiRec andAlgorithmTag:i];}
[splash incrementBy:1];
alreadyExported = NO;
//[viewerController resetImage:viewerController];
if (isOK) {
[self pushExportButton:nil];
}
[self pushCloseAllViewersButton:nil];
//[viewerController resetImage:viewerController];
[splash incrementBy:1];
}
[splash close];
[splash release];
if([userDefaults int:@"soundOnAllMapsCalcEnd" otherwise:NO]){
if(taskCounter){
NSSpeechSynthesizer *mySpeechSynth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
[mySpeechSynth startSpeakingString:@"Calculation has been completed. All Maps have been exported."];
[mySpeechSynth release];
}
else{
NSSpeechSynthesizer *mySpeechSynth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
[mySpeechSynth startSpeakingString:@"No tasks to perform. Select some maps first!"];
[mySpeechSynth release];
}
}
}
}
-(IBAction)pushGenerateButtonOneAlgorithm:(id)sender
{
if ([algorithmController checkUserInput]) {
alreadyExported = NO;
NSMutableArray *records = [roiList records];
for (UMMPROIRec *roiRec in records) {
if ([[roiRec activated] boolValue]) {
[[algorithmController inputParameter] removeAllObjects];
[[algorithmController outputParameter] removeAllObjects];
[[algorithmController presetParameter] removeAllObjects];
[algorithmController saveInputParameter:roiRec andAlgorithmName:nil];
[algorithmController savePresetParameter:-1];
[algorithmController startCalculation:roiRec andAlgorithmTag:-1];
[algorithmController saveOutputParameter:-1];
}
}
if ([[algorithmController autosaveCheckButton] state]) {
[self pushExportAllButton:nil];
}
}
}
-(IBAction)pushGenerateButtonOneROI:(id)sender
{
if ([algorithmController checkUserInput]) {
alreadyExported = NO;
int i;
NSInteger tissueRoiTag = [[algorithmController tissueButton] selectedTag];
UMMPROIRec *roiRec = [roiList findRecordByTag:tissueRoiTag];
for(i=0; i<6; i++)
{
[[algorithmController inputParameter] removeAllObjects];
[[algorithmController outputParameter] removeAllObjects];
[[algorithmController presetParameter] removeAllObjects];
switch (i) {
case 0:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"Compartment"];
[algorithmController savePresetParameter:i];
[algorithmController startCalculation:roiRec andAlgorithmTag:i];
[algorithmController saveOutputParameter:i];
break;
case 1:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"2C Exchange"];
[algorithmController savePresetParameter:i];
[algorithmController startCalculation:roiRec andAlgorithmTag:i];
[algorithmController saveOutputParameter:i];
break;
case 2:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"2C Filtration"];
[algorithmController savePresetParameter:i];
[algorithmController startCalculation:roiRec andAlgorithmTag:i];
[algorithmController saveOutputParameter:i];
break;
case 3:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"2C Uptake"];
[algorithmController savePresetParameter:i];
[algorithmController startCalculation:roiRec andAlgorithmTag:i];
[algorithmController saveOutputParameter:i];
break;
case 4:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"Modified Tofts"];
[algorithmController savePresetParameter:i];
[algorithmController startCalculation:roiRec andAlgorithmTag:i];
[algorithmController saveOutputParameter:i];
break;
case 5:
[algorithmController saveInputParameter:roiRec andAlgorithmName:@"2Inlet 2C Uptake"];
[algorithmController savePresetParameter:i];
[algorithmController startCalculation:roiRec andAlgorithmTag:i];
[algorithmController saveOutputParameter:i];
break;
default:
break;
}
}
if ([[algorithmController autosaveCheckButton] state]) {
[self pushExportAllButton:nil];
}
}
}
- (IBAction)pushExportButton:(id)sender
{
if (!alreadyExported) {
[algorithmController exportResults];
alreadyExported = YES;
}
else {
NSRunAlertPanel(@"too many exports", @"Results have already been exported", @"OK", nil, nil);
}
}
- (IBAction)pushExportAllButton:(id)sender{
Wait *splash = nil;
splash = [[Wait alloc] initWithString:NSLocalizedString(@"Saving all results...", nil)];
[splash showWindow:self];
[[splash progress] setMaxValue: [cmControllerList count]-1];
[splash setCancel: NO];
for (UMMPCMPanelController *cmc in cmControllerList) {
[cmc pushExportButton:nil];
[splash incrementBy: 1];
}
[splash close];
[splash release];
}
- (IBAction)pushHelpButton:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:@"https://github.com/Computer-Assisted-Clinical-Medicine/UMMPerfusion/wiki"]];
}
#pragma mark -
#pragma mark other methods
- (void)changeView:(NSInteger)whichViewTag
{
NSView *view;
switch (whichViewTag) {
case fastDeconvolutionTag:
view = fastDeconvolutionView;
algorithmController = fastDeconvolutionController;
[algorithmPopUpButton setTitle:@"Fast Deconvolution"];
_panelSize.width=255;
_panelSize.height=430;
break;
case compartmentRoiTag:
view = roiBasedView;
algorithmController = roiBasedController;
[algorithmPopUpButton setTitle:@"Compartment"];
_panelSize.width=255;
_panelSize.height=480;
break;
case exchangeRoiTag:
view = roiBasedView;
algorithmController = roiBasedController;
[algorithmPopUpButton setTitle:@"2-C Exchange"];
_panelSize.width=255;
_panelSize.height=480;
break;
case filtrationRoiTag:
view = roiBasedView;
algorithmController = roiBasedController;
[algorithmPopUpButton setTitle:@"2-C Filtration"];
_panelSize.width=255;
_panelSize.height=480;
break;
case uptakeRoiTag:
view = roiBasedView;
algorithmController = roiBasedController;
[algorithmPopUpButton setTitle:@"2-C Uptake"];
_panelSize.width=255;
_panelSize.height=480;
break;
case modifiedToftsRoiTag:
view = roiBasedView;
algorithmController = roiBasedController;
[algorithmPopUpButton setTitle:@"Modified Tofts"];
_panelSize.width=255;
_panelSize.height=480;
break;
case compartmentMapTag:
view = pixelBasedMapView;
algorithmController = pixelBasedMapController;
[algorithmPopUpButton setTitle:@"Compartment"];
_panelSize.width=255;
_panelSize.height=480;
break;
case exchangeMapTag:
view = pixelBasedMapView;
algorithmController = pixelBasedMapController;
[algorithmPopUpButton setTitle:@"2-C Exchange"];
_panelSize.width=255;
_panelSize.height=480;
break;
case filtrationMapTag:
view = pixelBasedMapView;
algorithmController = pixelBasedMapController;
[algorithmPopUpButton setTitle:@"2-C Filtration"];
_panelSize.width=255;
_panelSize.height=480;
break;
case uptakeMapTag:
view = pixelBasedMapView;
algorithmController = pixelBasedMapController;
[algorithmPopUpButton setTitle:@"2-C Uptake"];
_panelSize.width=255;
_panelSize.height=480;
break;
case modifiedToftsMapTag:
view = pixelBasedMapView;
algorithmController = pixelBasedMapController;
[algorithmPopUpButton setTitle:@"Modified Tofts"];
_panelSize.width=255;
_panelSize.height=480;
break;
case allROIsTag:
view = afOneAlgorithmView;
algorithmController = afOneAlgorithmController;
[algorithmPopUpButton setTitle:@"all ROIs"];
_panelSize.width=257;
_panelSize.height=532;
break;
case allAlgorithmsTag:
view = afOneROIView;
algorithmController = afOneROIController;
[algorithmPopUpButton setTitle:@"all algorithms"];
_panelSize.width=257;
_panelSize.height=461;
break;
case allMapsTag:
view = afAllMapsView;
algorithmController = afAllMapsController;
[algorithmPopUpButton setTitle:@"all maps"];
_panelSize.width=257;
_panelSize.height=559;
if ([ userDefaults bool:@"UMMPshowOldMapsWillBeClosedDialog" otherwise:YES ])
{
/* Alert for closing all windows */
int ret = NSRunAlertPanel(@"Confirm action", @"Starting the \"all maps\"-algorithm will close all viewers except for the original viewer. \n ",@"OK",@"Don't show this message again",nil);
if(ret == -1) NSLog(@"message returned 0");//[userDefaults setBool:YES forKey:@"UMMPshowOldMapsWillBeClosedDialog"]; //case: OK
else if(ret == 0) [userDefaults setBool:NO forKey:@"UMMPshowOldMapsWillBeClosedDialog"]; //case: don't show this message again
}
break;
case twoComp2InletUptakeRoiTag:
view = twoComp2InletUptakeRoiBasedView;
algorithmController = twoComp2InletUptakeRoiBasedController;
[algorithmPopUpButton setTitle:@"2-C 2-Inlet Uptake Roi"];
_panelSize.width=252;
_panelSize.height=504;
break;
case twoComp2InletUptakePixelTag:
view = twoComp2InletUptakePixelBasedView;
algorithmController = twoComp2InletUptakePixelBasedController;
[algorithmPopUpButton setTitle:@"2-C 2-Inlet Uptake Pixel"];
_panelSize.width=255;
_panelSize.height=510;
break;
default:
view = nil;
break;
}
[algorithmController loadROIRecs:[roiList records]];
[algorithmController selectUserROIs];
[algorithmController loadPresets:[prefController presets]];
[algorithmController selectUserPreset];
[[self window] setContentSize:_panelSize];
[chart setNeedsDisplay:YES];
[[self window] setContentView:[[[NSView alloc] initWithFrame:[view frame]] autorelease]];
[[self window] setContentView:view];
algorithmIsChoosed = YES;
[algorithmController drawSelectedROIRecs];
}
- (NSString *)getStringValueForDicomTag:(NSString *)dicomTag
{
return [self getStringValueForDicomTag:dicomTag atTimePoint:0];
}
- (NSString *)getStringValueForDicomTag:(NSString *)dicomTag atTimePoint:(int)timePoint
{
NSString *filePath= [[[viewerController pixList:timePoint] objectAtIndex:0] sourceFile];
DCMObject *dcmObject = [DCMObject objectWithContentsOfFile:filePath decodingPixelData:NO];
DCMAttributeTag *dcmAttributeTag = [DCMAttributeTag tagWithTagString:dicomTag];
if (dcmAttributeTag && dcmAttributeTag.group && dcmAttributeTag.element)
{
DCMAttribute *dcmAttribute = [dcmObject attributeForTag:dcmAttributeTag];
return [[dcmAttribute value] description];
}
return nil;
}
- (NSString *)getStringValueForDicomTag:(NSString *)dicomTag atTimePoint:(int)timePoint atSlice:(int)slice
{
NSString *filePath= [[[viewerController pixList:timePoint] objectAtIndex:slice] sourceFile];
DCMObject *dcmObject = [DCMObject objectWithContentsOfFile:filePath decodingPixelData:NO];
DCMAttributeTag *dcmAttributeTag = [DCMAttributeTag tagWithTagString:dicomTag];
if (dcmAttributeTag && dcmAttributeTag.group && dcmAttributeTag.element)
{
DCMAttribute *dcmAttribute = [dcmObject attributeForTag:dcmAttributeTag];
return [[dcmAttribute value] description];
}
return nil;
}
- (BOOL)calculateTime
{
BOOL interpolate;
NSString *manufacturerTag = [NSString stringWithFormat:@"%04X,%04X", 0X0008, 0X0070];
NSString *manufacturerVal = [self getStringValueForDicomTag:manufacturerTag];
NSString *modalityTag = [NSString stringWithFormat:@"%04X,%04X", 0X0008, 0X0060];
NSString *modalityVal = [self getStringValueForDicomTag:modalityTag];
if ([manufacturerVal isEqualToString:@"OsiriX"])
{
printf( "Manufacturer: OsiriX\n" );
[self calculateTimeUsingAcquisitionTime2D];
}
else if ([manufacturerVal isEqualToString:@"SIEMENS"] || [manufacturerVal isEqualToString:@"Siemens Healthineers"])
{
printf( "Manufacturer: SIEMENS\n" );
if ([modalityVal isEqualToString:@"MR"])
{
[self calculateTimeUsingAcquisitionTime2D];
printf( "Modality: SIEMENS - MRI\n" );
}
else if ([modalityVal isEqualToString:@"CT"])
{
//[self calculateTimeForShuttleMode]; // was commented out
// DCMAttributeTag *scanOptionsTag = [DCMAttributeTag tagWithTagString:@"%04X,%04X", 0X0018, 0X0022];
NSString *filePath= [[[viewerController pixList:0] objectAtIndex:0] sourceFile];
DCMObject *dcmObject = [DCMObject objectWithContentsOfFile:filePath decodingPixelData:NO];
DCMSequenceAttribute *scanOptionsValue = (DCMSequenceAttribute *)[dcmObject attributeWithName:@"ScanOptions"];
adaptive4DSpiralValue = scanOptionsValue.values[1] ;
//######################################################--Adaptive-4D-Spiral--##########################################################//
// Part 1/3:
// This section defines necessary actions to consider individual time stamps for "Adaptive 4D Spiral". (Siemens Somatom Force Dual Source CT)
if ([adaptive4DSpiralValue isEqualToString:@"A4DS"]){
printf( "Modality: SIEMENS - DCE-CT, A4DS (shuttle mode)\n" );
NSLog(@"Images were acquired with an Adaptive 4D Spiral (Shuttle Mode). Deconvolution is not supported for this type due to inhomogeneous temporal resolution.");
// [self calculateTimeUsingAcquisitionTime]; // Original Calculation Method
[self calculateTimeUsingAcquisitionTime2D]; // Calculation Method for 4D CT, via 2D Array
//deltaT= -0.00;
}
// weitere To-Dos:
// Erfassung der Zeitstempel jedes Bildes jeder Schicht:
//
// - der Vektor/ das Array muss angepasst werden, dass nicht nur der Zeitverlauf EINER Schicht aufgenommen wird, sondern für jede Schicht einzeln.
// beispielsweise alles hintereinander weg in einem Vektor, oder separiert in Zeilen und Spalten eines Vektors.
// Hierzu die Methode "saveAcquistionTimeToFile:(int)n " betrachten, mit der habe ich testweise die Zeiten ausgelesen
// und zur Untersuchung des Shuttle-Verhaltens in ein Excel-Sheet exportiert. Aufruf über: [self saveAcquistionTimeToFile:n];
//
// - @ Frank fragen: Passt die Anwendung der Modelle dann noch? oder müssen die Intensitätsverläufe interpoliert werden?
// wenn ja, mit welcher Methode/ mit welchem Verfahren? Auf welchen zeilichen Abstand einigt man sich?
//
// - Wenn dann der Zeitvektor/-array und der dTime-Vektor/-array (Zeitspanne zwischen 2 Aufnahmen der gleichen Schicht) angepasst wurden,
// muss die Methode der Berechnung angepasst (UMMPRoiBasedController und UMMPPixelBasedMapController) werden, damit nicht nur die Zeiten der ersten Schicht ausgelesen werden.
// Außerdem ist beim Zugriff auf das Array der Zeitpunkte und dTime-Intervalle darauf zu achten, dass die Slider-Einstellungen
// (zeitlicher Trim oder Schicht-Trim) berücksichtigt werden.
//
// - Abschließend ist der Sonderfall der A4DS-Nutzung im Report kenntlich zu machen. (UMMPReport).
//
// - Wenn alle Punkte umgesetzt sind, dann die speziell mit #--Adaptive-4D-Spiral--# gekennzeichneten Kommentare entfernen.
//
//##################################################################################################################################//
else
{
[self calculateTimeUsingAcquisitionTime2D];
printf( "Modality: SIEMENS - DCE-CT\n" );
}
}
else NSLog(@"Unknown modality: %@", modalityVal);
}
else if ([manufacturerVal isEqualToString:@"GE MEDICAL SYSTEMS"])
{
printf( "Manufacturer: GE MEDICAL SYSTEMS\n" );
[self calculateTimeUsingTriggerTimeWithDecimalCorrection:1000.0];
}
else if ([manufacturerVal isEqualToString:@"Philips Medical Systems"])
{
NSLog(@"Manufacturer: Philips Medical Systems" );
printf( "Manufacturer: Philips Medical Systems\n" );
// DICOM Series without AcquisitionTime-Tag are Multiframed!
NSString *acquisitionTimeTag = [NSString stringWithFormat:@"%04X,%04X", 0X0008, 0X0032];
NSString *acquisitionTimeVal = [self getStringValueForDicomTag:acquisitionTimeTag];
// Multiframed Data
if (acquisitionTimeVal == nil)
{
NSLog(@"PHILIPS Multiframed Data!");
NSArray *philipsContentTimeArray = [self getContentTimeArrayFromMultiframeData];
[self calculateTimeUsingContentTimeArray:philipsContentTimeArray];
}
// Singleframed Data
else
{
NSLog(@"PHILIPS Singleframed Data!");
[self calculateTimeUsingAcquisitionTime2D];
// If acquisitionTime does not change over time, use triggerTime
if (max == 0.0) {
[self calculateTimeUsingTriggerTimeWithDecimalCorrection:10.0];
}
}
}
else if ([manufacturerVal isEqualToString:@"Bruker BioSpin MRI GmbH"])
{
// needs to be validated !!
// Bruker seems not to corectly put the timing information into the dicom header ??
NSLog(@"Manufacturer: Bruker BioSpin MRI GmbH");
//[self calculateTimeUsingAcquisitionTime];
[self calculateTimeUsingTRAndImageNumber];
}