Creating a mask using the Paint Grow Segmentation method and Creating a self-contained plug-in frame: Difference between pages

From MIPAV
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
MIPAV>Olga Vovk
mNo edit summary
 
Line 1: Line 1:
You can create a mask using the paint grow segmentation method, which uses voxel aggregation to group voxels into larger regions. You begin by selecting a voxel to serve as the ''seed point,'' or starting point. The software applies paint color to all voxels touching the seed point that fall within the intensity range that you specify.<br />'''Note:''' You cannot apply the paint grow segmentation method to RGB images.<br />
You can create a self-contained plug-in that does not rely on the default MIPAV user interface. When running, this type of plug-in hides MIPAV and displays its own image(s) with the action and algorithm handling specific to its frame.<br />
== To create a self-contained plug-in: ==


==== To create a mask using the Paint Grow tool ====
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  1 Extend <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewJFrameImage</font></span>, as this will allow the plug-in to use a wide-range of <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewJFrameImage</font></span> and <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewJFrameBase</font></span> specific functions for storing and displaying <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ModelImages</font></span>. These functions include, for example, the image and on-screen buffers, menu and toolbar builders, etc.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  2 Override the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewOpenFrameInterface</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">openFrame(ModelImage) </font></span>function. This handles the creation of a new <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">PlugIn</font></span> frame based on whether a result image is created within the dialog of an algorithm. For example, when the user runs an algorithm and selects the destination New Image rather than Replace Image, a new frame will be created with the result of the algorithm. To set all algorithms to work in place and disallow creating of new frames, call <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewUserInterface setForceInPlace(true)</font></span> function, which tells the dialogs that all algorithms must work in place.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  3 Create an <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">init()</font></span> function, where the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">PlugIn</font></span> frame is layout and components will be initialized. <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  4 In the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">init()</font></span> function, several methods should be called:<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -12pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Call <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">initLUT()</font></span> for the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ModelImage</font></span> look-up table,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -12pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Call <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">initResolutions()</font></span> for the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ModelImage</font></span> resolutions,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -12pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Call <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">initZoom()</font></span> for the frame's zoom factor,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -12pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">initComponentImage()</font></span> creates a displayable <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ComponentImage</font></span>,<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -12pt; text-transform: none; vertical-align: baseline"><font color="#000000">  <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">initExtentsVariables()</font></span> initializes z-slice and time-slice positions.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  5 To add toolbars and menus to your plug-in, within <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">init()</font></span>,<span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> </font></span>create a <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewControlsImage</font></span> object, and then<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -12pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Call <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">buildToolBar() </font></span>to create pre-defined toolbars for image, VOI, paint, and scripting controls; <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -12pt; text-transform: none; vertical-align: baseline"><font color="#000000">  Or call <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">buildSimpleToolBar</font></span> and pass <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">Vector&lt;CustomUIBuilder.UIParams&gt;</font></span> using <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">addCustomToolBar()</font></span> for each of the Vectors.<br /></font></div>
[[Image:FillsAreaIco.jpg]] - Fill an Area with Desired Color<br />
1 Click the Fill an Area with Desired Color icon. The Paint Grow dialog box appears (Figure 9).<br />
2 Select the seed point, which is used as a starting point for the paint grow operation. To do this, move the pointer to the image. As you move the cursor, the location and intensity of the voxel under the pointer tip appears in the Cursor position and voxel intensity text box. Click the voxel you want to designate as the seed point.<br />
3 Adjust the delta values and parameters. <br />
4 Click Apply when complete to begin the paint grow method. The Paint Grow dialog box closes.<br />''' To correct the mask<br /></font>'''</div>


If the results are not what you want, do the following:
Pre-defined button and menu parameters are located in <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">CustomUIBuilder</font></span>. Pre-defined as well as the user-defined <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">UIParams</font></span> can be added and used in both toolbars and menus.


