• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Slow converting index color to RGB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Slow converting index color to RGB
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Re: RGB color values for NSColor
  • Next by Date: Re: RGB color values for NSColor
  • Previous by thread: RE: Archiving and Unarchiving
  • Next by thread: Re: Slow converting index color to RGB
  • Index(es):
    • Date
    • Thread