Skip to content

Commit

Permalink
Fix black image due to optimized out?
Browse files Browse the repository at this point in the history
  • Loading branch information
siyu6974 committed Apr 9, 2021
1 parent 444625f commit ef3d0e8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ViewerCore/FitsImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ void FitsImage::getImagePix(unsigned char * pixData)
auto bitpix = image.bitpix();

if (bitpix == Ishort) {
std::valarray<unsigned short> contents;
if (header["SWCREATE"].find("N.I.N.A") != std::string::npos) {
auto fptr = image.fitsPointer();
long nullval = 0;
Expand All @@ -150,17 +149,21 @@ void FitsImage::getImagePix(unsigned char * pixData)
int status, anynull;

fits_read_img(fptr, TSHORT, 1, nbuffer, &nullval, buffer, &anynull, &status);
contents = std::valarray<unsigned short>(nbuffer);
auto contents = std::valarray<unsigned short>(nbuffer);
for (int i = 0; i < nbuffer; i++) {
contents[i] = buffer[i];
}
delete[] buffer;

process(contents, _imgDim, _outDim, bayer, downscale_factor);
setBitmap(contents, _outDim, pixData);
}
else {
std::valarray<unsigned short> contents;
image.read(contents);
process(contents, _imgDim, _outDim, bayer, downscale_factor);
setBitmap(contents, _outDim, pixData);
}
process(contents, _imgDim, _outDim, bayer, downscale_factor);
setBitmap(contents, _outDim, pixData);
}
else {
std::valarray<float> contents;
Expand Down

0 comments on commit ef3d0e8

Please sign in to comment.