0
광도계 해석을 '흑백 2'로하고 픽셀 형식을 부호없는 int 16 또는 uint16으로 사용하는 gdcm 이미지 판독기에서 읽은 dicom 이미지를 변환하려고 시도했지만 그 위에 다음 코드를 시도했지만 필요한 이미지를 제공하지 않습니다. 제발 도와주세요.는 uint16 dicom 이미지를 qimage로 변환합니다.
QVector<QRgb> table(2);
for(int c=0;c<256;c++)
{
table.append(qRgb(c,c,c));
}
std::cout << "this is the format UINT16" << std::endl;
int size = dimX*dimY*2; // length of data in buffer, in bytes
quint8 * output = reinterpret_cast<quint8*>(buffer);
const quint16 * input = reinterpret_cast<const quint16*>(buffer);
do {
*output++ = (*input) >> 8;
} while (size -= 2);
imageQt = new QImage(output, dimX, dimY, QImage::Format_Indexed8);
imageQt->setColorTable(table);
안부
무엇 당신의 입력과 출력이 생겼는데? 조금 더 많은 정보가 도움이 될 것입니다. 분명히 최종 해상도가 원본보다 좋지 않을 정도로 색상 해상도를 낮추고 있지만 그 자체로는 큰 문제는 아닙니다 (디더링이 도움이 될 수 있음). – Goz