Visualisation Window

As mentioned in the User manual the visualisation window is very complex. This window is used by a large set of plug-ins and is under continuous development.

The module functions by creating x python instances that are used for the computing of caches. These caches are determined based on the allocated memory by the user.

Basic Function

The window must be created with the following parameters:

  • InputList, This is a python list that contains all the File Paths of the files that need to be displayed. Where the first axis is the number of plots and the 2nd axis the number of images per plot. In this way complex visualisation windows can be constructed. This results in a 2D list that structured as follows:
[[Img1,Img2,Img3,...,ImgX],                     (Plot 1)
        .
        .
        .
[Img1,Img2,...,ImgZ]]                           (Plot Z)
  • CommID, The communications ID must be generated by the user and will be added to all of the commands (see commands section) that can be sent to the program. This is done to make sure that two windows open at the same time do not communiate with each other and as such tasks can be separated.
  • SelectRegion, A boolean to determine if region selection is enabled or disabled.
  • SelectPoints, A boolean to determine if selection of points is enabled or disabled.
  • WindowSize, The window size in a tuple. (X,Y) This can be omitted since it has a default value of (960,540)

After creation commands can be sent to the window.

Commands

Commands can be sent by using the wx.lib.pubsub pub module. Imported as such: from wx.lib.pubsub import pub

There are two methods of sending commands that are being used. (in real life there are more, please refer to the appropriate documentation online)

  1. pub.sendMessage("COMMANDSTRING"+CommID,msg=(MESSAGE)), This is used to send a fast command however it does not take into account any timing, meaning that if many of these are sent the displayer can crash.
  2. wx.CallAfter(pub.sendMessage, "COMMANDSTRING"+CommID,msg=(MESSAGE)), This is used when timing is important and will bascially wait before sending the command and often works better. For more detailed information please refer to wxPython documentation.

Commands are sent by adding the CommID (a string) to the end of them. Make sure this ID is the same as the one when the window was created otherwise it will not ‘listen’. Here are the built in commands.

  • "WavelengthChange" + CommID

By calling the WavelengthChange the currently displayed wavelength can be changed. The msg to be sent along is as follows: msg = [[Band(s)],channel]

Where the Band(s) are a series of integers representing the bands to be displayed. (bands, not wavelengths so this conversion needs to be made first by the developer) The bands list is either 1 long such as: [10] or 3 long such as: [10,15,25] Where if 1 is sent a grayscale image is displayed and for three an RGB is made by the three bands.

The channel argument will determine which ‘items’ will listen to it. By default all images are on channel 0 meaning that if you do not change anything put this on 0. See “AddImageItem” for more information on channels.

  • "ControlFrameChangedPoints" + CommID

By sending this command the displayed points can be changed from the control frame. The msg to be sent is as follows: msg = [PlotNumber,Points]

PlotNumber is the number for which the points are changed. (the first plot is plot 0)

The Points is a 2D list with ALL the points to be displayed. It is structured as follows:

[[PointNumber,XCoordinate,YCoordinate],
        .
        .
        .
[PointNumber,XCoordinate,YCoordinate]]

Where the PointNumber is the number that is shown in the small box, and the coordinates are sent along.

  • "ControlFrameChangedROI" + CommID

Will continue on this later...