1 Click the Paint Grow button. The Paint Grow dialog box appears.<br />
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  6 Create <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewMenuBar</font></span>. This allows you to add either pre-defined or <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">UIParam</font></span> menus. The Vector from above (used on the custom toolbar) can be passed into the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewMenuBar</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">makeCustomMenu() </font></span>function. <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewMenuBar</font></span> also has pre-defined menus for a file, help, image, look-up tables, etc.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  7 Finally, the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">init()</font></span> function should handle the container for the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewJComponentEditImage</font></span> created from <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">initComponentImage()</font></span>. The component image should be added to a <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">JScrollPane</font></span> to accommodate the variable size of the display.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  8 Override the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">actionPerformed() </font></span>method to catch (handle) <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ActionEvents</font></span>. If a custom toolbar and (or) menu bar was created using a Vector of <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">UIParams</font></span>, the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">UIParam</font></span> contains the action event for each button and (or) menu item.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  9 Override the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">componentResized()</font></span> method to properly handle (or ignore) the resizing of the plug-in frame. Using the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewJFrameImage</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">componentResized</font></span> function would likely create unwanted behavior as the layout of the plug-in is different from MIPAV's standard <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewJFrameImage</font></span>.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  10 Create a basic <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">PlugInGeneric</font></span> class that will be called as a command-line argument. This class should have the ability to choose/open a <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ModelImage</font></span> using the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">FileIO.readImage()</font></span> method. The self-contained plug-in frame should be instantiated within this class by passing in the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ModelImage</font></span>. <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 18pt; margin-right: 0pt; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: -18pt; text-transform: none; vertical-align: baseline"><font color="#000000">  11 When running MIPAV, pass in the arguments <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000"> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">-hide</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">-p [YourGenericPlugin]</font></span>. The <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">-hide</font></span> flag tells MIPAV not to bring up the User Interface and <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">MessageFrame</font></span>, while the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">-p</font></span> flag tells which plug-in to run. See Figure 17.<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">
2 Select the seed point, which is used as a starting point for the paint grow operation. To do this, move the pointer to the image. As you move the cursor, the location and intensity of the voxel under the pointer tip appears in the Cursor position and voxel intensity text box. Click the voxel you want to designate as the seed point.<br />
3 Adjust the delta values and parameters. <br />
4 Click Apply when complete to begin the paint grow method. The Paint Grow dialog box closes.<br />
If the results are not what you want, do either of the following:<br />
Click the Undo last region paint icon, and start again.<br />
Click the Erase icon, or click, the Erase all paint icon, to erase all paint.<br />
 
'''To commit the mask'''<br />
 
Click one of the following commit buttons:
 
[[Image:MasksInsidePaintedAreaIco.jpg]] - the Masks Inside Painted Area icon.<br />[[Image:MasksOutsidePaintedAreaIco.jpg]] - the Masks Outside Painted Area icon.<br />
 
==== Paint Grow dialog box options ====


