LBEM-CH / focus

High Throughput Electron Microscopy Image Processing Software
http://www.focus-em.org
GNU General Public License v2.0
35 stars 14 forks source link

crash when viewing an MRC image for the first time #152

Closed sthennin closed 8 years ago

sthennin commented 8 years ago

When clicking once on a non-square image (2D) in the "Images" panel, 2dx tries to calculate the small preview image, to append as second MRC-headered file to the end of the MRC file. This often crashes, here: Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 org.qt-project.QtGui 0x00000001035b9100 domirror(QImageData, QImageData_, bool, bool) + 256 1 org.qt-project.QtGui 0x00000001035b3b32 QImage::mirrored_helper(bool, bool) const + 290 2 org.cina.2dx.2dxgui 0x00000001000bd1d6 mrcImage::formatImage(mrcHeader, QImage::Format) + 182 (mrcImage.cpp:364) 3 org.cina.2dx.2dxgui 0x00000001000bd6be mrcImage::loadImage(mrcHeader, QImage::Format) + 238 (mrcImage.cpp:393) 4 org.cina.2dx.2dx_gui 0x00000001000bd8d2 mrcImage::generateThumbnail() + 514 (qlist.h:159) 5 org.cina.2dx.2dx_gui 0x00000001000beb18 mrcImage::run() + 1528 (mrcImage.cpp:79) 6 org.qt-project.QtCore 0x0000000103e45710 typeinfo name for QThreadPoolPrivate + 48

apps/src/mrcImage/mrcImage.cpp : line 364 image = new QImage(imageData, 1024, 1024, format);

Might this be caused by the fact that we here try to create a 1024x1024 preview image from a non-square image???

Similar, in the same file, in line 330: if (format == QImage::Format_Indexed8 && header->ny() < 256) { uchar temp = imageData; imageData = new uchar[1024 * 1024]; for (unsigned int j = 0; j < header->ny(); j++) for (unsigned int i = 0; i < header->nx(); i++) imageData[i + j * 1024] = temp[i + j \ header->nx()]; delete temp; }

Who does the above work, when the imagaData is non-square?

sthennin commented 8 years ago

Nikhil solved this.