PeakSearch processes images, typically found in a single directory. You can add images or directories using the Image Navigator, or you can specify the files by setting the stem with the correct file path in the Stem field in the PeakSearch Options View, more in the way the Python Peaksearch is run from the command line.

There are essentially two modes of operation for PeakSearch. These are selected by the Link to Image Navigator check box in the PeakSearch Options View. It is suggested that you only use one of the modes and do not switch back and forth between them. The default mode can be set in Window | Preferences | PeakSearch.

Link To Image Navigator- Checked

This was the original intent of the PeakSearch GUI. In this mode you select image files in the Image Navigator. Changes you make in the Image Navigator are automatically inserted into the Stem, Format, First, Last, Outfile, and the Working Directory fields in the PeakSearch Options View. When you run, the files used are those in the Image Navigator. Any other peaksearcher.py options are taken form the remaining fields in the PeakSearch Options View. You can also change the Stem, Format, First, Last, Outfile, and the Working Directory fields from the PeakSearch Options View, and these changes are remembered by the Image Navigator. This mode is appropriate for straightforward cases. It has a number of issues, however:

This mode can be convenient to use as long as you are aware of the caveats.

Link To Image Navigator - Unchecked

In this mode there is no connection with the Image Navigator. The options are as set in the PeakSearch Options View. The image files used are determined by the Stem, First, Last. Format, and Ndigits in the same way as they would be if you used Peaksearch from the command line.

XML Options Files

The Python Peaksearch does not take an input file but rather has command-line options. The PeakSearch GUI uses an XML options file to both store the command-line options and to save configuration information for the PeakSearch Options View in the GUI.

You can save and load the XML options files, much as you would save and load input files for other programs. You use the PeakSearch Options View to edit the XML options rather than using a Text editor. You can alternatively use a Text Editor, but it isn't suggested, as the XML parser used is sensitive to how the XML file is formatted (even though it should not be).

Note that all of the GUI configuration information is also in the XML options file in addition to your saved values. This is an unfortunate mix of the model (data) and the user interface (configuration). It may be changed in the future. For now, you can just treat the XML options file as an input file for PeakSearch and edit and save it in the PeakSearch Options View and ignore the configuration information.

Also note that the XML options files include both values and defaults. The default values are reset when you run, so reset does not necessarily take you back to the original defaults in the file. You can reload the file to do that. In the same way, when you save an XML options file, the defaults that get saved are the current values.

When you start Fable, the options you see in the PeakSearch View when no file or sample has yet been loaded are the default options. By default this is an internal file supplied with PeakSearch. It has the defaults from the Peaksearch Python application, as well as the proper configuration for the PeakSearch GUI. You can specify your own file to use for the startup defaults in Preferences and you can also restore the internal file.

Working Directory

When running Peaksearch from the command line you would probably change to the images directory before starting Peaksearch and specify the stem relative to that directory. This has the advantage that the image file names, which are written into the .spt file do not have a path in the names. This is convenient in case the image files are moved, as is often the case. Alternatively, you could specify the stem with a full or relative path and run from another directory.

When running from the Fable Workbench, however, it is not easy to change the directory where Peaksearch is run. The current working directory (CWD) for Fable is the workbench directory. When Peaksearch (or any other Fable application) is run, it will, by default, be run from that directory. In the case of PeakSearch the working directory is set in Jep (via os.chdir) before using Jep to run the Python Peaksearch.py in order to avoid this problem. There is an option, Workdir, that allows you to set this directory. If it is left blank, the CWD for Fable will be used. As long as the stem is specified with a full path, this is OK. Alternatively, you may set the Workdir yourself, and it is set automatically from the Image Navigator when Link to Image Navigator is checked.

In case you are unsure of what the CWD for Fable is, you can determine it via Help | About Fable | Configuration Details. Look for user.dir.

In the original implementation of PeakSearch, you could select multiple directories in the Image Navigator and the CDW for each image was taken to be the directory for that image file, at the expense of always having the CWD be the image directory. In the current implementation, you can specify the working directory, Workdir, in the options, and there are advantages to having it be elsewhere than the image directory. Perhaps you would prefer it to be in an analysis directory someplace else, for example. Since the Workdir can only be specified in one place, the options, it is no longer possible for it to be different for each image file. Thus it is no longer feasible to process multiple directories at the same time. Note that the Python Peaksearch does not process multiple directories at the same time, either.

Workdir is not a peaksearcher.py option, at least at the time this page was written. Unlike the other options it is not sent to peaksearcher.py and it does not appear in the Peaksearch options, in particular those shown in the dialog you get from PeakSearch | Options | PeakSearch Command-Line Options. From the point of view of the GUI interface, however, you can treat it as if it were a peaksearcher,py command-line option.

