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
|
//
// TopCaoFilter.m
// TopCao
//
// Copyright (c) 2010 Alexandre. All rights reserved.
//
#import "TopCaoFilter.h"
@implementation TopCaoFilter
- (void) initPlugin
{
}
- (long) filterImage:(NSString*) menuName
{
NSWindowController *window = [[NSWindowController alloc] initWithWindowNibName:@"Control_Panel" owner:self];
[window showWindow:self]; // This will bring up the window
return 0; // No errors
}
// COMPUTE ADC
- (IBAction) computeADC:(id)sender;
{
NSLog(@"computeADC!!!");
id waitWindow = [viewerController startWaitWindow:@"Computing ADC !"];
// New window
ViewerController *new2DViewer;
// Duplicate the current window
new2DViewer = [self duplicateCurrent2DViewerWindow];
NSString* message ; // Declare message for window
int i, x, zSize; // Declare variables
float *fImage, *fImageNew; // Declare images
NSArray *pixList, *pixListNew; // 4D
DCMPix *curPix, *curPixNew; // 2D
pixList = [viewerController pixList];
pixListNew = [new2DViewer pixList];
zSize = [pixList count];
message = @"zSize"; //@"Define this message in the Hello World plugin's preferences";
for (i = 0; i < zSize; i++)
{
curPix = [pixList objectAtIndex:i];
curPixNew = [pixListNew objectAtIndex:i];
// fImage is a pointer on the pixels, ALWAYS represented in float
fImage = [curPix fImage];
fImageNew = [curPixNew fImage];
x = [curPixNew pheight] * [curPixNew pwidth];
while (x-- > 0) {
if (*fImage < 128) {
*fImageNew = 0;
}
else{
*fImageNew = *fImage;
}
fImage++;
fImageNew++;
}
}
[viewerController endWaitWindow: waitWindow];
// Apply clut & full dynamic range & refresh window
[new2DViewer ApplyCLUTString: @"Rainbow"];
[[new2DViewer imageView] setWLWW:0 :0];
[new2DViewer needsDisplayUpdate];
NSAlert *myAlert = [NSAlert alertWithMessageText:@"Control value text box"
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"%@", message];
[myAlert runModal];
}
- (IBAction) closePlugin:(id)sender;
{
[myWindow close];
}
@end |
Partager