Dustan Adkins Blog

Opticks 4.10.0 - One Bad Release

Opticks 4.10.0 is going to be one bad release!

And by bad, I am referring to the enhanced Bad Values capability.
In previous versions of Opticks, bad pixel values (i.e.: pixel values which do not appear on the display and are ignored by certain algorithms) could only be defined by integers. You could not use floating-point values or ranges.
All of that changes with Opticks 4.10.0.
Now you can use floating-point values in addition to lists of integers and even define ranges for your bad values.
Preview this change as well as all of the other Opticks 4.10.0 changes by downloading the official Opticks 4.10.0rc1 release candidate today!

Download Opticks

Opticks 4.10.0rc1 - Beat the Release Notes

Opticks 4.10.1rc1

Opticks 4.10.0rc1 will be available this Friday.

You can get a sneak peek of the release and beat the download rush by heading to http://opticks.org/confluence/display/opticks/Download to get your copy before we even finish typing up the release notes and make the official announcement.

Stylin' and Profilin'


In versions before 4.7.0, the Opticks workspace allowed docked windows to take up almost all of the workspace area (only about 1 pixel could not be used). In Opticks 4.7.0, this minimum size was unintentionally changed. OPTICKS-1431 addresses the long-term solution to the problem. The purpose of this post is to introduce a short term workaround for existing version of Opticks via Qt Style Sheets. The difficulty level of this change is 3/10 - most everyday computer users should be able to read this post and make this change in under 30 minutes.

It's not Opticks. It's Opticks...with style

As some of our users are aware, Opticks uses the Qt framework, which gives us a huge number of benefits. One of those benefits is the use of a wide array of commmand-line options. One of those options allows for user-configurable default GUI behavior via Qt style sheets.

Create the Style Sheet

First, what is it that we want to change? For this example, we are concerned with the minimum size of a QMdiArea. (Yes, you would need to be familiar with the internals of Opticks to know that.) According to the documentation of Qt style sheets, QMdiArea is not supported. But its base class, QAbstractScrollArea, is supported. (Yes, you would need to be familiar with the Qt API.) So, in this example, we will change all QAbstractScrollArea objects in Opticks. This could cause unintended side effects, so use this solution at your own risk.

The style sheet is a text file. For our style sheet, enter the following text into a new text file using any text editor:

Configure Opticks to use the style sheet

This part is operating-system dependent. I will assume that Linux and Solaris users are familiar with command-line options and will only address how to change a Windows shortcut to use the style sheet.
Right-click on the shortcut you use to launch Opticks and select "Properties". If you do not have a shortcut, right-click on the Opticks.exe file and select "Send To"->"Desktop (create shortcut)" to make one. In the properties page, select the "Shortcut" tab and change the "Target" box by adding the following text:

Note that there needs to be a space between what is already in the "Target" box and the "-stylesheet". Also note that "C:\path\to\stylesheet.txt" should contain the full path and name of the style sheet you created. Now click "OK" on the properties dialog.

Test the Change

Now launch Opticks using the shortcut. You should be able to resize any dock window (e.g.: Session Explorer or Histogram) such that it takes up almost the entire workspace. To stop using the style sheet, modify your shortcut properties as explained previously, removing the "-stylesheet" entry.

Above and Beyond

There are many other uses for Qt style sheets, such as changing the application font and background colors of various widgets. The Qt documentation does an absolutely outstanding job of explaining style sheets, and I suggest that our users explore the wonderful world of Qt application configuration.


ALL YOUR LINKS ARE BELONG TO US (what does this mean?)

I just finished adding some external links (provided by Nate Jennings) to the Opticks Sample Data site. Thanks, Nate!

Download Sample Data

2000 Man


This post is about Opticks 4.9.1, which includes new JPEG 2000 capability, not the Rolling Stones song of the same name. Although that is an excellent song and definitely influenced my title. And since most of my work days lately have been 12+ hours, I think that the line "having an affair with a random computer" is quite applicable. And my kids certainly "don't understand me at all", but I digress...

Opticks 4.9.1rc1

