Hey everyone. I have a function that works both with short input values, as with byte input values, here pixelData
is an array filled with either bytes or shorts.
byte oColor;
if (pixelData[counter/3] < minValue)
oColor = 0;
else if (pixelData[counter/3] > maxValue)
oColor = 255;
else
oColor = (byte)(((pixelData[counter/3] - (WindowLevel - (WindowWidth / 2))) * 255) / WindowWidth);
Then I have the following code:
bool isShort = ReadIsShort();
if(isShort){
shortArray = ReadShortArray();
} else {
byteArray = ByteArray();
}
To get either the short or the byte array. However, I cannot use them in function above. Since something like this doesn't work.
var pixelData;
if(IsShort)
pixelData = shortArray;
else
pixelData = byteArray;
Anyone know how I should program this, since this clearly is a design flaw.