Slow converting index color to RGB
Slow converting index color to RGB
- Subject: Slow converting index color to RGB
- From: Lance Pysher <email@hidden>
- Date: Tue, 26 Aug 2003 21:47:44 -0600
Why is this so slow?
- (void)generateColorIndexBitMapData{
unsigned int i = 0;
unsigned char *pointer = [self bitmapData];
char *pixelData = [self pixelData];
// LUT may be 8 or 16 bit
if ([[[[self dicomObject]
objectArrayWithDescription:@"RedPaletteColorLookupTableDescriptor"]
objectAtIndex:2] intValue] == 16) {
unsigned short *red = [[[self dicomObject]
objectWithDescription:@"RedPaletteColorLookupTableData"] bytes];
unsigned short *green = [[[self dicomObject]
objectWithDescription:@"GreenPaletteColorLookupTableData"] bytes];
unsigned short *blue = [[[self dicomObject]
objectWithDescription:@"BluePaletteColorLookupTableData"] bytes];
while (i < [[[self dicomObject]
objectWithDescription:@"PixelData"] length]){
*pointer++ = red[(unsigned char)*pixelData];
*pointer++ = green[(unsigned char)*pixelData];
*pointer++ = blue[(unsigned char)*pixelData++];
i++;
}
// NSLog(@"end covert from LUT");
}
else{
unsigned char *red = (unsigned char *)[[[self dicomObject]
objectWithDescription:@"RedPaletteColorLookupTableData"] bytes];
unsigned char *green = (unsigned char *)[[[self dicomObject]
objectWithDescription:@"GreenPaletteColorLookupTableData"] bytes];
unsigned char *blue = (unsigned char *)[[[self dicomObject]
objectWithDescription:@"BluePaletteColorLookupTableData"] bytes];
while (i < [[[self dicomObject]
objectWithDescription:@"PixelData"] length]){
*pointer++ = red[(unsigned char)*pixelData];
*pointer++ = green[(unsigned char)*pixelData];
*pointer++ = blue[(unsigned char)*pixelData++];
i++;
}
}
}
Lance Pysher, M.D.
email@hidden
http://irad.sourceforge.net/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.