KEYWORD Basic_Steps Wave_Mode Action_Mode Test_Section Edit_Options Copy_Polygons Clear_Polygons Auto_Polygon Graphics_Toggles Hot_Keys Save_.POL_File DESCRIPTION : EditPolygon EditPolygon lets you create 2D polygons in the image window to identify objects in the image. These polygons are used to delineate areas of the data for measurements, for cutting out part of the image, or as building blocks for 3D Objects which can be used for 3D measurement and modeling. EditPolygon provides interactive and automatic creation of polygons and editing of existing polygons. There are other programs that can generate polygons: 2DObjFinder automatically creates polygons from a binary mask and FPPolygons functions similarly but operates on data where each pixel value is a region number. Programs that use polygons are CutMask, which masks out the data either inside or outside the polygons, Volume Builder, which associates polygons into three-dimensional objects, and Find Points, which can use polygons to mark regions of interest to search for point-like intensity features. All of these programs can look at the same set of polygons so that they can be used together. When any of one of these programs are running and have a set of polygons loaded into an image window, any other one will see those polygons and be able to work with them. Basic_Steps 1) Enter the image window number for the image that you wish to use for editing or creating polygons. 2) If you want to edit an existing polygon data set, enter the name of the polygon data set in the field next to the "polygon data" button or press the "polygon data" button to open a file selection dialog to choose the file. 3) Create polygons by clicking in the image where you want the vertices of the polygons to lie. To complete the polygon press the space bar while the mouse pointer is over the image or the press the "Close Polygon" button in the EditPolygon dialog. 4) Now that you've gone through the work of tracing some object by hand, read the action mode section to learn about how to modify existing polygons or semiautomatically creating new ones. 5) When you are finished creating or editing polygons, you can save the polygons to a file by pressing the "Save .POL File" button in the EditPolygon dialog. You can also just leave the EditPolygon program running and start the program that you want to use the polygons. Point that program at the window with the polygons and it will use the polygons that EditPolygon loaded into that window. The polygons will stay loaded in the window as long as one of the polygon manipulation programs is using them. Wave_Mode If you are working with multiple wave data, you can always be sure of which wave you are modeling in, by setting the active wave toggles. If you are in black and white mode in the image, it's easy, because the wave that is displayed is the one you are modeling. In this case, polygons that are actually applied to a section will be red. In RGB mode, the current wave is not obvious in the window so you are more dependent on the toggles in the EditPolygon menu. In this case polygons will be different colors for the different waves so you can distinguish which is from which wave. The colors are controllable using "Graphics Colors" from the "Options" menu on the image window. There you can set the colors for each wave to be whatever you want. The option menu for the active wave mode provides a shortcut for modeling in data with multiple waves. If it is set to "one", then the polygons you create will only be applied to the currently active wave. If it is set to "all", then all the polygons created while in this mode will be applied to all of the waves. Action_Mode The action mode option menu contains the choices for what will happen when you click in the image window using the mouse. The possible actions are: Add Clicking in the image window will add a point to the currently open polygon in that section or create a new polygon and add the point clicked as the first vertex. When the last point is picked for a polygon, press the space bar while the mouse is over the image window or press the "Close Polygon" button in the EditPolygon dialog to close the polygon. Modify Allows changes to be made to the positions of individual vertices. Pressing and holding the left mouse button while the pointer is near a vertex selects that vertex, and until the left mouse button is released, the vertex's position will change as the mouse is moved. Roam Allows whole polygons to be shifted. Pressing and holding the left mouse button while the pointer is inside a polygon selects that polygon, and until the left mouse button is released, motions of the mouse will cause the polygon to translate. Select Clicking inside a polygon causes it to be the current selection. The currently selected polygon is highlighted, and may have operations performed on it by pressing one of the following keys when the pointer is in the image window: a Deletes the selected polygon. f Smoothes the jagged edges of the polygon one at a time starting with the worst. g Deselects the polygon. s Smoothes the jagged edges all at once; currently, smoothing just means putting the very wrong point in between its two adjacent points. Note that when a new polygon is created via the Auto action or when a manually-created polygon is closed, that polygon becomes the current selection and the actions described above can be applied without entering the selection mode. While in the selection mode the "d" key for deleting the last polygon in a section is disabled to avoid it being mistakenly used when deleting the currently selected polygon was intended. The smoothing keys are most useful for polygons generated via the Auto action. Auto Clicking in the image window causes the point selected to be used as the starting point for automatically generating a polygon. While in the Auto mode, a dialog is displayed which controls how the polygons are generated in relation to the starting point. Auto_Polygon topic discusses the available options in more detail. Off Clicking in the image window has no effect on EditPolygon. This is useful if you wish to use the mouse for actions in other programs without having an effect on EditPolygon. Test_Section When the "test section" toggle is on, you can create polygons that will be shown in all sections as you move through the sections but which will not be applied to the section unless you press the "apply test section" button or press "t" while the pointer is in the image window. Polygons in the test section are displayed in green; when they are copied to the polygon list for the current section they are displayed in the normal color used for polygons (red for pseudocolor mode or the current color for the wave's graphics for RGB mode). If you want to add, delete or modify a polygon that is not in the test section, turn off the "test section" toggle so that the actions are applied to the polygons in the real sections. The next time you want to work with the test section, toggle the "test section" toggle back on and the polygons that were in the test section will appear again and can still be used. If you want to delete the polygons in the test section, use "Clear Test Section" from the "edit" options menu or, while the "test section" toggle is on and the pointer is in the image window, press the d key repeatedly until the all the polygons are deleted. You can also enter the select action mode to select a polygon from the test section and then press the "a" key to delete it. You may want to use test section to make sure you have a polygon or polygons that are good for a number of sections. When you've got the right polygon for all the sections you can you the copy polygons function in the edit options pulldown to copy the test section to all the sections at once. When you apply a test section, if the active wave mode is "one", the section will be applied to the current section in the toggled wave. If the wave mode is "all", the test section will be applied to that current section in all the waves. Edit_Options The edit pulldown in the EditPolygon dialog provides the following operations: Copy Polygon(s) Opens a dialog in which a range of sections is specified as the source and another range of sections as the destination. When the "Do it" button is pressed in the dialog, polygons are copied from the source to the destination. The Copy_Polygons topic covers the operation of this dialog in more detail. Clear Test Section Removes all polygons from the test section. Clear Partial Opens a dialog in which a range of sections is specified. When the "Do it" button is pressed in the dialog, all the polygons within that range are removed. The Clear_Polygons topic covers the operation of this dialog in more detail. Clear All Removes all polygons. Copy_Polygons When "Copy Polygons" is selected from the edit pulldown in the EditPolygon dialog, a dialog is displayed in which the sections to be used as the source and destination are entered. Pressing the "Do it" button in this dialog performs the copy. The source region is controlled by the controls on the lefthand side of the dialog and the destination by the controls on the right. The toggles on the left control how the copy is performed. If the uppermost toggle on the left (the one next to the z field) is on, the copy is done from a single section specified by the values in the z, time, and wave fields on the lefthand side. The polygons in this section are copied to the range of sections specified by the z field, time field, and wave toggles on the right. The z and time destination ranges are controlled by two values: the first is the starting point and the second is the final point. If the destination range includes the source section, the polygons in that section will not appear twice. If the second toggle on the left (the one next to the time field) is on, the copy is done from all z sections in a single time point and wave as specified by the time and wave fields on the left. The destination for the copy is all z sections for the range of times and waves specified on the right. If the destination range includes the source time and wave, the polygons in that time and wave will not appear twice. If the third toggle on the left (the one next to the wave field) is on, the copy is done from all time points z sections in the wave given by the wave field on the left. The destination is all the corresponding time and z points in the waves selected on the right. If the destination waves includes the source wave, the polygons in that wave will not appear twice. If the fourth toggle on the left is on, the copy is done from the test section to all sections in the range set by the z field, time field, and wave toggles on the right. In all cases the "set all" button may be used to have the destination cover the entire data set. Clear_Polygons When "Clear Partial" is selected from the edit pulldown in the EditPolygon dialog, a dialog is displayed to specify the range of sections to be cleared. Pressing the "Do it" button in this dialog clears the sections. If the toggle button next to the z field is on, the range of sections cleared is set in the z field, time field, and the wave toggles. For z and time, the first value in the field is the starting index and the second value is the final index. If the toggle button next to the time field is on, all z sections in the selected times and waves are cleared. If the toggle next to the wave field is on, all z sections and time points in the selected waves are cleared. Auto_Polygon When EditPolygon is in the autopolygon mode, rather than manually selecting all the vertices of a polygon, a seed point is selected and that is used to generate the polygon (or polygons if a 3D search is enabled). While in the EditPolygon mode a dialog is displayed that controls the algorithm used to generate a polygon from the seed point (if the dialog is not visible, it can be redisplayed by resetting the action mode option menu to "Auto". Use the "auto pick file" button in the dialog to select a list of seed points in Pick Points format in lieu of selecting the seed points manually. Use the "more tools..." button to display a dialog with controls to propagate the polygons from one section to other sections. Use the "method" option menu in the autopolygon dialog to select the type of algorithm used to generate a polygon from a seed point. Adjacent to it is an option menu to control whether a polygon is only generated on the current section (the "2D" option) or if the seed point is used to generate polygons on sections within x sections of the current section where x is the value shown in the "max z reach" field. The "biggest change", "percent change", "rate of change", and "change from center" algorithms are radial search algorithms: a search is done along each of "num points" evenly spaced rays from the seed point to determine where to place the boundary. The radial search is done for points between "min xy reach" and "max xy reach" pixels from the seed point; if the search fails the boundary is placed at "max xy reach" pixels from the seed point. The search criteria for these methods are: biggest change Searches for the largest absolute intensity change along the ray subject to the requirement that it occur at a distance from the seed point which is no more than "max length diff" pixels different from the distance between the boundary point on the previous ray and the seed point. percent change Searches for the first point along the ray at which the relative intensity along the ray exceeds a threshold and whose distance from the seed point is no more than "max length diff" pixels different from the distance between the boundary point on the previous ray and the seed point. The threshold for the relative intensity change is expressed as a percentage and is shown in the "change" field. Whether the threshold is crossed for an increase, decrease, or either increase or decrease in intensity is controlled by the "change" option menu. The available options are: % higher The threshold is crossed only for a relative increase which is larger than the threshold value. % lower The threshold is crossed only for a relative decrease which is larger than the threshold value. % hi/lo The threshold is crossed for relative increases or decreases which are larger than the threshold level. rate of change Searches for the largest rate of change in intensity along the ray subject to the requirement that it occur at a distance from the seed point which is no more than "max length diff" pixels different from the distance between the boundary point on the previous ray and the seed point. change from center Is similar to the "percent change" method, but instead of comparing adjacent samples along the ray to determine the relative intensity change, the comparison is done between the sample and the intensity at the seed point. The other method, "tracer % change", is the one that is recommended for most applications. It uses the same criteria as "change from center" to locate a point on the polygon edge to the right of the seed point. A second point on the boundary is then located by searching downward from the first edge point. Subsequent points on the boundary are located by searching in the direction established by the previous two points for a sample whose change in intensity relative to the seed point matches the same criteria as used for "change from center". Because of the nature of the search, it is not necessary for the seed point to lie within the polygon which is generated. For this method, "num points" sets the minimum number of points that a generated polygon will have (if the polygon were to have fewer, it will not be generated at all). "step size" sets the distance between adjacent vertices on the traced boundary. For all methods, intensity measurements are based on a local average of the intensity values. The size, in pixels, of the square region used to perform the average is given in the "sample size" field. The polygon that is generated can be larger or smaller than the boundary found using any of the methods. If the "extend" field is nonzero, the vertices of the polygon are shifted by that number of pixels from the vertices of the boundary (the shift is radial relative to the seed point). The each algorithm, the choice of relative intensity threshold, number of points, step size, sample size, minimum xy reach, maximum xy reach, maximum z reach, maximum length difference, and the extension distance are recorded in the .iveprefs sub- directory of your home directory. The last values for these parameters will be restored whenever the choice of algorithm is changed. Automatically generated polygons can have sharp edges. You can selectively smooth these (see the Action_Mode and Hot_Keys topics for details) or, if the "automatic smooth" toggle is on, the polygons are smoothed immediately after they are generated. The propagation of polygons from one section to another (via the controls in the dialog opened by the "more tools..." button), is done by determining a seed point for each of the existing polygons and then applying the algorithms described above to generate new polygons from those seed points. To use the propagation tools, you must determine the section whose polygons are to be used as the source and enter the corresponding z, wave, and time indices in the "Using ZWT" field. The determination of the seed point from the existing polygon is controlled by the "using last picked pt" toggle. If this toggle is off or if the existing polygon was not generated with the autopolygon tools, the seed point is the geometric center of the existing polygon. If this toggle is on, the seed point is the seed point that was used to generate the existing polygon. With those values selected, press the "AutoPick Current Section" button to propagate the polygons to the currently displayed section or press the "AutoPick Range" button to propagate the polygons to the range of sections given by the "z range" and "t range" fields. The "set all" button is a shortcut for changing the z and time ranges to cover the entire dataset. Graphics_Toggles There are several toggles in the EditPolygon dialog which control how polygon graphics are displayed in the image window. The effects of these toggles are: show graphics zwt If this toggle is on, the adjacent field specifies the z, wave, and time indices for a reference section; the polygons in the reference section will be displayed in light brown regardless of the section currently visible in the image window. show polygons in all waves When on, all polygons in the currently displayed z section and time point are displayed, regardless of the wave. graphics When on, the outlines of the polygons are displayed in the image window; when off, they are not displayed. Hot_Keys If the toggle labeled "keys" is on, the keys listed below can be used as shortcuts for performing the listed actions. When toggle is off, these keys have no effect. spacebar Closes the open polygon on the section, if any. a Deletes the currently selected polygon. b If EditPolygon is in the autopolygon mode, changes the algorithm to find the boundaries to be "tracer % change". c If EditPolygon is in the autopolygon mode, changes the algorithm to find the boundaries to be "rate of change". d Deletes the last polygon made in a section. Has no effect if EditPolygon is in the select mode. e Deletes the last point of the last polygon in the section and leaves that polygon open. f Smoothes the currently selected polygon by operating on the jagged edges one at a time starting with the worst. g Deselects the currently selected polygon. s Smoothes the currently selected polygon by operating on all the jagged edges at once. t Transfers the polygons in the test section to the current section. v If EditPolygon is in the autopolygon mode, changes the algorithm to find the boundaries to be "change from center". x If EditPolygon is in the autopolygon mode, changes the algorithm to find the boundaries to be "percent change". z If EditPolygon is in the autopolygon mode, changes the algorithm to find the boundaries to be "biggest change". 1 Puts EditPolygon in the add mode. 2 Puts EditPolygon in the modify mode. 3 Puts EditPolygon in the roam mode. 4 Puts EditPolygon in the select mode. 5 Puts EditPolygon in the autopolygon mode. Save_.POL_File To save the current polygon lists to a file, press the "Save .POL File" button in the EditPolygon dialog. A dialog will be displayed allowing you to enter the file name directly or to use a file selection dialog to choose the file (press the "getfile" button to open the file selection dialog). Once the file is selected, press the "save" button to save the polygons.