Skip to content

Beginning_to_work_with_Nip2

John Cupitt edited this page Mar 29, 2017 · 2 revisions

title: Beginning to work with Nip2 permalink: Beginning_to_work_with_Nip2

Origin

This page has been written as part of the NIP2 Beginners Guide.

Introduction

This chapter runs through how to use the nip2's user-interface, explaining how it works and some of the more general image processing functions available in the software. Before you can begin using nip2 you will need to ensure the software has be installed correctly as describe in chapter [#chap:install 4]chap:install. If installed correctly nip2 can be started either by clicking on the nip2 icon or from a command line. When opened the nip2 window will appear similar to figure [#fg:empty_workspace 5.1]fg:empty_workspace. The exact appearance of the nip2 window will depend on which operating system is being used and what display preferences have been set within the operating system. However, even though the window can be displayed in different ways the basic buttons and menu options will all be the same.

![](images/7.28-snapshot1.png)
Figure 5.1: An empty `nip2` workspace with one empty column, (untitled: column A), as displayed when the software starts up.

Getting started: workspaces, columns, buttons etc.

This section will describe the basics of how the nip2 software works and how to open and save files. The details of the nip2 main user interface window can be seen in figure [#fg:empty_workspace 5.1]fg:empty_workspace. The standard menus, textbfFile, Edit, View and Help contain the more general options and the Toolkits menu contains all of the image processing functions. This document will not describe all of the menu options and functions included in the nip2, for further informations please consult the resources supplied on the vips website.

Workspaces

A combination of all of the information displayed in the main nip2 window, all of the columns, images etc is referred to as your workspace. In addition to saving new images that are produced with nip2 workspaces can also be saved. Workspaces are saved as small text files that just record which images have been loaded in and what commands have been performed on them, therefore if you open an old saved workspace you can continue working exactly where you left off. If you are performing many different functions on one image you will not need to save the result of each process, just the completed workspace, then all of the functions can be performed again simply by reloading the workspace.

Columns

In order to organise your work, while using the nip2 software, the programmer has designed a column system. All information that the program is considering, images , numbers , etc. are listed in smaller special windows called columns. The columns produced by this program are each defined by a letter, the first column being 'A', the next 'B' and so on[#note38\ 1]. Objects entered into these columns, such as images, mosaicing instructions, etc. are defined by an alphanumeric code, (composed of the column letter and the object number), which is displayed in the object tag, (a retangular button positioned to the left of the object details), see figure [#fg:column_im1 5.2]fg:column_im1. If you have more than one column in your workspace then title bar of the currently selected column will be highlighted in green and will be a column command line at the bottom of the column. Columns can be deleted by CLMB on the "X" on the left of the title bar and can be closed/opened by CLMB on the down/up arrow on the right, if you HLMB anywhere else on the tile bar the column can be moved around the workspace. If you are working with a large number of columns it is good pratice to plan how the columns are named and positioned. New columns can be produced by CLMB on the [New] column icon, see figure [#fg:empty_workspace 5.1]fg:empty_workspace.

Column Titles

When they are created each column has a default title, untitled. You do not need to change the title of your columns, but if you would like to you can do so as follows:

  1. Select the column: by CLMB on the top of the column.
  2. Select the title: by DLMB on the current title.
  3. Edit the existing title and then hit [Return].

[Image:nipbeginguide011.png](/Image:nipbeginguide011.png "wikilink")
Figure 5.2: Two example columns: Column **A**, with the title **Images** contains three images identified as **A1, A2** and **A3**. Column **E**, with the title **Other** contains four objects, a number a slider an expression and a colour patch, identified as **E1, E2, E3** and **E4** respectively.
fg:column_im1


[Image:nipbeginguide012.png](/Image:nipbeginguide012.png "wikilink")
Figure 5.3: Two example columns, **A** and **B**, similar to those shown in figure \[\#fg:column_im1 5.2\]. Here several complex objects, **A1, B2** and **B3**, have been opened out slightly, by **CLMB** on the down arrow to the left of the object tag, to show some of the additional information stored within them.
fg:column_im2

Column Command Line

sec:col_command The column command line is a white text box that appears at the bottom of the currently selected column. This command line allows the user to perform text based functions and commands on existing objects or to create new objects, in addition to the functions that are available the standard menus. For example:

  • A simple number object can be created just by typing in the number and hitting [Return].
  • nip2 can be used as a calculator; typing in 25 * 4 and hitting [Return] will produce a new object with a value of 100.

A large variety of other functions can be directly applied using this column command line. Where it is used to perform a specific operation in this document further information will be given explaining exactly what needs to be typed in.

Objects: Images, numbers, etc.

All images, points, regions, the results of functions, etc that are defined or used within nip2 are all entered into columns, all of these entries will be referred to in this document as objects. All new objects will be added to the bottom of the currently selected column. The title bar at the top of the currently selected column will normally appear be green.

Selecting objects

Selecting objects in your columns can be done simply by CLMB over the tag associated with the particular object. When you have selected an entry the button will become green. In order to select more than one object at the same time you will need to hold down the shift or ctrl key while you CLMB on different object tags, again each of the selected tags will turn green. When using menu commands, within nip2, which use or act on existing objects, the program will initially look for the right number of specifically selected objects, from all of the columns. If no entries are selected, the program will then automatically try to use the last few entries listed in the currently selected column. Please note that if the program finds the wrong number of selected entries, or the wrong type of entries at the bottom of the selected column an error message will be produced. This is a very common error, caused by accidently selecting objects and can be solved by just selecting the correct objects.

De-selecting objects

If an object is selected and you CLMB on a different object the original object will be de-selected and the new object selected. To de-selected all objects CLMB on any blank area of your workspace.

Complex objects

Simple objects such as numbers, see object B1 in figure [#fg:column_im2 5.3]fg:column_im2 just contain their value, in this case 123, and details of how the number was produced, for example; "123", "100 + 23", "23 + (5 * 20)", etc. Complex objects, such as images, can contain much more information, such as image path, width, height, etc. All complex objects have two small arrows to the left of the object tag. CLMB on the up arrow will close up the object, displaying less information, and CLMB on the down arrow will open up the object, displaying more information, in the form of further simple and complex objects. The effect of opening up some objects can be seen by comparing figure [#fg:column_im2 5.3]fg:column_im2 with figure [#fg:column_im1 5.2]fg:column_im1. For most processes in nip2 all of the required object information will be displayed automatically and accessing the hidden information will only really be required for more complex operations.

Image objects

Images opened with nip2 are entered into the current column as an object with the image details[#note39\ 2] and a small thumbnail. The full size image can be viewed by DLMB on the thumbnail, or the object tag, this will open the image in a separate window, for further information on the image view window see section [#sec:im_view 5.6]sec:im_view.

Open File Windows

The "open file window" will be displayed if you select [File]:[Open] from the menus, or CLMB on the [Open] icon in the main nip2 window, see figure [#fg:open 5.4]fg:open. This window is used to load all files into nip2, including images , workspace files and matrices. There is also a [File]:[Open Recent] to quickly reload recently accessed files. On most computers[#note40\ 3] you can also drag files from your file-manager directly into nip2's main window to open them into the software. The open file window options include the following features:


[Image:nipbeginguide013.png](/Image:nipbeginguide013.png "wikilink")
Figure 5.4: Open file window
fg:open

Location When the nip2 "open file window" opens it will normally display the contents of the directory in which the software was started from. The nip2"open file window" offers four different options to move to different directories:

  1. You can move directly into any of the directories listed on the left-hand side of the window by DLMB on the name of the directory.
  2. You can move into directories within the current directory, i.e. those listed in the list on the right-hand side of the window, by DLMB on the name of the directory.
  3. To move back up the directory tree CLMB on the directory buttons displayed above the right-hand file list. The number of buttons displayed here will depend on the size of the "open file window", the length of the directory names and the current position in the directory tree. Small left and right buttons are provided on either side of the directory buttons to change which ones are displayed.
  4. Finally, if you press [Ctrl]+[L] you are given the option to type (or copy-paste) the address to a specific directory.

Bookmark Controls The directory list on the left-hand side of the window lists a standard set of commonly used directories. The current directory, being displayed by the open window, can be added to the list or bookmarked by CLMB on the [Add] button. Any of these bookmarked directories can be subsequently removed from the list by CLMB on the [Remove] button. an exact location.

Pin up option Normally the open/save file window closes after you have opened or saved something. If this option is checked, the window will stay up instead — this is useful if you want to load or save a series of objects.

File type filter Below the main file list on the right-hand side of the open window is a drop-down option which controls what type of files the window will list. This option can be helpful when sorting through many files for a particular file or image type. By default this option is set to JPEG image files ..., but there's a preference option to alter the default format. In addition to the listed, TIFF, JPEG, PNG and PBM/PGM/PPM image formats nip2 can open most standard image types and these can be listed by changing the file type filter to All files (*).

Show thumbnails Pressing this button pops up a window which shows thumbnail-sized images for all the image files listed in the current directory.


[Image:nipbeginguide014.png](/Image:nipbeginguide014.png "wikilink")
Figure 5.5: Two views of the save file window: The upper image shows the default view and the lower image shows how the window appears after the **Browse for other folders** options has been selected.
fg:save

Save File Windows

sec:save A simplified view of the "save file window" displayed if you select [File]:[Save] from the menus, or CLMB on the [Save As] icon in the main nip2 window and will allows you to save the workspace. To save images you will need to CRMB on the object tag or thumbnail and select [Save As] from the resultant menu, or select [File]:[Save] from the menus offered in an image view window. This simplified view is shown as the upper image in figure [#fg:save 5.5]fg:save. If you need to save your file in a different directory or wish to see additional options you can CLMB on the Browse for other folders option to convert the window to the non-simplified view, see the lower image in figure [#fg:save 5.5]fg:save. The non-simplified save file window offers many of the same options provided in the open file window. The one main addition is the Increment button option. If pin up and increment are both selected, then after a save nip2 will attempt to add one to the selected file name. For example, if you save a file called fred001.v, after the save nip2 will put the name fred002.v into the selected file name box. Again, this is useful if you want to save a series of images.

Group and Ungroup: Batch processing in nip2

sec:group Many of the image processing functions, within nip2, that are designed to act on images, such as resizing, cropping , sharpening etc, can also be performed on a group of images. If you select a group of images, see section [#sec:selectob 5.2.3]sec:selectob, and then run the function: [Main Window]:[Edit:Group] the images will be combined to form an image group object. When a further function, such as resize, is applied to the current group object another group object will be produced containing a resized version of the each of the images in the original group. The final group object can then be ungrouped using the [Main Window]:[Edit:Ungroup] functions or saved. When saving a group object you will be presented with the same options give when saving a single image, however the filename you give, e.g. group001.v will automatically be incremented and used for each of the images in your group, thus producing group001.v - groupxxx.v, where xxx is the total number of images in your group.

Image Viewer: menus, controls and other options.

sec:im_view The full resolution version of an image can be viewed in nip2 by DLMB on the images thumbnail or the appropriate object tag. In addition to the basic menu bar there are four optional toolbars, Status, Display control, Paint and Rulers, see figure [#fg:image_window 5.6]fg:image_window. By default these additional toolbars are not displayed, but they can be added or removed using the the [Image Window][View:Toolbar] menu. A selection of shortcuts and key controls are given in table [#tb:shortcuts 5.1]tb:shortcuts explaining how to move around the image window and to zoom in and out of an image.

sec:toolbars Status Toolbar This toolbar displays the basic images details, (size, bit-depth, etc), the current display magnification level and position and value details related to the particular pixel your mouse pointer hovers over.

Display control The two scroll bars effectively allow the user to adjust the brightness and contrast of the display. It should be noted that this does not actually change the image in any way, just how it is displayed. The first number is known as the scale value and the second as the offset value. The displayed image is the result of multiplying the image by the scale value and then adding the offset value. If you CLMB on the arrow button on the left you are presented with an additional menu of options:

; Scale

searches the area of the image you are viewing for the darkest and brightest points and chooses settings for the scale and offset sliders which will stretch the image to use the full range of your screen.

; False colour

tries to make small differences in brightness more visible by colour-coding them.

; Interpret

, which is turned on (it is by default), then nip2 will look at the Type field in the image header, and use that as a hint when transforming the image to a viewable form for you. This is usually the behaviour you want.

; Reset

moves the sliders back to the default positions of 1.0 and 0.0.

Paint This toolbar offers a selection of basic painting tools and options for adding text to your images. These functions will be discussed in more detail in section [#sec:paint 5.13]sec:paint.

Rulers This option places add rulers to the left and top edges of the window which you can use to measure numbers of pixels. If you HLMB on either of the rulers and then drag the mouse over the images you can create a guide. Guides are useful for lining up other things in the view window.


[Image:nipbeginguide015.png](/Image:nipbeginguide015.png "wikilink")
Figure 5.6: An example image view window, with all four toolbars turned on.
fg:image_window


| | | |:-------------------------------------------------------|:------------------------------------| | **Keys in image view window** | **Action** | | `i` | Zoom in on mouse pointer | | `o` | Zoom out | | Cursor up/down/left/right | Scroll a small amount in direction | | Shift plus cursor up/down/left/right | Scroll a screenful in direction | | Ctrl plus cursor up/down/left/right | Scroll to edge of image | | Middle mouse drag | Pan image | | Mouse wheel | Scroll up/down | | Ctrl + Mouse wheel | Scroll left/right | | Shift + Mouse wheel | Zoom in/out | | (zero key) | Zoom out to fit image to window | | `1`, `2`, `4`, `8` (number keys) | Set magnification to 1, 2, 4 or 8 | | Ctrl plus `2`, `4`, `8` | Set zoom out factor to 2, 4 or 8 |
Table 5.1: `nip2` shortcuts for the image view window
tb:shortcuts

Short cut keys, and the reassignment of shortcut keys.

Details of some of the more common short cuts used in the image view window have already been given in table [#tb:shortcuts 5.1]tb:shortcuts, however it is possible for you to define your own additional shortcuts. When the mouse cursor is hovering over any of the menu options the name of the option or function will go white and the background for the name will go blue, if you then press a key or combination of keys, for example [ctrl] + [l], the key combination will be applied to that option or function as a shortcut. These shortcuts can be changed by just applying a new one or removed by pressing the backspace button.

Marks, regions, arrows and guides

sec:regions Marks, regions, arrows and guides all provide ways of defining particular parts of an images, see figure [#fg:regions 5.7]fg:regions.


[Image:nipbeginguide016.png](/Image:nipbeginguide016.png "wikilink")
Figure 5.7: Methods of defining points, areas, etc in `nip2`; **C1** defines a region of space, **C2** defines an arrow or line vector, **C3** defines a mark or point and **C4** and **C5** define vertical and horizontal guides respectively.
fg:regions

Marks or points are used to define a particular point or (x,y) coordinate on an image, they are commonly used during the image mosaicing process, see chapter [#chap:mosaic 6]chap:mosaic. Hold down the [ctrl] and then CLMB on the point in an image where you wish the Mark to be placed.

Regions define rectangular areas on an image, they actual represent the easiest method for cropping an image, see section [#sec:crop 5.9.3]sec:crop, but are also used in a variety of other functions. Hold down the [ctrl] and then HLMB on the point in an image where you wish the region to start and then drag the mouse down and to the right. The position and size of the region can be adjusted after it has been created.

Arrows sec:arrow or vectors can be used to define a particular line across an image. Hold down the [ctrl] and then HLMB on the point in an image where you wish the Mark to be placed and then drag the mouse up and to the left. The position and direction of the arrow can be adjusted after it has been created.

Guides are a special kind of arrow which can be used to define a straight line vertically or horizontally across the image. They can be used to help position marks or regions or just to help define a particular part of an image that you are working on. Ensure that the Rulers toolbar is on, then HLMB over either of the rulers and then drag the mouse right or down.

Once created all of the objects can be moved by HLMB over the object tag in the image view window and dragging them to the required position. Regions and arrows can be resized in the same way as normal computer windows, HLMB over the edge, corner or end, as required, and then drag the mouse to the required position. The size and position values can also be set to particular numbers by DLMB over the coresponding object tag and then altering the numbers in the small window that will appear.

Common image processing functions.

Here is a description of some of the more common basic image processing functions, examples of these functions can be seen in figure [#fg:cfunctions 5.8]fg:cfunctions

Rotate

sec:rotate nip2 provides two main methods for rotating images, fixed or free rotation. Fixed rotation allows control rotation in increments of 90, once the function has been run an option is provided within the rotated image object to change between 90, 180 and 270, see H2 in freffg:cfunctions. The free rotation function gives the user complete control to define a specific angle of rotation by adjusting the angle slider provided within the rotated image object, see H3 in freffg:cfunctions.

  • [Main Window][Toolkits: Image: Transform: Rotate: Fixed: 90 Degrees]
  • [180 Degrees] or [270 Degrees]
  • [Main Window][Toolkits: Image: Transform: Rotate: Free]

Flip

sec:flip Images can be flipped , left-right or top-bottom with the following commands, for an example of a left-right flip see H4 in freffg:cfunctions.

  • [Main Window][Toolkits: Image: Transform: Rotate: Flip: Left right]
  • [Main Window][Toolkits: Image: Transform: Rotate: Flip: Top bottom]

Crop

sec:crop The simplest method of cropping an image is simply to create an appropriately positioned region on the image, see section [#sec:regions 5.8]sec:regions, as an region object is represented by a cropped version of the image the region is placed on. Alternatively the crop command can be used to directly apply a particular crop. This command will automatically extract the central quater of an image, but provides the opportunity to alter the values defining position and size of the crop, see H5 in freffg:cfunctions.

  • [Main Window][Toolkits: Image:Crop]

Resize

sec:nipresize In nip2 you can either resize an image to a particular pixel size or multiplying the current size by a number or scale factor. When using the [Size to] option, see H7 in freffg:cfunctions, the user can set a specific pixel size and chose which edge is being set to that size. With the [Size to] option, see H6 in freffg:cfunctions, the user can set a different scale factor for width and height. Please note that at the time of writing both the scale factors need to be either, (greater than or equal to one) or (less than or equal to one), i.e. (0.5, 0.23) or (1.23, 4) not (0.34, 5). If you do want to make one side bigger and one smaller use the function twice and apply the two scale factor separately.

  • [Main Window][Toolkits: Image: Transform: Resize: Size to]
  • [Main Window][Toolkits: Image: Transform: Resize: Scale]

[Image:nipbeginguide017.png](/Image:nipbeginguide017.png "wikilink")
Figure 5.8: Examples of some of the more common image processing functions; rotation, flip, crop and resize.
fg:cfunctions


[Image:nipbeginguide018.png](/Image:nipbeginguide018.png "wikilink")
Figure 5.9: Examples of the three selection tools included in `nip2`, Ellipse, Tetragon and Polygon.
fg:select

Selection Tools

sec:select In addition to the the placement of regions, see section [#sec:regions 5.8]sec:regions, nip2 provides three other functions to select areas of an image, ellipse, tetragon and polygon. By default all of these functions will return an image with the selected area shown in white on a black background. However an option is provided, as can be seen in figure [#fg:select 5.9]fg:select, to allow the user highlight their selection in a variety of ways.


[Image:nipbeginguide019.png](/Image:nipbeginguide019.png "wikilink")
Figure 5.10: Two example polygons, **A**: an example of a four sided concave polygon, **B**: an example of a four sided convex polygon.
fg:concave_vex

Ellipse : The ellipse function can be performed on an arrow object, see section [#sec:arrow 5.8]sec:arrow. The starting point of the arrow defines the central point of the ellipse and the direction and length of the arrow defines the orientation and maximum radius. The width of the ellipse is controlled by a the width option included within the select ellipse object, see B3 and B4 in figure [#fg:select 5.9]fg:select.

  • [Main Window][Toolkits: Image: Select: Ellipse]

Tetragon : The tetragon function requires four marks or points, see section [#sec:regions 5.8]sec:regions. The function uses the four marks to define the four corners of a tetragon. The marks do not need to be selected in any particular order as they will be reordered by the function. NB: this function will only work for convex tetragons, if you need to define a concave tetragon use the select polygon function.

  • [Main Window][Toolkits: Image: Select: Tetragon]

Polygon : The polygon function requires a group[#note41\ 4] of marks[#note42\ 5]. For this function to work correctly the marks need to be selected in order, grouped and then the function can build the correct polygon. There is no defined limit to the number of marks that can be used to define a polygon, however the mores marks included the longer the function takes to calculate the result. This function can be used to define concave and convex polygons, see figure [#fg:concave_vex 5.10]fg:concave_vex.

  • [Main Window][Toolkits: Image: Select: Polygon]

Cloning

sec:clone

Still need to do clone stuff.

Recover after Crash

The recover function can be used to reload the workspace you where working on if the nip2 software crashes.

  • [Main Window][File: Recover after crash ...]

Painting Tool Bar

sec:paint


[Image:nipbeginguide020.png](/Image:nipbeginguide020.png "wikilink")
Figure 5.11: `nip2` paint bar, taken from an image view window.
fg:paintbar

The paint toolbar, see figure [#fg:paintbar 5.11]fg:paintbar, can be accessed in any image view window by selecting the appropriate menu:

  • [Image Window][View: Toolbar: Paint]

Unlike the other processes in nip2 using the painting tools on an image directly alters the image object you are working on. Therefore if you open a vips image and then work directly on it with the paint toolbar you will change the actual image file saved on your computer, in this case you will be given a warning message. If you are using non vips format images or you are using the paint toolbar on an image that has been created within your current workspace as the result of other image processing functions this issue will not arise as nip2 will be painting onto a temporary file rather than the original. It should also be noted that changes made with the paint toolbar can be lost if the image they where performed on is recalculated[#note43\ 6]. The paint tool bar provides a basic set of painting tools including:

Read ink into inkwell : Selecting the "dropper" icon allows the user to copy the colour or pixel value of any of the pixels in an image. Move the mouse pointer over an area of the image and CLMB.

Freehand draw : The simple "pen nib" icon allows the user to draw, freehand, across an image using the currently selected nib size and colour. HLMB and move the mouse around.

Draw straight lines : The more complicated "pen nib and lines" icon allows the user to draw straight lines across an image using the currently selected nib size and colour. HLMB and move the mouse to define a line and then let go draw the line.

Fill rectangles : Selecting the "dotted rectangle" icon allows the user to draw rectagles on an image, filled in with the currently selected colour. HLMB and drag the mouse to define the size of the rectangle and then let go of the mouse button to fill the selected space with colour.

Flood while pixel not equal to ink : The first of the two paint bucket icons allows the user to flood an image with the currently selected colour, starting at a chosen point. The selected colour floods out from a given point until it reaches a complete boundary of the same colour. CLMB on any point of the image.

Flood while pixel equal to click : The second paint bucket icon again allows the user to flood an image with the currently selected colour. In this case the selected colour will only flood into the surrounding pixels that are exactly the same colour as the clicked pixel. CLMB on any point of the image.

Draw text : The "T" icon allows the user to paint text onto an image, this option will painting any text entered in the text box on the right-hand side of the toolbar in the selected colour, size and font. CLMB on the position you wish the text to be placed.

Smudge : Selecting the "Pointing Finger" icon allows the user to smudge or blur specific areas on an image. The width of the blur is dependant on current view magnification, i.e. by zooming in on an image the blur will effect a smaller number of pixels. HLMB and move the mouse around.

The selected colour can be changed using the "dropper" icon, but it can also be adjusted directly. DLMB on the small patch of colour, by default it will appear black, to the left of the font details. This will open up the Edit Colour window, see figure [#fg:paintcolour 5.12]fg:paintcolour. The selected colour can be adjusted by CLMB or HLMB over the colour wheel or by adjusting the numbered values to the right of the window.


[Image:nipbeginguide021.png](/Image:nipbeginguide021.png "wikilink")
Figure 5.12: `nip2` edit colour window.
fg:paintcolour


[1] [2] [3] [4] [5] [6]

References

[1] If you delete columns during your work the column letters do not reset, so if you have been working with three columns, if you delete C and then open a new column, the new column will be column D.

[2] The image details list the following information in the following order, [ Image name or the name of the process used to create the image ],[ W x H pixel size of the image ],[ Number format or bit depth ], [ Number of bands ], [ Colour format ], for more information relating to the meaning of some of these terms see chapter [#chap:dig_im 3]chap:dig_im.

[3] There can be problems doing this in Linux when using the standard file-manager Konqueror.

[4] see section [#sec:group 5.5]sec:group

[5] See section [#sec:regions 5.8]sec:regions

[6] For example: An image is opened into a column as A1 and then free rotated, by 30, to produce the rotated object A2, which was then cropped to produce the cropped object A3. The paint toolbar is then used to annotate A3. In this case the column A will have three objects in it A1, A2 and the annotated A3. If the free rotation set in the rotated object A2 the cropped object A3 will be recalculated to reflect the change in rotation and all the annotation previously applied to A3 will be lost. If you are still unclear try the steps yourself.

Clone this wiki locally