Step by Step

  1. Load a PeakSearch XML options file into the PeakSearch Options View via the PeakSearch menu, via the button at the top of the PeakSearch Options View, by right clicking on an options file in the Navigator, or by dragging an options file from the Navigator.
  2. Add directories or files in the Image Navigator View, or set the stem of the files to process directly in the PeakSearch Options View with the correct path, depending on the value of Link to Image Navigator.
  3. Modify the Peaksearch options as needed in the PeakSearch Options View.
  4. Save your options via the button at the top of the PeakSearch Options View.
  5. Launch Peaksearch via the button at the top of the PeakSearch Options View.
  6. View 2D peaks output (.spt) by opening the .spt file via the PeakSearch menu or by right clicking a .spt file in the Navigator.
  7. View 3D peaks output (.flt) by opening the .flt file via the PeakSearch menu or by right clicking or double clicking a .flt file in the Navigator.

1. Which stem?

The stem specifies the prefix of the image files, not including the number part and extension. The image files are expected to be of the form <stem><nnn>.<ext> , where <stem> is the stem, <nnn> are numbers with a fixed number of digits, and <ext> is the file extension, e.g., edf, tif, etc. The stem can optionally include a path.

Peak Search on Image Viewer Directories

With Link to Imager Navigator checked in the PeakSearch Options View, go to the Image Navigator View and click on "Add directory..." and select a directory containing image files. You can also do this from the ImageViewer menu. Files are loaded in the table (right pane) with their corresponding directories in the left pane. Only files with extensions set in Window | Preferences | Fabio Files are loaded. (See Preferences.)

You could previously add several directories to launch WITH THE SAME options for all of them EXCEPT for the Stem, Format, First, and Last which vary for each sample, (See Options for a description of these options.) It is no longer feasible to do this (see above), and you should be sure only one directory is loaded in the Image Navigator.

Peak Search on One Stem

With Link to Image Navigator checked in the PeakSearch Options View, load the files/directory to run in the Image Navigator View or go to Step 2 if Link to Image Navigator is not selected.

 

2. Options

Note that to be analyzed, Peaksearch needs contiguous files.

If you have no images in the Image Navigator, set the stem as you would have done on the command line.

Stem Example
  • You want to search peaks on files filestem_00.img to filestem_99.img.
  • The current image file directory is : ~home/usr/user1/data.
  • The Fable application runs in your workspace directory, but you have not set Workdir.
  • The stem should be set with the full path or relative to the workspace directory, for example:
    • ~home/usr/user1/data/filestem if Fable is running in some unrelated directory.
    • filestem if Fable is running in the data directory.
  • If you have set Workdir, then the stem should be set relative to Workdir.
    • ~home/usr/user1/data/filestem will always work, but the full path will appear in .spt files.
    • filestem if Workdir is the data directory.

3. Launch

If all options are right, launch PeakSearch. If you can't, an error message is displayed in the Console. While PeakSearch is running, the output appears in the Console. When it is done, it tells you where the output files were created and gives you some hints as to what to do next.

4. View Output Files

Peaksearch produces two types of output files in the output directory:

There will be one ..flt file and one .spt file for each threshold specified. Peaksearch takes your Outfile option and appends a .spt extension if none is given. If the Outfile ends in xxx, it becomes xxx.spt. Peaksearch then makes .flt and .spt files using this as a template. The final file names are then of the form xxx_t<value>.flt and xxx_t<value>.spt, where <value> is the threshold value for that file.

You can specify the Outfile with a path, e.g. mydir/xxx to have the files go to another directory than the work directory.

Outfile Example
  • Current image file directory is : ~home/usr/user1/data.
  • The Workdir is the same as the data directory, ~home/usr/user1/data as it will be if you are using Link to Image Navigator.
  • You have a subdirectory, TotalCryst, in the image file directory where you want to have your output files.
  • In the Outfile option set one of these two paths:
    1. ./TotalCryst/peaks
    2. ~home/usr/user1/data/TotalCryst/peaks

Once peaksearch has finished, you can open the output files.

Open a 2D .spt File in the PeakSearch SPT View

You can do this by using PeakSearch | Open 2D Peak File (.spt), or by right clicking the .flt file in the Navigator and selecting Open With (Other).

Open a 3D .flt File in the ColFile Editor

You can do this by using PeakSearch | Open 3D Peak File (.flt), by double clicking the .flt file in the Navigator. or by right clicking the .flt file in the Navigator and selecting Open With (Other). The reason you can double click is that the .flt extension is associated with an editor, in particular, the ColFile editor. The .spt extension does not yet have an associated editor.

In the Navigator you can also choose to open these files with other editors, in particular the Text Editor. You do this by right clicking the file and choosing Open With. You can also compare two files by selecting both of them and right clicking, then selecting Compare With.

5. Save your PeakSearch Options

When you first start Fable, default options are set in the options text fields in the PeakSearch Options View. But you can save your own. Options are saved in an XML Options File. You can save or load them via the PeakSearch | Options menu or with the buttons on the top of the PeakSearch View. See the User Interface for more information.

You can, of course,save at any time, not just after a run.