ubarsc / tuiview

TuiView is a lightweight raster GIS with powerful raster attribute table manipulation abilities
http://tuiview.org/
GNU General Public License v2.0
26 stars 13 forks source link

Tuivew - Negative Stretch #4

Closed gillins closed 7 years ago

gillins commented 7 years ago

Original report by Nathan Thomas (Bitbucket: nathanmthomas, GitHub: nathanmthomas).


Hi,

I've noticed that there is no way to apply a linear stretch to images that have negative values (e.g., radar imagery in dB with the range -30 to -5 ). The minimum input box won't accept a negative sign and the 'down' arrow only goes to zero.

Could this be added in? I am able to stretch radar imagery using a standard deviation stretch but sometimes I would like a bit more control.

Thanks

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


Hi Nathan,

A good point. I've had to change the stretch dialog a bit to make this work, but definitely worth it. See commit #485c595.

Let me know if this fixes your problem (and hasn't created any more!). Sam.

gillins commented 7 years ago

Original comment by Nathan Thomas (Bitbucket: nathanmthomas, GitHub: nathanmthomas).


Hi Sam,

Thanks for looking into this. What's the best way to update this? I tried updating and uninstalling/reinstalling with conda but it didn't appear to be any different. I have a fair number of PhDs/Postdocs/students at JPL using TuiView. They are all in the radar section so I think they'll be glad to get their hands on this update.

Thanks, Nathan

gillins commented 7 years ago

Original comment by Pete Bunting (Bitbucket: petebunting, GitHub: petebunting).


Hi Nathan,

I've quickly put on my dev channel for you to test:

conda create --name tuiviewtest python=3.5

source activate tuiviewtest

conda install -c conda-forge -c au-eoed tuiview=1.1.10

Cheers, Pete

gillins commented 7 years ago

Original comment by Nathan Thomas (Bitbucket: nathanmthomas, GitHub: nathanmthomas).


Great stuff. Thanks Pete

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


Thanks Pete,

I'll do a new offical release 'soon' then it will go to onto conda-forge. Any other bugs that need fixing before then?

I need to get onto Qt5 support at some stage, but that might down the track. Sam.

gillins commented 7 years ago

Original comment by Nathan Thomas (Bitbucket: nathanmthomas, GitHub: nathanmthomas).


I have noticed one thing, but Im pretty sure it would be a tricky fix. Sometimes, TuiView will crash on me when using the Query tool. If I open an image (stats built) and the default SD stretch looks ok, I will go straight for the query tool. Usually this tool pops up as soon as I select it but sometimes there is a pause of a second or so and it crashes, giving me the 'ignore' or 'report error' dialogue box that is common on Macs. Its difficult to replicate this 'error/crash' consistently as it doesn't always do it. Maybe I'm just being too keen and I select the tool before the image has loaded? Im not sure if this is a 'bug' as such, but its something Ive noticed happens regularly enough that I thought it might be mentioning. Sorry I don't have any more info for you to go on than this.

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


That is really weird. I haven't seen this on Linux (or on the Mac, but I haven't done much with it there). BTW I am actually working with the conda-forge guys to fix up the Qt builds for OSX since there is a potential library incompatibility there (see https://github.com/conda-forge/qt-feedstock/issues/15 and https://github.com/conda-forge/qt-feedstock/pull/23) I'm not sure if that is related. It is more likely that I am doing something slightly incorrect that just happens to work most of the time.

Could you run:

python -m trace -t `which tuiview` > trace.txt

And see if you can crash it - if you manage to crash it send me trace.txt as this should have the last lines that were being executed which may be a clue to what is happening. There is a fair bit of code that gets run when you open that tool, I'd need to have it narrowed done before I could work out what is going on.

Thanks

gillins commented 7 years ago

Original comment by Nathan Thomas (Bitbucket: nathanmthomas, GitHub: nathanmthomas).


Thanks, that wasn't the clearest or most informative 'issue' Ive ever written. I'll run what you have suggested and I'll see if I can break it - Im not sure what causes it to crash so it may be a bit tricky to catch. If I manage it I'll send it through.

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


OK let me know how you get on. I've just been trying to break it on my old Mac and I got the message below a couple of times (do you get this?) but no crash...

2017-01-26 15:25:17.663 python[568:7778] Communications error: <OS_xpc_error: <error: 0x7fff7c4c4b90> { count = 1, contents =
    "XPCErrorDescription" => <string: 0x7fff7c4c4f40> { length = 22, contents = "Connection interrupted" }
}>
Got xpc error message: Connection interrupted
Got xpc error message: Connection interrupted

Pete: have you seen the problem Nathan is describing?

gillins commented 7 years ago

Original comment by Nathan Thomas (Bitbucket: nathanmthomas, GitHub: nathanmthomas).


I don't get anything that detailed but I'll check. I often don't understand the errors so I don't easily remember them. I think it's just a 'segmentation fault 11' error. The only other error I sometimes get refers to something along the line of a ' re-entrant call' but I'm sure it's not this one.

What strikes me about it is that it seems to occur almost at random, yet consistently occurs when image stats are built, the default stretch is good and I open the query tool. I'm not sure if it would crash if I used another tool but I could try this also. Sometimes I will launch it again and follow exactly the same steps and it will crash, and other times it works fine on the 2ND attempt.

gillins commented 7 years ago

Original comment by Nathan Thomas (Bitbucket: nathanmthomas, GitHub: nathanmthomas).


I should also add that it's not an error that greatly affects me, so I don't want to send you on a wild goose chase if it's an issue only I've raised. I launch TuiView a million times daily (I can't imagine what I'd do without it) so it's still a relatively rare occurrence

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


I'll wait for you (or Pete) to report more before pushing into it. No I haven't heard of this problem before, but I am interested in getting to the bottom of it. Pete did report to me a problem ages ago with the progress bar for calculating stats (when they haven't already been calculated) not showing up on the Mac (but fine on Linux and Windows) so it isn't totally unlikely that there Mac problems with Qt (and TuiView) that haven't been addressed. I'm not a regular Mac user so not sure if that progress bar problem still exists.

I'll post something here when the new conda-forge Qt build is ready. I'm not pinning my hopes on this being the problem though.

Let me know if you have any problems with those "Negative Stretch" changes I made.

I'm glad TuiView is useful to you :-)

gillins commented 7 years ago

Original comment by Pete Bunting (Bitbucket: petebunting, GitHub: petebunting).


Hi Sam,

I don't get any specific issues with TuiView. Very occasionally it will crash (segfault) but there is no pattern to it and it is very very rare. I have seen QT error message from other Mac installations coming out from TuiView but as I said I don't get this myself. It seems that there probably are conda installation / OS combinations which do produce some errors but as far as I have seen they are just warnings (could well be similar to what Nath has, I can't remember) and TuiView still works correctly. Maybe there is a debug level for warnings which is higher on some machines for some reason?!?

To be honest, I don't think it is worth the time to look into. As you said to Nathan if someone can get a stack trace then great, if it reveals something that we can look at but otherwise I don't think you'll get anywhere with it.

Nathan, if you run 'conda list | grep qt' can you look down the list and see which versions of qt and pyqt you have installed? I have

pyqt 4.11.4 py35_4
qt 4.8.7 4
qtconsole 4.2.1 py35_1 conda-forge

Cheers, Pete

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


Fixed in #485c595

gillins commented 7 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


See https://github.com/conda-forge/mss-feedstock/pull/12#issuecomment-291894024 - "Qt4 is essentially broken in macOS 10.10 and higher. It gives odd segfaults and hiccups all the time, and besides it doesn't work in high DPI screens (which almost all Macs have these days)."

There is a 'qt5' branch of TuiView you can try, but we are having trouble getting Qt5 itself going on OSX for conda-forge (see https://github.com/conda-forge/qt-feedstock/pull/35). Any help appreciated...