Opticks 4.9.1 will be available soon (in fact, the first release candidate is building on my machine right now, rendering the machine mostly useless for anything else except text editing, hence my taking the opportunity to write this post. But I digress...). Once it is available, please download the release candidate to make sure that the changes work as desired. Here is a quick breakdown of new features:

JPEG 2000 Importer/Exporter

32-bit Windows users have had JPEG 2000 import capability for quite some time. Opticks 4.9.1 adds this capability for 64-bit Windows users as well. It also introduces a lossless JPEG 2000 export capability so you can write out smaller files to preserve disk space. There is a catch: due to technical details which I won't discuss here, files created from raster elements with 4-byte data types (INT4UBYTES, INT4SBYTES, FLT4BYTES) will not be viewable in other applications. This is not us trying to take over the world, but had to be done for technical reasons. If this is problematic for you, feel free to discuss the issue on our Mailing Lists or real-time chat, and we will try to help out as best we can.

MJPEG Exporter

The larger reason for the 4.9.1 release was to support full-resolution movie export. The new MJPEG exporter does just that. Check it out!

Spacing out and having fun

The shiny, new 4.9.1rc1 build just finished, so I will wrap up this post and get back to work. Enjoy 4.9.1!

Google Summer of Code 2012 and Opticks 4.9.0rc1-Extras 1.6.0rc1

Google Summer of Code 2012

I would like to congratulate our Google Summer of Code (GSoC) students for 2012. We had a very stiff competition this year. I know this because I read (and in most cases re-read) proposals for two weeks trying to narrow down the field. Make no mistake - the proposals for Opticks this year were truly top-notch. I would have liked to accept more, but we were limited to just 3 slots. In the end, the following proposals were accepted:

I would like to thank all of the students who submitted proposals for Opticks and would like to extend an invitation to them to contribute to Opticks outside GSoC. I have been in touch with multiple students who were not selected, and all but one of them have agreed to contribute something to Opticks from their proposals. The one who did not agree to become a contributor was accepted by another GSoC organization, so congratulations to him, and we hope to see him again at the end of the summer.

I would also like to thank our mentors and co-mentors, without whom GSoC participation would not be possible: Trevor Clarke, Nathan Jennings, Tishampati Dhar, and Dr. Charles Wamsley.

And, of course, a special thanks to OSGeo and especially Anne Ghisla (aghisla) to letting Opticks participate under their organization and putting up with all of my questions.

Opticks 4.9.0rc1/Extras 1.6.0rc1

I just finished the release of Opticks 4.9.0rc1 and IDL/Python/Spectral 1.6.0rc1. As I was finishing the release, I was informed that OPTICKS-1386 was found and would likely cause another release candidate (rc) to be created. Please take the time to download the rc's so we can find and fix any other issues in them to make this release as stable as possible.

Hard at Work

Excuses, excuses...

I have not added a new blog post in quite some time. I apologize for that and want to make sure everybody knows that I have not stopped. I have just been busy. I just now posted a draft of the Opticks Governance Policy, so you can see what I have been working on the last couple of weeks. Oh, and Google Summer of Code (GSoC) – Anne from OSGeo has been awesome to work with and has helped OSGeo (and, by proxy, Opticks) get into GSoC again this year. I am looking forward to mentoring a great summer of code. For interested parties, the official OSGeo GSoC page is here, and the Opticks project ideas page is here. We are also welcoming co-mentors – please message the Mailing Lists if you are interested. Finally, I have been acting on some suggestions from the community by updating the Opticks page on Wikipedia.

Opticks 4.8.0 - Change Your Default AOI Selection Tool

Ghosts of My Past

I have a confession to make. Almost every time I make an AOI in Opticks, I make the same mistake. I click and drag to try to draw a rectangle and get a single pixel staring back at me mockingly. With a new option in Opticks 4.8.0 I now have an ally in my battle against this little dot. Opticks now allows me to change the default AOI pixel selection tool. So long, little dot! Hello nice, friendly rectangle! Here is where to find the option:

Opticks Python Extension - Taming the Snake


Before anyone flames me, I am well aware that the Python programming language is named after Monty Python and not the snake.

But this is becoming far too silly; I should get on with it!

Preparing to Strike (or: Before You Begin)

