|
| 1 | +\documentclass[fleqn,11pt,openany]{book} |
| 2 | + |
| 3 | +% These two need to be set before including scirun style package |
| 4 | +\title{SCIRun Visualization Basics} |
| 5 | +\author{Ayla Khan, David Weinstein} |
| 6 | + |
| 7 | +% INCLUDE SCI STYLE DOCUMENT |
| 8 | +\usepackage{scirun} |
| 9 | + |
| 10 | +\begin{document} |
| 11 | + |
| 12 | +%% starting from SCIRun Doc wiki |
| 13 | +%% http://software.sci.utah.edu/SCIRunDocs/index.php/CIBC:Documentation:SCIRun:Tutorial:BioPSE |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +% CREATE TITLE PAGE -------------------------------------------------- |
| 18 | +\maketitle |
| 19 | + |
| 20 | +% CHAPTERS --------------------------------------------------------------- |
| 21 | + |
| 22 | +\chapter{SCIRun Overview} \label{overview} |
| 23 | + |
| 24 | +\begin{introduction} |
| 25 | +This tutorial demonstrates how to build a simple SCIRun dataflow network. |
| 26 | +\end{introduction} |
| 27 | + |
| 28 | +\section{Software requirements} |
| 29 | + |
| 30 | +\subsection{SCIRun \SCIRunVersion} |
| 31 | + |
| 32 | +All available downloads for SCIRun version \SCIRunVersion and the SCIRunData archive are available from |
| 33 | +\href{http://www.scirun.org}{SCI software portal}. |
| 34 | +Make sure to update to the most up-to-date release available, which will include |
| 35 | +the latest bug fixes. |
| 36 | + |
| 37 | +Currently, the easiest way to get started with SCIRun version \SCIRunVersion is to download and install |
| 38 | +a binary version for Mac OS X. |
| 39 | +Sources are also available for Linux, however this option is recommended |
| 40 | +only for advanced Linux users. |
| 41 | + |
| 42 | +Unpack the SCIRunData archive in a convenient location. |
| 43 | +Recall from the User Guide that the path to data can be set using the |
| 44 | +\textenvvar{SCIRUN\_DATA} environment variable or by setting |
| 45 | +\textenvvar{SCIRUN\_DATA} in the \emph{.scirunrc} file. |
| 46 | + |
| 47 | +%%\subsection{SCIRun SVN} |
| 48 | + |
| 49 | +\chapter{User Interface} |
| 50 | + |
| 51 | +\begin{introduction} |
| 52 | +Scope: \hyperref[datalayer]{Data Layers} - \hyperref[favorites]{Favorite Modules} - |
| 53 | +\hyperref[visualize]{Saved Subnetworks} - \hyperref[convert4]{Converting Networks from SCIRun 4} |
| 54 | +\end{introduction} |
| 55 | + |
| 56 | +\subsection{Data Layers}\label{datalayer} |
| 57 | + |
| 58 | +\subsection{Favorite Modules}\label{favorites} |
| 59 | + |
| 60 | +\subsection{Saved Subnetworks and Snippets}\label{subnets} |
| 61 | + |
| 62 | +\subsection{Converting Networks from SCIRun 4}\label{convert4} |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +\chapter{Simple Dataflow Network} |
| 68 | + |
| 69 | +\begin{introduction} |
| 70 | +Scope: \hyperref[readdata]{Read Data File} - \hyperref[slice]{Slice} - |
| 71 | +\hyperref[visualize]{Visualize} - \hyperref[bbox]{Bounding Box} - \hyperref[isosurface]{Isosurface} |
| 72 | +\end{introduction} |
| 73 | + |
| 74 | +\section{Slice Field} |
| 75 | + |
| 76 | +The purpose of this section is to read, manipulate, and visualize a structured mesh dataset originating from SCIRunData. |
| 77 | + |
| 78 | +\subsection{Read Data File}\label{readdata} |
| 79 | + |
| 80 | +Create a \textbf{ReadField} module by using the \textbf{Module Selector} on the left hand side of the screen. Navigate to \textbf{DataIO} subsection using the scroll bar in the Module Selector and instantiate a ReadField (Figure \ref{fig:readfield}). Recall from the \textbf{User Guide} that a module can also be selected by giving a text input into the filter in the Module Selector (Figure \ref{fig:readfield2}). |
| 81 | + |
| 82 | +\begin{figure}[H] |
| 83 | +\begin{center} |
| 84 | +\includegraphics[width=0.8\textwidth]{BasicTutorial_figures/readfield_text.png} |
| 85 | +\caption{Locate ReadField module using scroll bar in the Module Selector.} |
| 86 | +\label{fig:readfield} |
| 87 | +\end{center} |
| 88 | +\end{figure} |
| 89 | + |
| 90 | +\begin{figure}[H] |
| 91 | +\center |
| 92 | +\includegraphics[width=0.8\textwidth]{BasicTutorial_figures/readfield.png} |
| 93 | +\caption{Locate ReadField module using text input into filter.} |
| 94 | +\label{fig:readfield2} |
| 95 | +\end{figure} |
| 96 | + |
| 97 | +Within the ReadField \textbf{user interface (UI)}, click the open button to navigate to the SCIRunData directory and select the dataset \emph{volume/engine.nhdr} (Figure \ref{fig:readfieldtype}). Notice that many different file formats can be imported by changing the file type within the ReadField selector window. When using Mac OSX El Capitan, press the options button in the ReadField selector window to change the file type. Change the file type to Nrrd file. The ReadField UI can be closed after selection to provide for a larger network viewing frame. |
| 98 | + |
| 99 | +\begin{figure}[H] |
| 100 | +\center |
| 101 | +\includegraphics[width=0.8\textwidth]{BasicTutorial_figures/readfield_select.png} |
| 102 | +\caption{The ReadField selector window can be used to select and read many data files.} |
| 103 | +\label{fig:readfieldtype} |
| 104 | +\end{figure} |
| 105 | + |
| 106 | +\subsection{Slice Field}\label{slice} |
| 107 | + |
| 108 | +Slice the engine field by node index along a given axis by instantiating the module |
| 109 | +\textbf{GetSlicesFromStructuredFieldByIndices} in the \textbf{NewField} category and connecting it to ReadField (Figure \ref{fig:slicemod}). This can be done by using the Module Selector filter or scrolling through the list of modules in the Module Selector. |
| 110 | + |
| 111 | +\begin{figure}[H] |
| 112 | +\center |
| 113 | +\includegraphics[width=0.8\textwidth]{BasicTutorial_figures/getslice.png} |
| 114 | +\caption{Using the ReadField port's pop-up module menu to instantiate GetSliceFromStructuredFieldByIndices.} |
| 115 | +\label{fig:slicemod} |
| 116 | +\end{figure} |
| 117 | + |
| 118 | +\subsection{Visualize Field}\label{visualize} |
| 119 | + |
| 120 | +To visualize the field geometry, instantiate module \textbf{ShowField} |
| 121 | +in the \textbf{Visualization} category and module \textbf{ViewScene} |
| 122 | +in the \textbf{Render} category (Figure \ref{fig:colormap}). |
| 123 | +ShowField takes a field as input, and outputs scene-graph geometry. |
| 124 | +ViewScene displays the geometry and allows a user to interact with the scene. |
| 125 | + |
| 126 | +\begin{figure}[H] |
| 127 | +\center |
| 128 | +\includegraphics[width=0.8\textwidth]{BasicTutorial_figures/viewscene.png} |
| 129 | +\caption{SCIRun can be used to visualize the structured mesh.} |
| 130 | +\label{fig:colormap} |
| 131 | +\end{figure} |
| 132 | + |
| 133 | + |
| 134 | +Apply a colored scale to the data values on the geometry using \textbf{CreateStandardColorMaps} |
| 135 | +and \textbf{RescaleColorMaps} modules in \textbf{Visualization} (Figure \ref{fig:rescale}). Colors can be manipulated using the CreateStandardColorMap UI and RescaleColorMap UI (Figure \ref{fig:viewscene}). Change the coloring scheme to Blackbody using the drop-down menu in the CreatSrandardColorMap UI. |
| 136 | + |
| 137 | +\begin{figure}[H] |
| 138 | +\center |
| 139 | +\includegraphics[width=0.8\textwidth]{BasicTutorial_figures/colorscale.png} |
| 140 | +\caption{Apply and rescale a colormap to data values on the geometry.} |
| 141 | +\label{fig:rescale} |
| 142 | +\end{figure} |
| 143 | + |
| 144 | +\begin{figure}[H] |
| 145 | +\center |
| 146 | +\includegraphics[width=0.8\textwidth]{BasicTutorial_figures/manipulatecolorscale.png} |
| 147 | +\caption{Manipulate the color scaling using both the CreateStandardColorMaps and RescaleColorMaps modules.} |
| 148 | +\label{fig:viewscene} |
| 149 | +\end{figure} |
| 150 | + |
| 151 | +Return to the default color scale. Use the sliders in the GetSlicesFromStructuredFieldByIndices UI |
| 152 | +to change slice position within the geometry. Compare with figure \ref{fig:rescale}. |
| 153 | + |
| 154 | +\begin{figure}[H] |
| 155 | +\center |
| 156 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/sliceselect.png} |
| 157 | +\caption{Different cross sections can be visualized within the geometry using GetSlicesFromStructuredFieldbyIndices. } |
| 158 | +\label{fig:getslice} |
| 159 | +\end{figure} |
| 160 | + |
| 161 | + |
| 162 | +\section{Show Bounding Box}\label{bbox} |
| 163 | + |
| 164 | +Add the \textbf{EditMeshBoundingBox} module under \textbf{ChangeMesh} (Figure \ref{fig:addbbox}). Connect it to the ReadField module and direct the output to the ViewScene module. Execute the network to visualize the bounding box of engine.nhrd. Adjust the size of the bounding box by pressing the + or - buttons under Widget Scale in the EditMeshBoundingBox UI (Figure \ref{fig:addbbox2}). |
| 165 | + |
| 166 | +\begin{figure}[H] |
| 167 | +\center |
| 168 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/editmeshboundingbox.png} |
| 169 | +\caption{Visualize the mesh's bounding box.} |
| 170 | +\label{fig:addbbox} |
| 171 | +\end{figure} |
| 172 | + |
| 173 | +\begin{figure}[H] |
| 174 | +\center |
| 175 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/editmeshbbox.png} |
| 176 | +\caption{Change the scale of the mesh's bounding box using the Scale Widget in the EditMeshBoundingBox UI.} |
| 177 | +\label{fig:addbbox2} |
| 178 | +\end{figure} |
| 179 | + |
| 180 | +\section{Isosurface}\label{isosurface} |
| 181 | + |
| 182 | +Construct an isosurface from the field by instantiating and connecting a \textbf{ExtractSimpleIsosurface} module to the ReadField module. The isovalue must be changed within the ExtractSimpleIsosurface UI. Open the field information by clicking on the connection between the ReadField and ExtractSimpleIsosurface and press I to bring up information. Enter a value from within the data range like 120. |
| 183 | +Visualize the isosurface by connecting it to a new ShowField module ported into the ViewScene module (Figure \ref{fig:extract}). |
| 184 | +Execute the network. Color isosurface output geometry by connecting the RescaleColorMap module to the ShowField module (Figure \ref{fig:changeisoval}). To better view the geometry, turn off the edges within the ShowField UI (Figure \ref{fig:viewisosurf}). |
| 185 | + |
| 186 | +\begin{figure}[H] |
| 187 | +\center |
| 188 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/extractiso.png} |
| 189 | +\caption{Extract an isosurface from field.} |
| 190 | +\label{fig:extract} |
| 191 | +\end{figure} |
| 192 | + |
| 193 | +\begin{figure}[H] |
| 194 | +\center |
| 195 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/coloriso.png} |
| 196 | +\caption{Change the isovalue within ExtractSimpleIsosurface UI.} |
| 197 | +\label{fig:changeisoval} |
| 198 | +\end{figure} |
| 199 | + |
| 200 | +\begin{figure}[H] |
| 201 | +\center |
| 202 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/edgesiso.png} |
| 203 | +\caption{Adjusting parameters within the ShowField UI helps to better visualize the isosurface.} |
| 204 | +\label{fig:viewisosurf} |
| 205 | +\end{figure} |
| 206 | + |
| 207 | +\chapter{Create, Manipulate and Visualize Field} |
| 208 | + |
| 209 | +\begin{introduction} |
| 210 | +Scope: \hyperref[createfield]{Generate Lattice Volume} - \hyperref[isosurface2]{Isosurface} - |
| 211 | +\hyperref[]{Visualize Geometry} |
| 212 | +\end{introduction} |
| 213 | + |
| 214 | +\section{Create Field}\label{createfield} |
| 215 | + |
| 216 | +Create and manipulate a structured mesh type in this exercise. |
| 217 | +Start by creating a lattice volume using \textbf{CreateLatVol} module. |
| 218 | +Assign data at nodes using \textbf{CalculateFieldData} module. |
| 219 | +Connect CalculateFieldData to CreateLatVol. Input the expression $RESULT = sqrt(X*X + Y*Y + Z*Z)$ to compute data for each node within the CreateFieldData UI. |
| 220 | + |
| 221 | +\begin{figure}[H] |
| 222 | +\center |
| 223 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/create.png} |
| 224 | +\caption{Create lattice volume field using CreateLatVol module.} |
| 225 | +\label{fig:createnewfield} |
| 226 | +\end{figure} |
| 227 | + |
| 228 | +\begin{figure}[H] |
| 229 | +\center |
| 230 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/fielddata.png} |
| 231 | +\caption{Create a new field by inputting an expression into the CreateFieldData UI. } |
| 232 | +\label{fig:calcfielddata} |
| 233 | +\end{figure} |
| 234 | + |
| 235 | + |
| 236 | +\section{Isosurface}\label{isosurface2} |
| 237 | + |
| 238 | +Generate the isosurface by instantiating and connecting an ExtractSimpleIsosurface module to CalculateFieldData (Figure \ref{fig:extractisosurf2}). Adjust the isovalue within the ExtractSimpleIsosurface UI so that the isosurface can be visualized (Figure \ref{fig:conncolormap}). Add a color map and visualize the isosurface as in section \ref{isosurface} (Figure \ref{fig:viewdefaultisosurf}). Show the mesh bounding box as in section \ref{bbox} (Figure \ref{fig:changeisoval2}). |
| 239 | + |
| 240 | +\begin{figure}[H] |
| 241 | +\center |
| 242 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/extractiso2.png} |
| 243 | +\caption{Extract an isosurface from the field data.} |
| 244 | +\label{fig:extractisosurf2} |
| 245 | +\end{figure} |
| 246 | + |
| 247 | +\begin{figure}[H] |
| 248 | +\center |
| 249 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/selectisoval.png} |
| 250 | +\caption{Change the isovalue so that an isosurface can be visualized.} |
| 251 | +\label{fig:conncolormap} |
| 252 | +\end{figure} |
| 253 | + |
| 254 | +\begin{figure}[H] |
| 255 | +\center |
| 256 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/viewisocirc.png} |
| 257 | +\caption{Visualize the isosurface.} |
| 258 | +\label{fig:viewdefaultisosurf} |
| 259 | +\end{figure} |
| 260 | + |
| 261 | +\begin{figure}[H] |
| 262 | +\center |
| 263 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/bbox.png} |
| 264 | +\caption{Visualize the mesh's bounding box.} |
| 265 | +\label{fig:changeisoval2} |
| 266 | +\end{figure} |
| 267 | + |
| 268 | + |
| 269 | +\section{Slice Field}\label{slice2} |
| 270 | + |
| 271 | +%%TODO: should add blurb about disabling modules and add image |
| 272 | +%% |
| 273 | +%% Postpone until SCIRun 5 due to disabled modules bugs. |
| 274 | +Extend the functionality of this network by slicing the field using GetSliceFromStructuredFieldByIndices as in section \ref{slice}. |
| 275 | + |
| 276 | +\begin{figure}[H] |
| 277 | +\center |
| 278 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/getslice2.png} |
| 279 | +\caption{Insert GetSliceFromStructuredFieldByIndices into the network.} |
| 280 | +\label{fig:slicemod2} |
| 281 | +\end{figure} |
| 282 | + |
| 283 | +\begin{figure}[H] |
| 284 | +\center |
| 285 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/changeslice.png} |
| 286 | +\caption{Change the slice index using the GetSliceFromStructuredFieldByIndices UI.} |
| 287 | +\label{fig:showslice} |
| 288 | +\end{figure} |
| 289 | + |
| 290 | +\begin{figure}[H] |
| 291 | +\center |
| 292 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/colorslice.png} |
| 293 | +\caption{Attach the RescaleColorMap module to the ShowField module.} |
| 294 | +\label{fig:showslice} |
| 295 | +\end{figure} |
| 296 | + |
| 297 | +\section{Clip Field}\label{clipfieldfunc} |
| 298 | + |
| 299 | +Clip out a subset of the original field by converting the lattice volume to an unstructured mesh using \textbf{ConvertMeshToUnstructuredMesh} (Figure \ref{fig:convertmesh}) and adding \textbf{ClipFieldByFunction} (Figure \ref{fig:clipfield}) to the network. |
| 300 | +%% TODO: should highlight in image |
| 301 | +Set the clipping location setting in ClipFieldByFunction to \emph{all nodes}. |
| 302 | +Use the expression $DATA1> 1 \&\& X < 0$ to clip the field (Figure \ref{fig:clipfield_input}). |
| 303 | + |
| 304 | +\begin{figure}[H] |
| 305 | +\center |
| 306 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/convertmesh.png} |
| 307 | +\caption{Convert the original field to an unstructured mesh.} |
| 308 | +\label{fig:convertmesh} |
| 309 | +\end{figure} |
| 310 | + |
| 311 | +\begin{figure}[H] |
| 312 | +\center |
| 313 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/clipfield.png} |
| 314 | +\caption{Insert a ClipFieldbyFunction module.} |
| 315 | +\label{fig:clipfield} |
| 316 | +\end{figure} |
| 317 | + |
| 318 | +\begin{figure}[H] |
| 319 | +\center |
| 320 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/clipfield_input.png} |
| 321 | +\caption{Clip the field by entering an expression in the ClipField UI.} |
| 322 | +\label{fig:clipfield_input} |
| 323 | +\end{figure} |
| 324 | + |
| 325 | + |
| 326 | +\subsection{Extract Boundary}\label{clipvol} |
| 327 | + |
| 328 | + |
| 329 | +At this point, it will be necessary to map the fields by interpolating the the boundary surface field to the clipping field. |
| 330 | +First, use \textbf{BuildMappingMatrix} to build a matrix that maps a linear combination of data values in the clipping field to a value in the boundary field. Then use \textbf{ApplyMappingMatrix} to multiply the data vector of the clipping field with the mapping matrix to obtain the data vector for the boundary surface field (Figure \ref{fig:mappingmatrix}). Use GetFieldBoundary to extract the boundary surface from the lattice volume and use it as input into the ApplyMappingMatrixModule and BuildMapping Matrix (Figure \ref{fig:highlightmods}). Port the output from the BuildMappingMatrix module to ApplyMappingMatrix and visualize the resultant field using a ShowFieldModule (Figure \ref{fig:viewbound}). Add a colormap to and enable transparency in ShowField UI for further functionality (Figure \ref{fig:finalview}) |
| 331 | + |
| 332 | +\begin{figure}[H] |
| 333 | +\center |
| 334 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/mappingmatrix.png} |
| 335 | +\caption{Build and apply the mapping network connections.} |
| 336 | +\label{fig:mappingmatrix} |
| 337 | +\end{figure} |
| 338 | + |
| 339 | +\begin{figure}[H] |
| 340 | +\center |
| 341 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/fieldboundary.png} |
| 342 | +\caption{Add GetFieldBoundary to the network.} |
| 343 | +\label{fig:highlightmods} |
| 344 | +\end{figure} |
| 345 | + |
| 346 | +\begin{figure}[H] |
| 347 | +\center |
| 348 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/view_boundary.png} |
| 349 | +\caption{Connect all the modules for mapping and visualize the output.} |
| 350 | +\label{fig:viewbound} |
| 351 | +\end{figure} |
| 352 | + |
| 353 | +\begin{figure}[H] |
| 354 | +\center |
| 355 | +\includegraphics[width=0.9\textwidth]{BasicTutorial_figures/finalview.png} |
| 356 | +\caption{Add a colormap and enable transparency.} |
| 357 | +\label{fig:finalview} |
| 358 | +\end{figure} |
| 359 | + |
| 360 | +Finally, it is not strictly necessary to explicitly convert the original mesh to an unstructured mesh using ConvertMeshToUnstructuredMesh because ClipFieldByFunction can implicitly convert structured mesh types to unstructured mesh types before clipping the field. |
| 361 | +As a final exercise, delete ConvertMeshToUnstructuredMesh from the network and try to obtain the same result. |
| 362 | + |
| 363 | +\end{document} |
0 commit comments