{| border="1" cellpadding="5"
{| border="1" cellpadding="5"
|+ '''Figure 9. Paint Grow dialog box '''
|+ <div style="font-style: normal; margin-bottom: 3pt; margin-left: 0pt; margin-right: 0pt; margin-top: 9pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> Figure 17. The arguments for running the self-contained plug-in frame.<br /></font>'''</div>
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Cursor position and voxel intensity</font>'''</span></div>
|
<div class="CellBody">Indicates the coordinates and intensity of the pixel under the mouse pointer tip. This pixel is the seed point.</div>
| rowspan="3" colspan="1" |
[[Image:PaintGrow_StaticThreshold.jpg]]
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Delta above selected voxel intensity</font>'''</span></div>
|
<div class="CellBody">Once a seed point has been selected, MIPAV uses this value to determine whether to fill adjacent voxels with color. The voxels that are filled must have intensity levels that fall within the range of the seed point intensity minus the lower delta value and the upper delta value. For example, if seed point has an intensity of 100.0, and the <span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">Delta Above Selected Pixel Intensity </font>''</span>value is 10 and the <span style="font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline">''<font color="#000000">Delta Below Selected Pixel Intensity </font>''</span>value is 15, MIPAV color-fills adjacent voxels whose intensities range from 85.0 to 110.0.</div>
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Delta below selected voxel intensity</font>'''</span></div>
|
<div class="CellBody">Once a seed point is, MIPAV uses this value to determine whether to fill adjacent voxels with color. The voxels that are filled must have intensity levels that fall within the range of the seed point intensity minus the lower delta value and the upper delta value.</div>
|-
| rowspan="1" colspan="1" |
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Parameters:</font>'''</span></div> <div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Unrestricted size</font>'''</span></div> <div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Maximum size</font>'''</span></div> <div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Unrestricted distance</font>'''</span></div> <div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Maximum distance</font>'''</span></div>
| rowspan="1" colspan="2" |
<div class="CellBody">Constrains the growth of the paint grow operation. Select the <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Unrestricted size</font>'''</span> and <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Unrestricted distance</font>'''</span> check boxes to allow the paint grow operation to be applied without restraint. If the <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Unrestricted size</font>'''</span> check box is not selected, type the <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">maximum size</font>'''</span> (in cubic meters) of the paint grow region in the text box. If the <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Unrestricted distance</font>'''</span> check box is not selected, type the maximum distance from the original seed point in the text box.</div>
|-
| rowspan="1" colspan="3" |
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Fuzzy connectedness</font>'''</span></div>
|-
|-
|
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Fuzzy connectedness</font>'''</span></div>
[[Image:MIPAV_SimpleImageFramePlugInRun.jpg]]
| rowspan="1" colspan="2" |
<div class="CellBody">Check tis box to use the fuzzy connectedness coefficient instead of static threshold. Here, Fuzzy connectedness represents the idea of connection or "hanging-togetherness" of image elements in an object by assigning a strength of connectedness to every possible path between every possible pair of image elements. </div> <div class="CellBody">A fuzzy connected object is defined with a fuzzy threshold or the strength of connectedness. </div>
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Initial variance from selected VOI</font>'''</span></div>
|
<div class="CellBody">Uses the initial intensity values from the selected region of interest (VOI).</div>
| rowspan="6" colspan="1" |
[[Image:PaintGrow_FuzzyConnectedness.jpg]]
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Display fuzzy image</font>'''</span></div>
|
<div class="CellBody">Displays the result image in a separate frame. </div>
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Fuzzy threshold</font>'''</span></div>
|
<div class="CellBody">is a threshold on the strength of connectedness of image elements.</div>
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Close</font>'''</span></div>
|
<div class="CellBody">Closes this dialog box.</div>
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Cancel</font>'''</span></div>
|
<div class="CellBody">Disregards any changes that you made in this dialog box and closes the dialog box.</div>
|-
|
<div class="CellBody"><span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#000000">Help</font>'''</span></div>
|
<div class="CellBody">Displays online help for this dialog box.</div>
|}
|}


==== Examples of using the Paint Grow tool ====


Here, is a step-by-step guide for selecting a region(s) of interest using the Paint Grow tool options. In this example we will use an image of the human eye and we will try to segment the blood vessels located on the retina.
===== Optional: =====
First, make sure to adjust the contrast of your image so that the different tissues appear visually distinctive. For images with more than 8 bits per voxel you may want to use the various LUT available in MIPAV.<br />


'''To segment blood vessels using the static threshold'''<br />
The<span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> ViewJFrameMessage</font></span> Data and Debug tabs (as well as others) can be added to the plug-in frame by retrieving the <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">JTabbedPane</font></span> through <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">ViewUserInterface.getReference().getMessageFrame().getTabbedPane()</font></span>. This enables the Data and Debug message output to be displayed outside of the separate message frame that accompanies MIPAV.
1 Open the Paint Grow dialog box.<br />
2 Use the mouse cursor to select the point on the image (on a blood vessel) which has the desired intensity value.<br />
3 Use the Change Paint Color option to select the color (other than red) which will be used for painting.<br />
4 On the Static Threshold tab, adjust the intensity thresholds so that the tissue you want to preserve is highlighted.<br />5 Check the Unrestricted size and Unrestricted distance options. This will allow the paint grow operation to be applied without restriction.<br />6 Watch the paint region growing.<br />


For example, when selecting the blood vessels, the image might look like the panel A for grayscale images or panel B for images after applying Blue LUT in the Figure 10 below.
See also: Figure 18 and Figure 19.


