CARTAvis / carta-archived

CARTA stands for Cube Analysis and Rendering Tool for Astronomy, a new visualization tool designed for the ALMA, the JVLA and the SKA.
https://cartavis.github.io/
GNU General Public License v3.0
2 stars 0 forks source link

Draw a region, then click the place outside the region without mouse-up, try to drag, CARTA will crash #161

Open grimmer0125 opened 7 years ago

grimmer0125 commented 7 years ago

Crash on casacore libs. https://github.com/casacore/casacore/blob/v2.2/lattices/LRegions/LCBox.cc#L238

Warning: Qt has caught an exception thrown from an event handler. Throwing

exceptions from an event handler is not supported in Qt.

You must not let any exception whatsoever propagate through Qt code.

If that is not possible, in Qt 5 you must at least reimplement

QCoreApplication::notify() and catch all exceptions there.

 ((null):0, (null))

Critical: Exception(std::runtime_error)! LCBox::LCBox - blc [599, 1094] must be <= trc [511, 1301]

void Region::handleDrag( const Carta::Lib::InputEvents::Drag2Event& ev, const QPointF& location ){

after executaing this, then crash

handleDragDone

}

JamieDass commented 7 years ago

I just want to check, is this issue still open? I think this should have been resolved in this commit which introduced the region UI changes and bug fixes. I can't reproduce this crash with a recent build.

kswang1029 commented 7 years ago

I tested with a build (dev branch) on June 19 and it seems that moving a region around will not trigger the crash event anymore. I will keep an eye on it.

kswang1029 commented 7 years ago

OK, I got the crash now. When you have TWO regions created, somehow you can move the two regions at the same time and one region may move completely outside the image and trigger the crash.

I suggest we should limit the regions to be completely inside the image. In other words, all pixels inside a region should have pixel values (including nan, the masked out pixels).

[41mFatal: Exception (std::exception): Exception: Ellipsoid lies completely outside the lattice. ... thrown by casacore::Slicer casacore::LCEllipsoid::makeBox(const Vector &, const casacore::IPosition &) at File: /Users/travis/build/CARTAvis/CARTAvis-externals/ThirdParty/casa/trunk/casacore/lattices/LRegions/LCEllipsoid.cc, line: 296 ...caught in MyQapp::nofify() (/Users/travis/build/CARTAvis/CARTAvis/carta/cpp/core/MyQApp.cpp:45, virtual bool MyQApp::notify(QObject , QEvent ))

JamieDass commented 7 years ago

Ah ok. That shouldn't be happening. Somehow I still can't reproduce the crash but indeed it makes no sense that regions can be outside the image. I took a quick look at the best way to prevent this but didn't have any good ideas as the 'Region' code has no information about the image size, so I didn't see a way to limit a region's location. I'll take another look to see how it might be done.

low-sky commented 7 years ago

There are use cases for regions outside of the image. For example, you can load a region file (or mask) that is larger than a given image and would want to understand where those regions were. A common use case would be a set of markers indicating where objects of interest are. Consider also what happens when there are two images of different sizes being simultaneously analyzed.

As to whether the UI should allow the manipulation of regions outside of image, that's something that is less clear. However, I would think that this is an unnecessary limitation.

kswang1029 commented 7 years ago

An example to reproduce the crash: 1) open HD163296_CO_2_1_mom0_zoom.image.fits (193px x 193px) 2) open spire250_ext.fits (1931px x 2020px) 3) in spire250_ext.fits, make a region close to the upper right edge of the image 4) should crash immediately because that region definition will be completely outside HD163296_CO_2_1_mom0_zoom.image.fits

Note that now region is defined by pixel coordinates. Therefore if a region is defined in the smaller HD163296_CO_2_1_mom0_zoom.image.fits and then use animator to switch to the bigger spire250_ext.fits, you should see that region locates at two different places on the two images. This is the root cause to trigger the crash. That is, if two images with different pixel dimensions are opened, a valid region in one image may be invalid in another and results in crash from "casacore". If we really allow a region defined outside the image, we need to find out a way to bypass casacore crash.

JamieDass commented 7 years ago

I've managed to reproduce the crash by modifying the code to allow a region to be dragged outside of the image bounds. (Previously this could only be done inadvertently by having multiple regions selected as @kswang1029 described).

As @kswang1029 says, we either have to somehow bypass the casacore crash or disallow regions outside the image bounds.