First things first. You will need to have a distribution of Python installed on your machine. Oh, and make sure to get a version supported by Opticks. If you are not sure what to get, check for compatibility here. As of the time of this writing, only Python 2.5 and Python 2.6 are supported, and only Python 2.6 supports 64-bit.

Then download and install Opticks and the Python Scripting Extension.

Download Opticks Download Extensions

Taming the Snake (or: Installing and Running Python)

If you have not already done so, install the Python extension. Depending on where Opticks is installed and what OS you are using, you will need to run Opticks as administrator (or root). Some users will be able to simply drag and drop the AEB file onto the Opticks application. If this does not work, then you will need to use the Extensions dialog. Detailed instructions for installing extensions are available here. Make sure to restart Opticks after installing the extension.

And now for something completely different. Once Python is installed, you should be able to see it in the Opticks Scripting Window. Open the Scripting Window by selecting "Scripting Window" from the "Tools" menu. Now you can enter commands. Here is an example using some Powerful Python One-Liners which amused me. Click on the image for a larger view:

Wrapped up in Coils (or: Troubleshooting)

On certain machines (I wish I could invest the time to narrow this down, but, alas, I cannot), Python will not show up correctly in Opticks. This can usually be attributed to Opticks not being able to find Python for some nebulous reason. Rather than starting some sort of Spanish Inquisition into the problem, I will show you two simple techniques for fixing it.

  • Change the "Python Home Location" to point to the directory where Python is installed. This value may also be stored in the PYTHON_HOME environment variable. This setting is available from the Options dialog. Click on the image for a larger view:

  • If that still does not work, try adding Python to your PATH environment variable. If you do not know how to do this, see the following section.

How to Recognize Different Types of Trees From Quite a Long Way Away (or: Environment Variables)

An environment variable is really no more than a hidden setting on your computer. Do not be afraid of them, although I should warn you that messing them up can have consequences (up to and including needing to reinstall the operating system). In this example, I am going to show you how to modify an environment variable called PATH. In simple terms, the PATH is essentially the master list of where your computer should go to find programs. For the Python Scripting Extension, we need to make sure that the Python shared library can be located. [Side note: Many people incorrectly refer to a shared library as a DLL. The truth is: a DLL is a shared library, and a shared library is not necessarily a DLL. For the purposes of this article, however, they are close enough to be considered equivalent. Although they a bit different. A bit...]

Now that we understand what the PATH does, how can you change it? This depends on your operating system. This question has been answered many times. One gotcha is that in Microsoft Vista and 7, users without administrator privileges may have trouble changing their PATH. This question has also been answered here. It took me awhile to find the "Change my environment variables" link referenced from that article, so here is a screenshot pointing out its location:

Change your PATH to reference the directory containing the Python shared library. On Windows, this is usually C:\Python25 or C:\Python26. Some distributions of Python even throw it into C:\Windows\System32 or another system folder. Once you have changed your PATH, you should be able to restart Opticks and try again. If you continue to have problems, please let us know via our Mailing Lists or real-time chat. There are more advanced steps which can be followed, however, they are outside the scope of this article.

I am Here for an Argument

Other than the title of this section, this article contains 5 obvious (or not-so-obvious) references to Monty Python. If you think you have found them all, let us know on Twitter or Facebook!

Keep it Brief (Very Brief)


Nothing can be better than something. Especially in batch mode. Especially when calling OpticksBatch a lot. And especially when logging every line of output to a file. Opticks has provided a "brief" command-line argument to OpticksBatch for quite some time. But it was still too much. Users wanted less. So we gave it to them. In Opticks 4.8.0, you can now specify "verybrief". And it is very, very brief. You only get startup, shutdown, warning, and error messages. Here is a screenshot (click on it for a larger image):

If you are curious about the software used in that screenshot, I am using a free and open source program called Console. I use it primarily because it has tabs. I like tabs. And I like open source software. If it's free, it's for me!

Easy Image Linking with Opticks 4.8.0


Opticks has, for a long time, had a feature known as Image Linking (or just Linking). Linking lets the user use either pixel or geographic coordinates to keep multiple windows in lock-step while zooming and panning, which can come in pretty handy. This feature is especially useful for looking at the same area over time, images covering the same area from different sensors, or comparing processed data to raw data.

In this example, I am going to compare the old (and somewhat tedious) method of linking with the new and much improved method available in 4.8.0. I will be using data from Landsat7 ETM+ which is available from our sample data downloads page here. Kudos and thanks go out to both the Landsat7 ETM+ team and USGS for providing us with this great imagery.

Before You Begin

Download and install Opticks, and download the sample data and extract the archive. I used 7-zip for extraction, which is available here.

Download Opticks Download Sample Data


Open Opticks, and import all of the .re.ice.h5 files from the archive (there should be 3 altogether: spectral, thermal, and pan). You can do this either by using the "Import Data" command from the "File" menu or the toolbar button ( ), or, if you prefer, you can drag and drop the files onto Opticks. As a side note, you can drag-and-drop multiple files at once, and you can use the "Import Options" dialog if you drag-and-drop using the secondary (e.g.: right) mouse button. For this example, I did not change any import options, so a regular drag-and-drop will do the trick for us. The files should load without any errors, although there will be a warning "Unable to load statistics" for each file. This is normal and is expected for these files (I believe that they use an older file format which did not support statistics, although I did not confirm this information).

Now that the files are loaded, tile the windows for a better look. This can be done by selecting "Tile Horizontally" from the "Window" menu ( ). Now click within each window and press the 'e' key on the keyboard or click on the "Zoom to Fit" toolbar button ( ). The Opticks window should now look like this:

Image Linking With Opticks 4.7.1 and Earlier (or: The Old Way)

Historically, there have been two ways to perform linking. There is a toolbar button ( ), and there is a menu entry under "Tools" called "Link/Unlink...". Selecting either of those will invoke the Link/Unlink dialog.

Select any of the 3 images in the combo box (I chose "spectral"), and remember the name. Click "Next >".

The second page is the tricky part. Check the checkbox under "Views" (you may have to click twice. This is an annoying little bug that we would love to have fixed by someone in the community. Send us a patch!). Make sure that "Automatic" Link Type is selected and that the link is two-way by clicking the "Two-Way" checkbox. Just make it look like the image above and click "Next >" again.

We are almost halfway done. (Hey, I warned you that the old method was tedious. Fear not – the new method is much faster!) Now select an image which does not match the image you selected on page 1 (I chose "pan"). Click "Finish". And click "OK" on the message boxes telling you about zoom/pan limits. No, you are not actually finished. Go back and reopen the dialog, and select a different set of images (e.g.: "spectral" on page 1 and "thermal" on page 3). Oh, and don't forget the annoying little bug on page 2. And the message boxes - yikes!!

Image Linking With Opticks 4.8.0 and later (or: The New Way)

Now forget about the Link/Unlink dialog. Unless you want to do something fancy, you will probably never need it again. The Session Explorer now has Link/Unlink capability built into it. From the Session Explorer, select all 3 windows by shift-clicking or ctrl-clicking. Right-click (or left-click for us southpaws!) on your selection and click "Link" (note: if you have already linked the images as described above you will need to click "Unlink" first). Presto! This does the same thing as the Link/Unlink dialog! I should also mention that you can do this with one click. There is a new "Link All Windows" toolbar button ( ) and a corresponding entry under the "Tools" menu.

For the power users out there I should also mention that there is an options page to control the Link Type. It is under "Tools" -> "Options". The Link Type option is under "Windows" -> "Workspace" -> "All". Here is a screenshot showing its hiding place:

How to Use Opticks While Images Are Linked

So now that the images are linked, you can use the normal zoom and pan functions in Opticks. This should move all of the views within the windows around automatically and keep them in lock-step. Here is a sample screenshot:

By the way, you can also unlink images once you are done. Either use the Link/Unlink dialog and select "Unlink" as the Link Type, or (4.8.0 and later) select one or more windows using the Session Explorer and select "Unlink".

Bonus Question

The final screenshot above is from Opticks 4.7.1. There is one toolbar button present in Opticks 4.8.0 which is missing from this screenshot. Another hint: it was mentioned somewhere in this tutorial. Can you find it? Tweet the answer to us or post it on our wall!