<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">


{| border="1" cellpadding="5"
{| border="1" cellpadding="5"
|+ '''Figure 10. The Paint Grow tool was used to locate the blood vessels on the grayscale image (A) first, and then on the same image after applying the Blue LUT (B). '''
|+ <div style="font-style: normal; margin-bottom: 3pt; margin-left: 0pt; margin-right: 0pt; margin-top: 9pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> Figure 18. A part of the code for PlugInDialogImageVOIDisplay.java. The full code can be found in "Examples of MIPAV plug-ins", Figure 28.<br /></font>'''</div>
|-
|-
|
|
[[Image:RetinaVesselsGrayscale.jpg]]
PlugInDialogImageVOIDisplay.java
|<div class="CellBody">A - the painted region appears in red (which is the default color)</div>
 
|-
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 1 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import java.awt.*;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 2 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import java.awt.event.*;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 3 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import java.util.Vector;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 4 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 5 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import javax.swing.*;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 6 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import gov.nih.mipav.model.file.FileInfoBase;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 7 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import gov.nih.mipav.model.structures.ModelImage;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 8 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import gov.nih.mipav.model.structures.ModelLUT;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 9 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import gov.nih.mipav.model.structures.ModelRGB;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 10 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import gov.nih.mipav.model.structures.VOI;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 11 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import gov.nih.mipav.view.*;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 12 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">import gov.nih.mipav.view.dialogs.*;</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 13 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 14 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 15 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 16 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> * Plugin example class for creating a simple, self-contained frame that extends ViewJFrame Image</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 17 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> * Contains a subset of the VOI functions, as well as the message frame contained within the frame itself</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 18 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> * @author linkb</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 19 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> *</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 20 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> */</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 21 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000">public class PlugInDialogImageVOIDisplay extends ViewJFrameImage implements MouseListener, AdjustmentListener {</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 22 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 23 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 24 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> </font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 25 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#000000"> </font></span> //~ Constructors ---------------------------------------------------------------------------------------------------<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 26 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 27 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 28 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c"><nowiki>*</nowiki></font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">Default</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">constructor</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 29 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 30 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">public</font>'''</span> PlugInDialogImageVOIDisplay(ModelImage image) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 31 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">super</font>'''</span>(image, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">null</font>'''</span>, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">null</font>'''</span>, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">false</font>'''</span>, <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">false</font>'''</span>);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 32 init();<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 33 }<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 34 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 35 <br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 36 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">/**</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 37 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c"><nowiki>*</nowiki></font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">ViewOpenFrameInterface</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">function</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">for</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">opening</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">a</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">model</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">image</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">(result)</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">into</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">a</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">new</font></span> <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c">frame</font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 38 <span style="font-style: normal; font-weight: normal; text-decoration: none; text-transform: none; vertical-align: baseline"><font color="#00007c"><nowiki>*/</nowiki></font></span><br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 39 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">public</font>'''</span> PlugInDialogImageVOIDisplay openFrame(ModelImage image) {<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 40 <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">return</font>'''</span> <span style="font-style: normal; text-decoration: none; text-transform: none; vertical-align: baseline">'''<font color="#7c9ebc">new</font>'''</span> PlugInDialogImageVOIDisplay(image);<br /></font></div><div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 30pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: -30pt; text-transform: none; vertical-align: baseline"><font color="#000000"> 41 }<br /></font></div>
|
[[Image:RetinaVessels BlueLUT.jpg]]
|<div class="CellBody">B - the painted region appears in green, because we selected it as a color contrast to LUT colors</div>
|[[Image:RetinaVeselsDialogOptions.jpg]]
|Dialog Options box
|}
|}
'''To segment blood vessels using the Fuzzy Connectedness option'''<br />
1 Open an image of interest.<br />
2 You might consider to delineate a VOI on a region of the image which is of your interest, first. This is optional.<br />
1 Open the Paint Grow dialog box, and then open the Fuzzy Connectedness tab.<br />
2 Check the '''Fuzzy Connectedness''' check box to activate the tool.<br />
3 Check the '''Initial variance from selected VOI''' box (optional).<br />
4 Check the '''Display fuzzy image option''' to view the result in a new frame.<br />
5 Use the mouse cursor to select the point on the image (on a blood vessel) which has the desired intensity value.<br />
6 Adjust the Fuzzy thresholds so that the tissue you want to preserve is highlighted.<br />
7 Watch the paint region appeared in a new frame.<br />


For example, when selecting the blood vessels, the image might look like the panel A or panel B for images in the Figure 11 below.
<br /></font></div>
 
<div style="font-style: normal; font-weight: normal; margin-bottom: 0pt; margin-left: 0pt; margin-right: 0pt; margin-top: 0pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline"><font color="#000000">


{| border="1" cellpadding="5"
{| border="1" cellpadding="5"
|+ '''Figure 11. The Fuzzy Connectedness option.'''
|+ <div style="font-style: normal; margin-bottom: 3pt; margin-left: 0pt; margin-right: 0pt; margin-top: 9pt; text-align: left; text-decoration: none; text-indent: 0pt; text-transform: none; vertical-align: baseline">'''<font color="#000000"> Figure 19. The Simple Image Frame plug-in opens the MIPAV independent image frame for a selected image. (a) The image frame contains the following elements of the interface - the VOI toolbar, image slice slider and menu bar. The Gradient Magnitude algorithm was called from the menu and applied to the image. (b) The result image opened in a new image frame.<br /></font>'''</div>
|-
|
[[Image:RetinaVesselsFuzzyGrayscale.jpg]]
|<div class="CellBody">a - the painted region appears in red </div>
|-
|-
|
|
[[Image:RetinaVesselsFuzzyResult.jpg]]
[[Image:MIPAV_SimpleImageFramePlugIn.jpg]]
|<div class="CellBody">b -the painted region also appears in a new frame</div>
|-
|
[[Image:RetinaVeselsDialogOptionsFuzzy.jpg]]
|<div class="CellBody">c</div>
|}
|}


 
'''Next:''' [[Examples of MIPAV plug-ins]]
 
== See also: ==
[[Segmenting Images Using Contours and Masks:Converting VOI contours to masks]]
*[[Understanding plug-in programs]]
*[[Using the API documentation]]
*[[Developing plug-in programs]]
*[[Creating a self-contained plug-in frame]]
*[[Installing a plug-in]]
*[[Examples of MIPAV plug-ins]]
**[[Plug-in CT_MD, a typical plug-in program]]
***[[PlugInAlgorithmCT_MD.java]]
***[[Plug-in CT_MD.java]]

Revision as of 12:10, 24 June 2013

You can create a self-contained plug-in that does not rely on the default MIPAV user interface. When running, this type of plug-in hides MIPAV and displays its own image(s) with the action and algorithm handling specific to its frame.

To create a self-contained plug-in:

1 Extend ViewJFrameImage, as this will allow the plug-in to use a wide-range of ViewJFrameImage and ViewJFrameBase specific functions for storing and displaying ModelImages. These functions include, for example, the image and on-screen buffers, menu and toolbar builders, etc.
2 Override the ViewOpenFrameInterface openFrame(ModelImage) function. This handles the creation of a new PlugIn frame based on whether a result image is created within the dialog of an algorithm. For example, when the user runs an algorithm and selects the destination New Image rather than Replace Image, a new frame will be created with the result of the algorithm. To set all algorithms to work in place and disallow creating of new frames, call ViewUserInterface setForceInPlace(true) function, which tells the dialogs that all algorithms must work in place.
3 Create an init() function, where the PlugIn frame is layout and components will be initialized.
4 In the init() function, several methods should be called:
Call initLUT() for the ModelImage look-up table,
Call initResolutions() for the ModelImage resolutions,
Call initZoom() for the frame's zoom factor,
initComponentImage() creates a displayable ComponentImage,
initExtentsVariables() initializes z-slice and time-slice positions.
5 To add toolbars and menus to your plug-in, within init(), create a ViewControlsImage object, and then
Call buildToolBar() to create pre-defined toolbars for image, VOI, paint, and scripting controls;
Or call buildSimpleToolBar and pass Vector<CustomUIBuilder.UIParams> using addCustomToolBar() for each of the Vectors.

Pre-defined button and menu parameters are located in CustomUIBuilder. Pre-defined as well as the user-defined UIParams can be added and used in both toolbars and menus.

6 Create ViewMenuBar. This allows you to add either pre-defined or UIParam menus. The Vector from above (used on the custom toolbar) can be passed into the ViewMenuBar makeCustomMenu() function. ViewMenuBar also has pre-defined menus for a file, help, image, look-up tables, etc.
7 Finally, the init() function should handle the container for the ViewJComponentEditImage created from initComponentImage(). The component image should be added to a JScrollPane to accommodate the variable size of the display.
8 Override the actionPerformed() method to catch (handle) ActionEvents. If a custom toolbar and (or) menu bar was created using a Vector of UIParams, the UIParam contains the action event for each button and (or) menu item.
9 Override the componentResized() method to properly handle (or ignore) the resizing of the plug-in frame. Using the ViewJFrameImage componentResized function would likely create unwanted behavior as the layout of the plug-in is different from MIPAV's standard ViewJFrameImage.
10 Create a basic PlugInGeneric class that will be called as a command-line argument. This class should have the ability to choose/open a ModelImage using the FileIO.readImage() method. The self-contained plug-in frame should be instantiated within this class by passing in the ModelImage.
11 When running MIPAV, pass in the arguments
-hide -p [YourGenericPlugin]. The -hide flag tells MIPAV not to bring up the User Interface and MessageFrame, while the -p flag tells which plug-in to run. See Figure 17.
Figure 17. The arguments for running the self-contained plug-in frame.

MIPAV SimpleImageFramePlugInRun.jpg


Optional:

The ViewJFrameMessage Data and Debug tabs (as well as others) can be added to the plug-in frame by retrieving the JTabbedPane through ViewUserInterface.getReference().getMessageFrame().getTabbedPane(). This enables the Data and Debug message output to be displayed outside of the separate message frame that accompanies MIPAV.

See also: Figure 18 and Figure 19.

Figure 18. A part of the code for PlugInDialogImageVOIDisplay.java. The full code can be found in "Examples of MIPAV plug-ins", Figure 28.

PlugInDialogImageVOIDisplay.java

1 import java.awt.*;
2 import java.awt.event.*;
3 import java.util.Vector;
4
5 import javax.swing.*;
6 import gov.nih.mipav.model.file.FileInfoBase;
7 import gov.nih.mipav.model.structures.ModelImage;
8 import gov.nih.mipav.model.structures.ModelLUT;
9 import gov.nih.mipav.model.structures.ModelRGB;
10 import gov.nih.mipav.model.structures.VOI;
11 import gov.nih.mipav.view.*;
12 import gov.nih.mipav.view.dialogs.*;
13
14
15 /**
16 * Plugin example class for creating a simple, self-contained frame that extends ViewJFrame Image
17 * Contains a subset of the VOI functions, as well as the message frame contained within the frame itself
18 * @author linkb
19 *
20 */
21 public class PlugInDialogImageVOIDisplay extends ViewJFrameImage implements MouseListener, AdjustmentListener {
22
23
24
25 //~ Constructors ---------------------------------------------------------------------------------------------------
26
27 /**
28 * Default constructor
29 */
30 public PlugInDialogImageVOIDisplay(ModelImage image) {
31 super(image, null, null, false, false);
32 init();
33 }
34
35
36 /**
37 * ViewOpenFrameInterface function for opening a model image (result) into a new frame
38 */
39 public PlugInDialogImageVOIDisplay openFrame(ModelImage image) {
40 return new PlugInDialogImageVOIDisplay(image);
41 }

Figure 19. The Simple Image Frame plug-in opens the MIPAV independent image frame for a selected image. (a) The image frame contains the following elements of the interface - the VOI toolbar, image slice slider and menu bar. The Gradient Magnitude algorithm was called from the menu and applied to the image. (b) The result image opened in a new image frame.

MIPAV SimpleImageFramePlugIn.jpg

Next: Examples of MIPAV plug-ins

See also: