How to show legally DICOM 16 unsigned integer on the device are supporting 8 bit unsigned integer?

前端 未结 2 521
时光说笑
时光说笑 2021-01-22 15:26

I\'m working on a Medical app on iOS. The iOS devices just support GL_UNSIGNED_BYTE with GL_LUMINANCE or generally just support 8 bit per component. Now I have some grayscale im

相关标签:
2条回答
  • 2021-01-22 16:06

    You MUST convert these values in order to show them applying a Window Level.

    Grayscale Dicom images do usually have two Data Elements (Dicom fields) containing the values WC (Window Center, Data Element: 0028,1050) and WL (Window Level, Data Element: 0028,1051). These values define the linear equation necessary to display the information contained in the image.

    You can find a more detailed description about the concept of Window Level here.

    0 讨论(0)
  • 2021-01-22 16:25

    I tried it by dividing each pixel by a value (max value in the matrix or brightest / 256), then each pixel became an 8 bit value. And it gave same result when I apply pseudo equation mentioned in https://www.dabsoft.ch/dicom/3/C.11.2.1.2/.

    const void *bytes = [data bytes];
    NSMutableData* ary = [[NSMutableData alloc] init];  
    int maxValue = 4087/256; //its a dummy value, use your max value in image instead of 4087
    for (NSUInteger i = 0; i < [data length]; i += sizeof(int16_t)) {
        UInt16 elem = OSReadLittleInt16(bytes, i);
    
        UInt8 temp = round(elem/maxValue);
    
        [ary appendBytes:&temp length:sizeof(UInt8)];
    

    }

    Use 'ary' to make your image.

    0 讨论(0)
提交回复
热议问题