From: <of...@us...> - 2009-06-09 10:33:40
|
Revision: 43 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=43&view=rev Author: ofriman Date: 2009-06-09 10:33:30 +0000 (Tue, 09 Jun 2009) Log Message: ----------- Checked in the module MatlabScriptWrapper that executes Matlab code within MeVisLab. Added Paths: ----------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.bat trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.h trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperSystem.h trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h Added: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def (rev 0) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,115 @@ +// **InsertLicense** code +//---------------------------------------------------------------------------------- +//! MLMatlabScriptWrapper module definitions. +/*! +// \file MLMatlabScriptWrapper.def +// \author Alexander Gryanik +// \date 2009-02-23 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule MatlabScriptWrapper +//---------------------------------------------------------------------------------- +MLModule MatlabScriptWrapper { + DLL = "MLMatlabScriptWrapper" + genre = "Other" + author = "Alexander Gryanik, Ola Friman, Markus Harz" + status = "work-in-progress" + comment = "Execute matlab script on an image to produce an output image." + keywords = "matlab scripting wrapper" + seeAlso = "" + documentation = "$(LOCAL)/html/MatlabScriptWrapper.html" + exampleNetwork = "$(LOCAL)/networks/MatlabScriptWrapperExample.mlab" + + Window { + width = 500 + Category Main { + Vertical { + margin = 4 + TextView MatlabScript { + dependsOn = !useExternalScript + autoApply = Yes + showLineNumbers = Yes + } + + CheckBox useExternalScript {} + Horizontal { + Field matlabScriptPath { + title = "Matlab Script:" + expandX = yes + browseButton = ON + browseMode = open + browseFilter = "Database Files (*.m)" + dependsOn = useExternalScript} + } + Vertical { + Horizontal { + Vertical { + Box "Input image names" { + Field inDataName0 {title = "Input0 name:" expandX = yes} + Field inDataName1 {title = "Input1 name:" expandX = yes} + Field inDataName2 {title = "Input2 name:" expandX = yes} + } + } + Vertical { + Box "Output image names" { + Field outDataName0 {title = "Output0 name:" expandX = yes} + Field outDataName1 {title = "Output1 name:" expandX = yes} + Field outDataName2 {title = "Output2 name:" expandX = yes} + } + } + + } + Box "XMarker names" { + Field inXMarkerName {title = "Input name:" expandX = yes} + Field outXMarkerName {title = "Output name:" expandX = yes} + } + } + + Horizontal { + CheckBox autoUpdate {title = "Auto-update on input data change"} + Button restartMatlab { alignX = Right title = "Restart Matlab"} + } + Field status {title = "Status:" edit = No} + Button update { alignX = Left title = "Update" } + } + } + Category Scalars{ + Horizontal { + Vertical { + //Box "Input scalars" { + Horizontal { + Field scalarName0 {title = "Name:" expandX = yes} + Field scalar0 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName1 {title = "Name:" expandX = yes} + Field scalar1 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName2 {title = "Name:" expandX = yes} + Field scalar2 {title = "Value:" expandX = yes} + } + //} + //Box "Output scalars" { + Horizontal { + Field scalarName3 {title = "Name:" expandX = yes} + Field scalar3 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName4 {title = "Name:" expandX = yes} + Field scalar4 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName5 {title = "Name:" expandX = yes} + Field scalar5 {title = "Value:" expandX = yes} + } + //} + } + } + } +} +} // MLModule MatlabScriptWrapper + Property changes on: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html (rev 0) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,446 @@ +<!DOCTYPE html> +<html> +<head> +</head> + + +<body> + + + + + +<center> +<a href="#Purpose">Purpose</a> +<a href="#Usage">Usage</a> +<a href="#Details">Details</a> +<a href="#Inputs">Inputs</a> +<a href="#Outputs">Outputs</a> +<a href="#Parameters">Parameters</a> +<a href="#Events%20And%20Interaction">Events And Interaction</a> +<a href="#Example">Example</a> +<a href="#Tips%20And%20Tricks">Tips And Tricks</a> +<a href="#Known%20Bugs">Known Bugs</a> + +<hr width="100%"> +</center> + + + + + +<h2>MatlabScriptWrapper +</h2> + + + + + +<h3><a name="Purpose"></a>Purpose</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> +The <b>MatlabScriptWrapper</b> module offers +the possibility to execute Matlab scripts within +MevisLab and establish a link to a Matlab console, for example to +transfer data between MeVisLab and Matlab. Note that Matlab must be +installed for this module to function.</blockquote> + + + + + +<h3><a name="Usage"></a>Usage</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;">Currently, three types of data structures can be transferred between MeVisLab and Matlab: <br> + + + + + + + <ul> + + + + <li><span style="font-weight: bold;">Images:</span> Up to 3 images can be used. Images are +stored as up to 6 dimensional matrices in Matlab. Note that MeVisLab +and Matlab use different coordinate systems, see below for further +information.</li> + + + + + + + </ul> + + + + + + + <ul> + + + + <li><span style="font-weight: bold;">XMarkerLists:</span> An +XMarker is an object that contains a point (up to 6 dimensions), a +vector (3 dimension) and a type variable (integer). An XMarkerList is an array of XMarker objects. In Matlab, an XMarkerList is +represented as a struct with the following members</li> + + + + + + + </ul> + + + + <span style="font-style: italic;"><variablename></span>.pos where pos is an <span style="font-style: italic;">N</span>x2, <span style="font-style: italic;">N</span>x3, <span style="font-style: italic;">N</span>x4, <span style="font-style: italic;">N</span>x5 or <span style="font-style: italic;">N</span>x6 matrix with the position coordinates. <span style="font-style: italic;">N</span> is the number of XMarkers.<br> + + + + <span style="font-style: italic;"><variablename></span>.vec where vec is an <span style="font-style: italic;">N</span>x2 or <span style="font-style: italic;">N</span>x3 matrix of vectors.<br> + + + + <span style="font-style: italic;"><variablename></span>.type where type is an <span style="font-style: italic;">N</span>x1 vector of integers.<br> + + + + <br> + + + + Important: the pos matrix determines the number of XMarkers <span style="font-style: italic;">N</span>. The vec and type matrices must have the same number of rows <span style="font-style: italic;">N</span>, +otherwise will + these values not be copied back to MeVisLab. See the example +network for an example.<br> + + + + + + + <ul> + + + + <li><span style="font-weight: bold;">Scalars: </span>Double +precision. These can be used both as input and ouput variables. Field +notifications will be sent in MeVisLab only if a scalar has changed its +value after the Matlab script execution.</li> + + + + + + + </ul> + + + +The variable names for the above data structures in the Matlab workspace can be set.<br> + + +The Matlab script can be written directly in the module GUI, or an +external script file (.m) can be called. If you choose to use +existing script the script in script field will +disappear and there is no posibility to edit matlab script file form +MevisLab. <br> + + +Push the "Update"-button to execute the Matlab script, or set Auto-Update. +</blockquote> + + + + + + + +<h3><a name="Details"></a>Details</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><span style="font-weight: bold;">Coordinate systems in MeVisLab and Matlab</span><br> + + +In the context of this module, the only coordinate system that is +considered is the discrete voxel index coordinate system, i.e., images +are considered as multidimensional matrices. Both MeVisLab and Matlab +have the origin in the upper left corner and a y-axis that points +"downwards". However, note that MeVisLab starts counting a 0, whereas +Matlab starts counting a 1, i.e., the upper left voxel has the +coordinate (0,0) in MeVisLab and (1,1) in Matlab. The major difference +between MeVisLab and Matlab is the indexing order: MeVisLab uses +[x,y] while Matlab uses [y,x] (i.e., row-column into a matrix). Thus, +an image will appear flipped when exported from MeVisLab and visualized +in Matlab or vice-versa. To correct for this, one can use the <span style="font-style: italic;">permute</span> command in Matlab, for example<br> + + + <br> + + +>> permute(Input0,[2 1])<br> + + + <br> + + +which swaps the x and y axes. See the example network for an example.<br> + + +</blockquote> + + + + + + +<h3><a name="Inputs"></a>Inputs</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;">Up to 3 input +images and one XMarkerlist can be attached to the module. Input to the +module from MeVisLab is optional, the output can be generated entirely +in Matlab without input from MeVisLab (see the example network for +examples). +</blockquote> + + + + + + +<h3><a name="Outputs"></a>Outputs</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;">Up to 3 output images and one XMarkerList. +</blockquote> + + + + + + +<h3><a name="Parameters"></a>Parameters</h3> + + + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><b> Matlab Script</b><br> + + +A field where the Matlab script can be written. <b></b> +</blockquote> + + + + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><b>Use External Script</b><br> + + +Enables the possibility to use an external Matlab script file (.m).<br> + + + +</blockquote> + + + + + + + + + + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><b>Input/Output image, XMarker names</b><br> + + +The variable names in the Matlab script of the input and output data structures. +</blockquote> + + + + + + + + + + + + + + + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><span style="font-weight: bold;">Auto-update on input data change</span><br> + + +Execute the script automatically on input change (only for input images and the XMarkerList, not for changes in the GUI).<br> + + + <span style="font-weight: bold;">Status</span><br> + + +This field gives information whether the Matlab script was executed correctly or not.<br> + + <br> + + <span style="font-weight: bold;">Restart Matlab</span><br> + +Restarts the Matlab engine.<br> + + + + + +</blockquote> + + + + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><b>Update</b><br> + + +Execute the Matlab script.<b><br> + + + </b></blockquote> + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><b><br> + + + </b> +</blockquote> + + + + + + +<h3><a name="Events And Interaction"></a>Events And Interaction</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> + <span style="color: rgb(0, 0, 0);">-</span></blockquote> + + + + + +<h3><a name="Example"></a>Example</h3> + + + The example network shows a number of different uses of the <span style="font-weight: bold;">MatlabScriptWrapper</span> module.<br> + + +<h3><a name="Tips And Tricks"></a>Tips And Tricks</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> + <span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);">-</span> </span> +</blockquote> + + + + + +<h3><a name="Known Bugs"></a>Known Bugs</h3> + + + + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> + <span style="color: rgb(0, 0, 0);">-</span></blockquote> + + + + + +<br> + + + + + +<br> + + + + + +<br> + + + + + +<br> + + + + + +<br> + + + + + +<br> + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,1030 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module Comment { + internal { + frame = "953 589 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "625 584 256 209" + sizeHint = "256 209" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Comment3 + comment = "This example creates and implict representation of a torus in Matlab and visualizes it in MeVisLab as an isosurface. Press the Update button in the MatlabScriptWrapper and see the result in the SoExaminerViewer." + } + internalFields = "" +} +module SoWEMRenderer { + internal { + frame = "801 521 128 64" + moduleGroupName = "" + windows { + window _default { + geometry = "420 451 318 416" + sizeHint = "318 416" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = TorusRenderer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + useHighlightSelected = FALSE + usePolygonOffset = TRUE + useShapeHints = TRUE + parameterOverwriteMode = OVERWRITE_MODE_ALL + overwriteColorMode = FALSE + overwriteFaceParameters = FALSE + overwriteEdgeParameters = FALSE + overwriteNodeParameters = FALSE + overwriteBoundingBoxParameters = FALSE + colorMode = WEM_COLOR_LUT_VALUES + drawFaces = TRUE + faceDiffuseColor = "1 1 0" + useFaceAmbientColor = TRUE + faceAmbientColor = "1 0.3333333432674408 0" + useFaceSpecularColor = TRUE + faceSpecularColor = "0 0 0" + drawEdges = FALSE + edgeColor = "0 0 0" + drawNodes = FALSE + nodeColor = "1 1 1" + drawBoundingBoxes = FALSE + boundingBoxColor = "1 1 1" + drawFaceNormals = FALSE + drawNodeNormals = FALSE + faceNormalColor = "1 1 1" + nodeNormalColor = "1 1 1" + faceNormalScaling = 1 + nodeNormalScaling = 1 + faceAlphaValue = 1 + faceShininessValue = 1 + lineWidth = 1 + pointSize = 1 + useEdgeColoringMode = FALSE + nodeRenderingMode = WEM_NODE_RENDERING_NORMAL + boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED + primitiveValueLists = LUT + selectedPrimitiveValueList = LUT + primitiveValueListValid = TRUE + selectedTab = 0 + } +} +module SoExaminerViewer { + internal { + frame = "793 453 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "26 59 489 362" + sizeHint = "489 362" + wasOpen = no + wasActive = no + } + window _viewer { + geometry = "1175 433 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer1 + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = DELAYED_BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + height = 0.7853980064 + position = "48.92348480224609 94.9647216796875 145.5186157226562" + orientation = "0.3436312079429626 -0.2769282162189484 -0.8973450660705566 5.137053489685059" + nearDistance = 96.22691345 + farDistance = 141.0202637 + focalDistance = 118.6015244 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module WEMIsoSurface { + internal { + frame = "797 589 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "771 491 375 427" + sizeHint = "375 427" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMIsoSurface + isProcessing = FALSE + elapsedTime = 0.123999998 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "1 0 0.4980392156862745" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "1 0 0" + useFaceSpecularColor = TRUE + faceSpecularColor = "1 1 0" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + isoMinValue = 1200 + isoMaxValue = 3 + useMinValue = TRUE + useMaxValue = FALSE + cellExtend = "2 2 2" + useWorldCoords = TRUE + useInterpolation = TRUE + useQuadrification = FALSE + useFaceValueList = FALSE + useValenceThreeRemoval = TRUE + useZeroLengthEdgeRemoval = TRUE + progress = 1 + selectedTab = 2 + } +} +module Comment { + internal { + frame = "1289 605 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "715 443 321 209" + sizeHint = "256 209" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Comment2 + comment = "This example illustrates that MeVisLab and Matlab have different coordinate systems. Press the Update button in the MatlabScriptWrapper module and compare the Matlab-generated plots with the plot in the View2D module." + } + internalFields = "" +} +module View2D { + internal { + frame = "1097 541 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "455 437 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D1 + inventorInputOn = FALSE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_NEAREST + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 2047.5 + lutWidth = 4095 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 5.5" + } + internalFields = "" +} +module LocalImage { + internal { + frame = "1161 685 96 56" + moduleGroupName = "" + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0aVC8/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module SubImage { + internal { + frame = "1189 605 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "175 619 559 353" + sizeHint = "559 353" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SubImage + boxInput = "0 0 0 0 0 0 -1 -1 -1 -1 -1 -1" + autoApplyBox = FALSE + x = 0 + sx = 64 + modifyX = FALSE + y = 0 + sy = 64 + modifyY = FALSE + z = 5 + sz = 1 + modifyZ = TRUE + c = 0 + sc = 1 + modifyC = FALSE + t = 0 + st = 1 + modifyT = FALSE + u = 0 + su = 1 + modifyU = FALSE + fillValue = 0 + mode = VoxelStartSize + autoApply = TRUE + } +} +module MatlabScriptWrapper { + internal { + frame = "1189 533 152 56" + moduleGroupName = "" + windows { + window _default { + geometry = "233 303 400 650" + sizeHint = "400 650" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MatlabScriptWrapper3 + MatlabScript = "% This script illustrates the difference in coordinate +% systems in MeVisLab and Matlab. MeVisLab uses a +% (x,y) system while Matlab uses a (y,x) system. Image +% will therefore appear flipped. The Matlab command +% 'permute' can fix this. + +figure(1),clf +subplot(121) +imagesc(Input0), axis image +title(sprintf('Direct plot of image from MeVisLab.\\nNote that the image is flipped.')) + +subplot(122) +imagesc(permute(Input0,[2 1])), axis image +title(sprintf('Plot of image from MeVisLab\\nafter permute(Input0,[2 1]) command')) + +colormap gray" + useExternalScript = FALSE + matlabScriptPath = "" + inDataName0 = Input0 + inDataName1 = Input1 + inDataName2 = Input2 + outDataName0 = Output0 + outDataName1 = Output1 + outDataName2 = Output2 + inXMarkerName = inXMarker + outXMarkerName = outXMarker + autoUpdate = FALSE + status = "Execution successful!" + scalarName0 = scalar0 + scalar0 = 0 + scalarName1 = scalar1 + scalar1 = 0 + scalarName2 = scalar2 + scalar2 = 0 + scalarName3 = scalar3 + scalar3 = 0 + scalarName4 = scalar4 + scalar4 = 0 + scalarName5 = scalar5 + scalar5 = 0 + } +} +module StylePalette { + internal { + frame = "49 621 96 56" + moduleGroupName = "" + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 4 + markerSize2 = 4 + markerSize3 = 4 + markerSize4 = 4 + markerSize5 = 4 + markerSize6 = 4 + markerSize7 = 4 + markerSize8 = 4 + markerSize9 = 4 + markerSize10 = 4 + markerSize11 = 4 + markerSize12 = 4 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module MatlabScriptWrapper { + internal { + frame = "813 661 152 56" + moduleGroupName = "" + windows { + window _default { + geometry = "257 300 400 657" + sizeHint = "400 657" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MatlabScriptWrapper2 + MatlabScript = "% The script lines below sets the output image to an implicit % function representation of a torus. +[x,y,z] = meshgrid(-10:0.25:10,-10:0.25:10,-10:0.25:10); +R = 6; +Output0 = (R-sqrt(x.^2+y.^2)).^2 + z.^2;" + useExternalScript = FALSE + matlabScriptPath = "" + inDataName0 = Input0 + inDataName1 = Input1 + inDataName2 = Input2 + outDataName0 = Output0 + outDataName1 = Output1 + outDataName2 = Output2 + inXMarkerName = inXMarker + outXMarkerName = outXMarker + autoUpdate = FALSE + status = "Execution successful!" + scalarName0 = scalar0 + scalar0 = 0 + scalarName1 = scalar1 + scalar1 = 0 + scalarName2 = scalar2 + scalar2 = 0 + scalarName3 = scalar3 + scalar3 = 0 + scalarName4 = scalar4 + scalar4 = 0 + scalarName5 = scalar5 + scalar5 = 0 + } +} +module Comment { + internal { + frame = "385 477 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "715 443 256 209" + sizeHint = "256 209" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Comment1 + comment = "In this example, a test pattern is created in MeVisLab and this pattern is modified in Matlab and used again as an overlay in MeVisLab. Press Update in the MatlabScriptWrapper module." + } + internalFields = "" +} +module SoView2DOverlay { + internal { + frame = "509 485 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "613 368 460 359" + sizeHint = "460 359" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DOverlay + drawingOn = TRUE + editingOn = TRUE + maskValid = TRUE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = TRUE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = TRUE + clipToSlice = TRUE + cursorShape = UNDEFINED_CURSOR + cacheTextures = TRUE + blendMode = BLEND_BLEND + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + inheritFilterMode = TRUE + alphaFactor = 0.5619999766 + baseColor = "1 1 0" + useWorldCoords = FALSE + applyLut = TRUE + isCheckerTiling = FALSE + checkerTileSize = 2 + areCheckerTilesInverted = FALSE + } +} +module View2D { + internal { + frame = "469 389 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "234 451 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = TRUE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 0.5 + lutWidth = 1 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 0.5" + } + internalFields = "" +} +module TestPattern { + internal { + frame = "441 653 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "263 482 248 401" + sizeHint = "248 401" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = TestPattern + sizeX = 256 + sizeY = 256 + sizeZ = 1 + sizeC = 1 + sizeT = 1 + sizeU = 1 + dataType = float + fillValue = 1 + autoApply = TRUE + pattern = FilledMaxEllipsoid + fillValue2 = 0 + pageSizeX = 32 + pageSizeY = 32 + pageSizeZ = 1 + pageSizeC = 1 + pageSizeT = 1 + pageSizeU = 1 + } +} +module MatlabScriptWrapper { + internal { + frame = "533 549 152 56" + moduleGroupName = "" + windows { + window _default { + geometry = "877 264 452 650" + sizeHint = "400 650" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MatlabScriptWrapper1 + MatlabScript = "% This script illustrates with a toy example how images can be +% imported into Matlab, modified and exported back to MeVisLab. +% In this particular example, the input image is divided with a +% sinusoidal pattern. + +% Copy input image to ouput +Output0 = Input0; + +% Get size of input image +[sy,sx] = size(Input0); + +% Make a sine pattern in the output +mid = floor(sx/2); +for k=1:sy + Output0(k,mid + floor(sx/10*sin(2*pi/sy*3*k)):end) = 0; +end +" + useExternalScript = FALSE + matlabScriptPath = "" + inDataName0 = Input0 + inDataName1 = Input1 + inDataName2 = Input2 + outDataName0 = Output0 + outDataName1 = Output1 + outDataName2 = Output2 + inXMarkerName = inXMarker + outXMarkerName = outXMarker + autoUpdate = FALSE + status = "Execution successful!" + scalarName0 = scalar0 + scalar0 = 0 + scalarName1 = scalar1 + scalar1 = 0 + scalarName2 = scalar2 + scalar2 = 0 + scalarName3 = scalar3 + scalar3 = 0 + scalarName4 = scalar4 + scalar4 = 0 + scalarName5 = scalar5 + scalar5 = 0 + } +} +module Comment { + internal { + frame = "-11 501 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "373 492 256 209" + sizeHint = "256 209" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Comment + comment = "This example creates an XMarkerList with Matlab and displays the points in 3D in MeVisLab. Press Update in the MatlabScriptWrapper and see the result in the SoExaminerViewer. The StylePalette module sets the color according to the type-feature set in the Matlab-script. +" + } + internalFields = "" +} +module SoExaminerViewer { + internal { + frame = "85 429 136 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "589 304 605 607" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + height = 0.7853981853 + position = "1.466153740882874 -34.25235366821289 -22.5416316986084" + orientation = "-0.1885406076908112 0.8626965284347534 -0.4692621827125549 3.305067300796509" + nearDistance = 31.73994255 + farDistance = 50.33739471 + focalDistance = 41.04526138 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module So3DXMarker { + internal { + frame = "101 501 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "20 228 292 745" + sizeHint = "292 745" + wasOpen = no + wasActive = no + } + } + } + fields { + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + scaleSize = 3 + scaleLength = 0.1000000015 + color = "0.3333333432674408 1 0" + validStylePalette = TRUE + enableVector = FALSE + drawingOn = TRUE + editingOn = TRUE + selectingOn = TRUE + deleteOnClick = FALSE + addOnClick = TRUE + edit3DOn = FALSE + edit3DVector = FALSE + colorMode = COLOR_BY_TYPE + markerType = 0 + textColorMode = COLOR_TEXT + textMode = TEXT_OFF + textColor = "1 1 1" + textShadow = TRUE + vectorArrow = VECTOR_NO_ARROWS + lineStyle = Solid + drawMode = DrawModeCorrect + instanceName = So3DXMarker + listString = "" + numItems = 30 + index = 0 + persistent = FALSE + listStringEnable = FALSE + ownsList = FALSE + applySelect = FALSE + id = 0 + name = "" + newName = "" + actionClass = New + actionIndex = -1 + actionId = -1 + currentIndex = -1 + overflowMode = None + maxSize = 0 + useInsertTemplate = FALSE + upToDate = TRUE + posXYZ = "10 0 0" + posC = 0 + posT = 0 + posU = 0 + vecXYZ = "0 10 0" + type = 1 + newPosXYZ = "0 0 0" + newPosC = 0 + newPosT = 0 + newPosU = 0 + newVecXYZ = "0 0 0" + newType = 0 + } +} +module MatlabScriptWrapper { + internal { + frame = "145 621 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "925 237 400 657" + sizeHint = "400 657" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MatlabScriptWrapper + MatlabScript = "% This script illustrates how an XMarkerList is generated +% in Matlab and exported to MeVisLab. + +% Generate 30 angles between 0 and 2*pi +phi = linspace(0,2*pi,30)'; + +% Make a circle of points and set the vector and type +% properties of the XMarkers. +OutputXMarkerList.pos = 10*[cos(phi) sin(phi)]; +OutputXMarkerList.vec= 10*[-sin(phi) cos(phi)]; +OutputXMarkerList.type = [1:size(OutputXMarkerList.pos,1)]'; +" + useExternalScript = FALSE + matlabScriptPath = K:/Repository/MeVisResearch/Private/Modules/ML/MLMatlabModules/test.m + inDataName0 = Input0 + inDataName1 = Input1 + inDataName2 = Input2 + outDataName0 = Output0 + outDataName1 = Output1 + outDataName2 = Output2 + inXMarkerName = inXMarker + outXMarkerName = OutputXMarkerList + autoUpdate = FALSE + status = "Execution successful!" + scalarName0 = scalar0 + scalar0 = 0 + scalarName1 = scalar1 + scalar1 = 0 + scalarName2 = scalar2 + scalar2 = 0 + scalarName3 = scalar3 + scalar3 = 0 + scalarName4 = scalar4 + scalar4 = 0 + scalarName5 = scalar5 + scalar5 = 0 + } +} +connections { + TorusRenderer.inWEM = WEMIsoSurface.outWEM + SoExaminerViewer1.children = TorusRenderer.self + WEMIsoSurface.input0 = MatlabScriptWrapper2.output0 + View2D1.inImage = SubImage.output0 + SubImage.input0 = LocalImage.outImage + MatlabScriptWrapper3.input0 = SubImage.output0 + SoView2DOverlay.image = MatlabScriptWrapper1.output0 + View2D.inImage = TestPattern.output0 + View2D.inInvPreLUT = SoView2DOverlay.self + MatlabScriptWrapper1.input0 = TestPattern.output0 + SoExaminerViewer.children = So3DXMarker.self + So3DXMarker.stylePalette = StylePalette.outStylePalette + So3DXMarker.inXMarkerList = MatlabScriptWrapper.outputXMarkerList +} +networkModel = "" Property changes on: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.bat =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.bat (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.bat 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,3 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" MLMatlabScriptWrapper + + Property changes on: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.bat ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,89 @@ +# ----------------------------------------------------------------------------- +# MLMatlabScriptWrapper project profile +# +# \file MLMatlabScriptWrapper.pro +# \author Alexander Gryanik, Markus Harz, Ola Friman +# \date 2009-02-23 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = MLMatlabScriptWrapper + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# add dependencies of this project here +CONFIG += dll ML MLBase + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + +MLAB_PACKAGES += MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +win64 { + QMAKE_LIBDIR += "$$(MLAB_MeVisResearch_General)"/Sources/ML/MLMatlabScriptWrapper/MatlabCommon/win64 + + LIBS += libeng.lib + LIBS += libmat.lib + LIBS += libmex.lib + LIBS += libmwblas.lib + LIBS += libmwlapack.lib + LIBS += libmwmathutil.lib + LIBS += libmx.lib +} +else:win32 { + QMAKE_LIBDIR += "$$(MLAB_MeVisResearch_General)"/Sources/ML/MLMatlabScriptWrapper/MatlabCommon/win32 + + LIBS += libdflapack.lib + LIBS += libeng.lib + LIBS += libmat.lib + LIBS += libmex.lib + LIBS += libmwlapack.lib + LIBS += libmx.lib +} +else:macx { + MATLAB_LIBDIR = "$$(MLAB_MeVisResearch_General)"/Sources/ML/MLMatlabScriptWrapper/MatlabCommon/macos + + LIBS += $${MATLAB_LIBDIR}/libeng.dylib + LIBS += $${MATLAB_LIBDIR}/libmx.dylib + LIBS += $${MATLAB_LIBDIR}/libut.dylib + LIBS += $${MATLAB_LIBDIR}/libmat.dylib + LIBS += $${MATLAB_LIBDIR}/libhdf5.0.dylib + LIBS += $${MATLAB_LIBDIR}/libicudata.dylib.36 + LIBS += $${MATLAB_LIBDIR}/libicui18n.dylib.36 + LIBS += $${MATLAB_LIBDIR}/libicuio.dylib.36 + LIBS += $${MATLAB_LIBDIR}/libicuuc.dylib.36 + LIBS += $${MATLAB_LIBDIR}/libxerces-c.27.dylib + LIBS += $${MATLAB_LIBDIR}/libz.1.dylib +} +else:linux { + QMAKE_LIBDIR += "$$(MLAB_MeVisResearch_General)"/Sources/ML/MLMatlabScriptWrapper/MatlabCommon/linux + + LIBS += -lut + LIBS += -leng + LIBS += -lmat + LIBS += -lmex + LIBS += -lmwlapack + LIBS += -lmx +} + +DEFINES += MLMATLABSCRIPTWRAPPER_EXPORTS + +HEADERS += \ + MLMatlabScriptWrapperInit.h \ + MLMatlabScriptWrapperSystem.h \ + mlMatlabScriptWrapper.h + +SOURCES += \ + MLMatlabScriptWrapperInit.cpp \ + mlMatlabScriptWrapper.cpp + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def + + Property changes on: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.cpp 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,66 @@ +// Copyright (c) 2009, Fraunhofer MEVIS Institute for Medical Image Computing +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of the Fraunhofer MEVIS nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR THE COPYRIGHT HOLDER BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLMatlabScriptWrapperInit.cpp +// \author Alexander Gryanik, Markus Harz, Ola Friman +// \date 2009-02-23 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "MLMatlabScriptWrapperSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... +#include "mlMatlabScriptWrapper.h" + + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int MLMatlabScriptWrapperInit () +{ + ML_TRACE_IN("MLMatlabScriptWrapperInit ()") + + MatlabScriptWrapper::initClass(); + // Add initClass calls from all other modules here... + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(MLMatlabScriptWrapperInit) + Property changes on: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.h (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.h 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,49 @@ +// Copyright (c) 2009, Fraunhofer MEVIS Institute for Medical Image Computing +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of the Fraunhofer MEVIS nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR THE COPYRIGHT HOLDER BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLMatlabScriptWrapperInit.h +// \author Alexander Gryanik, Markus Harz, Ola Friman +// \date 2009-02-23 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLMatlabScriptWrapperInit_H +#define __MLMatlabScriptWrapperInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int MLMatlabScriptWrapperInit (); + +ML_END_NAMESPACE + +#endif // __MLMatlabScriptWrapperInit_H + + Property changes on: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperInit.h ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperSystem.h 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,57 @@ +// Copyright (c) 2009, Fraunhofer MEVIS Institute for Medical Image Computing +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of the Fraunhofer MEVIS nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR THE COPYRIGHT HOLDER BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLMatlabScriptWrapperSystem.h +// \author Alexander Gryanik, Markus Harz, Ola Friman +// \date 2009-02-23 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLMatlabScriptWrapperSystem_H +#define __MLMatlabScriptWrapperSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef MLMATLABSCRIPTWRAPPER_EXPORTS +// Use the MLMATLABSCRIPTWRAPPER_EXPORT macro to export classes and functions +#define MLMATLABSCRIPTWRAPPER_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define MLMATLABSCRIPTWRAPPER_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define MLMATLABSCRIPTWRAPPER_EXPORT +#endif + + +#endif // __MLMatlabScriptWrapperSystem_H + + Property changes on: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperSystem.h ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2009-06-09 10:33:30 UTC (rev 43) @@ -0,0 +1,753 @@ +// Copyright (c) 2009, Fraunhofer MEVIS Institute for Medical Image Computing +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of the Fraunhofer MEVIS nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR THE COPYRIGHT HOLDER BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! The ML module class MatlabScriptWrapper. +/*! +// \file mlMatlabScriptWrapper.cpp +// \author Alexander Gryanik, Markus Harz, Ola Friman +// \date 2009-02-23 +// +// Module for executing Matlab scripts in MeVisLab. +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "mlMatlabScriptWrapper.h" + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +#ifdef WIN32 +#pragma warning( push ) +#pragma warning( disable : 4702 ) // VC8: unreachable code +ML_BASEOP_CLASS_SOURCE(MatlabScriptWrapper, BaseOp); +#pragma warning( pop ) +#else +ML_BASEOP_CLASS_SOURCE(MatlabScriptWrapper, BaseOp); +#endif + + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +MatlabScriptWrapper::MatlabScriptWrapper (void) +: BaseOp(3, 3) +{ + ML_TRACE_IN("MatlabScriptWrapper::MatlabScriptWrapper()") + + FieldContainer *fields = getFieldContainer(); + ML_CHECK(fields); + + //! Change field values here without calling handleNotification. + handleNotificationOff(); + + (_inputXMarkerListFld = fields->addBase("inputXMarkerList"))->setBaseValue(NULL); + _outputXMarkerListFld = fields->addBase("outputXMarkerList"); + _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); + + (_matlabScriptFld = fields->addString("MatlabScript"))->setStringValue("Output0=Input0 % Type your matlab script here."); + + //! Use external matlab script. + (_useExternalScriptFld = fields->addBool("useExternalScript"))->setBoolValue(false); + + //! Where will matlab script be dumped. + (_matlabScriptPathFld = fields->addString("matlabScriptPath"))->setStringValue(""); + + //! Set input and output data names used in matlab. + (_inDataNameFld[0] = fields->addString("inDataName0"))->setStringValue("Input0"); + (_inDataNameFld[1] = fields->addString("inDataName1"))->setStringValue("Input1"); + (_inDataNameFld[2] = fields->addString("inDataName2"))->setStringValue("Input2"); + (_outDataNameFld[0] = fields->addString("outDataName0"))->setStringValue("Output0"); + (_outDataNameFld[1] = fields->addString("outDataName1"))->setStringValue("Output1"); + (_outDataNameFld[2] = fields->addString("outDataName2"))->setStringValue("Output2"); + //! Set input and output XMarker names used in matlab. + (_inXMarkerNameFld = fields->addString("inXMarkerName"))->setStringValue("inXMarker"); + (_outXMarkerNameFld = fields->addString("outXMarkerName"))->setStringValue("outXMarker"); + + //! Create image data randomly. + (_autoCalculationFld = fields->addBool("autoUpdate"))->setBoolValue(false); + //! Add toggle to delete user set variables befor new calculation. + //(_deleteMatlabVarFld = fields->addBool("delMatlabVar"))->setBoolValu... [truncated message content] |
From: <ss...@us...> - 2009-07-22 16:47:35
|
Revision: 177 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=177&view=rev Author: ssaur Date: 2009-07-22 16:47:31 +0000 (Wed, 22 Jul 2009) Log Message: ----------- added module SegmentationEvaluationMetric Added Paths: ----------- trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/ trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.def trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/html/ trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/html/SegmentationEvaluationMetric.html trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/networks/ trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/networks/SegmentationEvaluationMetricExample.mlab trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.bat trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.pro trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.sh trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.cpp trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.h trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.cpp trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.h Added: trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.def =================================================================== --- trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.def (rev 0) +++ trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.def 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------------------- +//! CVLSegmentationEvaluationMetric module definitions. +/*! +// \file CVLSegmentationEvaluationMetric.def +// \author Stefan Saur +// \date 2009-07-21 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule SegmentationEvaluationMetric +//---------------------------------------------------------------------------------- +MLModule SegmentationEvaluationMetric { + DLL = "CVLSegmentationEvaluationMetric" + + genre = "" + author = "Stefan Saur" + status = "work-in-progress" + comment = "" + keywords = "sensitivity, specificity, TP, TN, FP, FN, prevalence, dice coefficient, similarity" + seeAlso = "" + documentation = "$(LOCAL)/html/SegmentationEvaluationMetric.html" + exampleNetwork = "$(LOCAL)/networks/SegmentationEvaluationMetricExample.mlab" + + Window { + Category "Main" { + Box "Input" { + Vertical { + Field segmentationThreshold { title = "Segmentation Image Threshold" tooltip = "all values above threshold are regarded as foreground" } + Field referenceThreshold { title = "Reference Image Threshold" tooltip = "all values above threshold are regarded as foreground"} + Horizontal { + CheckBox isAutoApply {} + Button apply {} + } + } + } + Box "Output" { + Vertical { + Field truePositive { title = "True positive (TP)" edit = NO minLength = 10} + Field trueNegative { title = "True negative (TN)" edit= NO } + Field falsePositive { title = "False positive (FP)" edit = NO } + Field falseNegative { title = "False negative (FN)" edit = NO } + Field sensitivity { title = "Sensitivity" edit = NO } + Field specificity { title = "Specificity" edit = NO } + Field prevalence { title = "Prevalence" edit = NO } + Field levelOfTest { title = "Level of Test" edit = NO } + Field diceSimilarityCoefficient { title = "Dice Similarity Coefficient" edit = NO } + Field cFactor { title = "C-Factor" edit = NO } + } + } + } + } +} // MLModule SegmentationEvaluationMetric + Added: trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/html/SegmentationEvaluationMetric.html =================================================================== --- trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/html/SegmentationEvaluationMetric.html (rev 0) +++ trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/html/SegmentationEvaluationMetric.html 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,182 @@ +<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + + + + + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + + + + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + + + + + <meta name="Description" content="MeVisLab module help page template"> + + + + + <title>SegmentationEvaluationMetric</title> +</head> + + +<body> + + + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> +<a href="#Details">Details</a> <a href="#Inputs">Inputs</a> +<a href="#Outputs">Outputs</a> <a href="#Parameters">Parameters</a> +<a href="#EventInteract">Events&Interaction</a> <a href="#Example">Example</a> +<a href="#Tips&Tricks">Tips&Tricks</a> <a href="#KnownBugs">Known +Bugs</a> +<hr width="100%"></center> + + + +<h2> +SegmentationEvaluationMetric</h2> + + + +<h3> +<a name="Purpose"></a>Purpose</h3> + + + +<blockquote>Metric computation for the assessment of segmentation results. Given a segmentation and a reference segmentation, the module <b>SegmentationEvaluationMetric</b> computes some measures as described in:<br/> + +<i>Statistical validation metric for accuracy assessment in medical image segmentation</i><br/> +Aleksandra Popovic, Matias de la Fuente, Martin Engelhardt, Klaus Radermacher<br/> +Int J CARS, 2007(2):169-181<br/> +<a href="http://dx.doi.org/10.1007/s11548-007-0125-1 ">DOI 10.1007/s11548-007-0125-1</a> +<br/> +to evaluate the segmentation result. +</blockquote> + + +<h3> +<a name="Usage"></a>Usage</h3> + +<blockquote>Connect <b>input0</b> with the segmentation result and <b>input1</b> with the reference image. Set the thresholds for the segmentation and reference image in the parameters (all voxels above the corresponding threshold are regarded as foreground) and press the <b>Apply</b> button. +</blockquote> + + + +<h3> +<a name="Details"></a>Details</h3> + + + +<blockquote>None.</blockquote> + + + +<h3> +<a name="Inputs"></a>Inputs</h3> + + + +<blockquote> +<ul> + <li><b>input0</b> - segmentation image</li> + <li><b>input1</b> - reference image</li> +</ul> +</blockquote> + + + +<h3> +<a name="Outputs"></a>Outputs</h3> + + + +<blockquote>The module has no outputs.</blockquote> + + + +<h3> +<a name="Parameters"></a>Parameters</h3> + + + +<blockquote> + + <h4>Input</h4> + + <ul> + <li><b>Segmentation Image Threshold</b> - all voxels with an intensity value greater this threshold are regarded as foreground in the segmentation image (input0).</li> + <li><b>Reference Image Threshold</b> - all voxels with an intensity value greater this threshold are regarded as foreground in the reference image (input1).</li> + <li><b>Is auto apply</b> - if checked, computation is started whenever the input changes.</li> + <li><b>Apply</b> - start the computation.</li> + </ul> + + <br/> + + <h4>Output</h4> + <ul> + <li><b>True positive</b> - # of true positive voxels.</li> + <li><b>True negative</b> - # of true negative voxels.</li> + <li><b>False positive</b> - # of false positive voxels.</li> + <li><b>False negative</b> - # of false negative voxels.</li> + <li><b>Sensitivity</b></li> + <li><b>Specificity</b></li> + <li><b>Prevalence</b></li> + <li><b>Level of Test</b></li> + <li><b>Dice Similarity Coefficient</b></li> + <li><b>C-Factor</b></li> + </ul> + + +</blockquote> + + + +<h3> +<a name="EventInteract"></a>Events & Interaction</h3> + + + +<blockquote>Describe which mouse clicks or movements, or keystrokes are +needed for proper operation or how they are influenced by certain +parameters. Also the usage of other or untypical devices should be +discussed here. +</blockquote> + + + +<h3> +<a name="Example"></a>Example</h3> + + + +<blockquote>See example network.</blockquote> + + + +<h3> +<a name="Tips&Tricks"></a>Tips & Tricks</h3> + + + +<blockquote>None.</blockquote> + + + +<h3> +<a name="KnownBugs"></a>Known Bugs</h3> + + + +<blockquote>None.<br> + +</blockquote> + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/networks/SegmentationEvaluationMetricExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/networks/SegmentationEvaluationMetricExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/CVLSegmentationEvaluationMetric/networks/SegmentationEvaluationMetricExample.mlab 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,140 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module Comment { + internal { + frame = "-275 -123 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "37 368 256 209" + sizeHint = "256 209" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = Comment + comment = "Press the apply button to compute the segmentation statistics." + } + internalFields = "" +} +module Threshold { + internal { + frame = "41 133 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "509 491 268 92" + sizeHint = "268 92" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Threshold1 + threshold = 1300 + minValue = 0 + maxValue = 4095 + relativeThreshold = FALSE + } +} +module Threshold { + internal { + frame = "-115 133 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "509 491 268 92" + sizeHint = "268 92" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Threshold + threshold = 1500 + minValue = 0 + maxValue = 4095 + relativeThreshold = FALSE + } +} +module Bypass { + internal { + frame = "29 57 120 64" + moduleGroupName = "" + } + fields { + instanceName = ReferenceImage + ignoreNextNotify = FALSE + noBypass = FALSE + } +} +module Bypass { + internal { + frame = "-143 49 144 64" + moduleGroupName = "" + } + fields { + instanceName = SegmentationResult + ignoreNextNotify = FALSE + noBypass = FALSE + } +} +module LocalImage { + internal { + frame = "-63 245 96 56" + moduleGroupName = "" + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC8/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module SegmentationEvaluationMetric { + internal { + frame = "-99 -27 200 56" + moduleGroupName = "" + windows { + window _default { + geometry = "638 298 264 423" + sizeHint = "264 423" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SegmentationEvaluationMetric + segmentationThreshold = 0 + referenceThreshold = 0 + truePositive = 0 + trueNegative = 0 + falsePositive = 0 + falseNegative = 0 + sensitivity = 0 + specificity = 0 + prevalence = 0 + levelOfTest = 0 + diceSimilarityCoefficient = 0 + cFactor = 0 + isAutoApply = FALSE + } +} +connections { + Threshold1.input0 = LocalImage.outImage + Threshold.input0 = LocalImage.outImage + ReferenceImage.input0 = Threshold1.output0 + SegmentationResult.input0 = Threshold.output0 + SegmentationEvaluationMetric.input0 = SegmentationResult.output0 + SegmentationEvaluationMetric.input1 = ReferenceImage.output0 +} +networkModel = "" Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.bat =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.bat (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.bat 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,3 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" CVLSegmentationEvaluationMetric + + Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.pro =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.pro (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.pro 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,41 @@ +# ----------------------------------------------------------------------------- +# CVLSegmentationEvaluationMetric project profile +# +# \file CVLSegmentationEvaluationMetric.pro +# \author Stefan Saur +# \date 2009-07-21 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = CVLSegmentationEvaluationMetric + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + +# add used projects here (see included pri files below for available projects) +CONFIG += dll ML + +MLAB_PACKAGES += MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += CVLSEGMENTATIONEVALUATIONMETRIC_EXPORTS + +HEADERS += \ + CVLSegmentationEvaluationMetricInit.h \ + CVLSegmentationEvaluationMetricSystem.h \ + mlSegmentationEvaluationMetric.h + +SOURCES += \ + CVLSegmentationEvaluationMetricInit.cpp \ + mlSegmentationEvaluationMetric.cpp + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.def + Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.sh =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.sh (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetric.sh 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,35 @@ +#! /bin/bash +#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------- +# +# Copyright (c) 2001-2009, MeVis Medical Solutions AG, Bremen, Germany +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of MeVis Medical Solutions AG nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY MEVIS MEDICAL SOLUTIONS AG ''AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL MEVIS MEDICAL SOLUTIONS AG BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#----------------------------------------------------------------------------- +if [ "`uname -s`" = "Darwin" && "$MLAB_ROOT" = "" ]; then + echo "Generate Xcode projects by double-clicking the file 'CVLSegmentationEvaluationMetric.pro' in Finder or use the MeVisLabProjectGenerator.app from the command line to customize the project creation." +else + python $MLAB_ROOT/MeVis/Foundation/BuildTools/Scripts/createProject.py CVLSegmentationEvaluationMetric +fi + Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.cpp 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,42 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file CVLSegmentationEvaluationMetricInit.cpp +// \author Stefan Saur +// \date 2009-07-21 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "CVLSegmentationEvaluationMetricSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... +#include "mlSegmentationEvaluationMetric.h" + + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int CVLSegmentationEvaluationMetricInit () +{ + ML_TRACE_IN("CVLSegmentationEvaluationMetricInit ()") + + SegmentationEvaluationMetric::initClass(); + // Add initClass calls from all other modules here... + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(CVLSegmentationEvaluationMetricInit) + Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.h =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.h (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricInit.h 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file CVLSegmentationEvaluationMetricInit.h +// \author Stefan Saur +// \date 2009-07-21 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __CVLSegmentationEvaluationMetricInit_H +#define __CVLSegmentationEvaluationMetricInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int CVLSegmentationEvaluationMetricInit (); + +ML_END_NAMESPACE + +#endif // __CVLSegmentationEvaluationMetricInit_H + + Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file CVLSegmentationEvaluationMetricSystem.h +// \author Stefan Saur +// \date 2009-07-21 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __CVLSegmentationEvaluationMetricSystem_H +#define __CVLSegmentationEvaluationMetricSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef CVLSEGMENTATIONEVALUATIONMETRIC_EXPORTS +// Use the CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT macro to export classes and functions +#define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT +#endif + + +#endif // __CVLSegmentationEvaluationMetricSystem_H + + Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.cpp =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.cpp (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.cpp 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,296 @@ +//---------------------------------------------------------------------------------- +//! The ML module class SegmentationEvaluationMetric. +/*! +// \file mlSegmentationEvaluationMetric.cpp +// \author Stefan Saur +// \date 2009-07-21 +// +// Validatation metric for accuracy assessment in medical image segmentation as described in +// +// "Statistical validation metric for accuracy assessment in medical image segmentation" +// Aleksandra Popovic, Matias de la Fuente, Martin Engelhardt, Klaus Radermacher +// Int J CARS, 2007(2):169-181 +// DOI 10.1007/s11548-007-0125-1 +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlSegmentationEvaluationMetric.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(SegmentationEvaluationMetric, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +SegmentationEvaluationMetric::SegmentationEvaluationMetric () + : BaseOp(2, 0) +{ + ML_TRACE_IN("SegmentationEvaluationMetric::SegmentationEvaluationMetric ()"); + + // Suppress calls of handleNotification on field changes to + // avoid side effects during initialization phase. + handleNotificationOff(); + + // Get reference to the container for parameters/fields. + FieldContainer &fields = *getFieldContainer(); + + // Add fields to the module and set their values. + // Also attach them to the output images to notify connected modules about changes. + + (_segmentationThresholdFld = fields.addInt("segmentationThreshold"))->setIntValue(0); + (_referenceThresholdFld = fields.addInt("referenceThreshold"))->setIntValue(0); + + (_truePositiveFld = fields.addInt("truePositive"))->setIntValue(0); + (_trueNegativeFld = fields.addInt("trueNegative"))->setIntValue(0); + (_falsePositiveFld = fields.addInt("falsePositive"))->setIntValue(0); + (_falseNegativeFld = fields.addInt("falseNegative"))->setIntValue(0); + (_sensitivityFld = fields.addDouble("sensitivity"))->setDoubleValue(0.0); + (_specificityFld = fields.addDouble("specificity"))->setDoubleValue(0.0); + (_prevalenceFld = fields.addDouble("prevalence"))->setDoubleValue(0.0); + (_levelOfTestFld = fields.addDouble("levelOfTest"))->setDoubleValue(0.0); + (_diceSimilarityCoefficientFld = fields.addDouble("diceSimilarityCoefficient"))->setDoubleValue(0.0); + (_cFactorFld = fields.addDouble("cFactor"))->setDoubleValue(0.0); + + (_isAutoApplyFld = fields.addBool("isAutoApply"))->setBoolValue(false); + _applyFld = fields.addNotify("apply"); + + // Connect input field(s) with output field(s) to notify + // connected modules if input image(s) change. + for (int inIdx=0; inIdx < 2; ++inIdx){ + for (int outIdx=0; outIdx < 0; ++outIdx){ + getInField(inIdx)->attachField(getOutField(outIdx)); + } + } + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); + + // Activate inplace data buffers for output outIndex and input inIndex. + // setOutImgInplace(outIndex, inIndex); + + // Activate page data bypass from input inIdx to output outIdx. + // Note that the module must still be able to calculate the output image. + // setBypass(outIndex, inIndex); + + // Activate parallel execution of calcOutSubImage. + // setThreadSupport(supportMode); + // with supportMode = + // NO_THREAD_SUPPORT //! The module is not thread safe at all. + // CALC_OUTSUBIMAGE_ON_STD_TYPES //! calcOutSubImage can be called in parallel for scalar voxel types. + // CALC_OUTSUBIMAGE_ON_CARRIER_TYPES //! calcOutSubImage can be called in parallel for carrier voxel types. + // CALC_OUTSUBIMAGE_ON_ALL_TYPES //! calcOutSubImage can be called in parallel for all voxel types. + // Warning: You should be familiar with multithreading before activating this feature. + + // Specify whether the module can only process standard scalar voxel types or + // also registered voxel types (vec2, mat2, complexf, Vector, etc.) + // setVoxelDataTypeSupport(permittedTypes); + // with permittedTypes = + // ONLY_STANDARD_TYPES //! Only standard scalar voxels are supported. + // FULLY_OPERATIONAL //! Scalar and registered voxels types are supported. + // MINIMUM_OPERATIONAL //! Scalar and registered voxel types are supported. + // //! Voxel operators are not used by algorithm. + // + // See ML Programming Guide, "Configuring Image Processing Behaviour of the BaseOp" + // for further details. +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void SegmentationEvaluationMetric::handleNotification (Field *field) +{ + ML_TRACE_IN("SegmentationEvaluationMetric::handleNotification ()"); + + if (getUpdatedInImg(0) && getUpdatedInImg(1) && (_isAutoApplyFld->isOn() || (field == _applyFld))) { + _process(); + } +} + +//---------------------------------------------------------------------------------- +//! Update internal module state after load or clone and enable notification handling again. +//---------------------------------------------------------------------------------- +void SegmentationEvaluationMetric::activateAttachments () +{ + ML_TRACE_IN("SegmentationEvaluationMetric::activateAttachments ()"); + + // Update members to new field state here. + // Call super class functionality to enable notification handling again. + BaseOp::activateAttachments (); +} + +//---------------------------------------------------------------------------------- +//! Calls correctly typed (template) version of \c calcOutSubImage to calculate page +//! \c outSubImg of output image with index \c outSubImg. +//---------------------------------------------------------------------------------- +CALC_OUTSUBIMAGE2_CPP(SegmentationEvaluationMetric); + +//---------------------------------------------------------------------------------- +//! Template for type specific page calculation. Called by +//! CALC_OUTSUBIMAGE2_CPP(SegmentationEvaluationMetric). +//---------------------------------------------------------------------------------- +template <typename T> +void SegmentationEvaluationMetric::calcOutSubImage (TSubImg<T> *outSubImg, int outIndex, + TSubImg<T> *inSubImg1, + TSubImg<T> *inSubImg2) +{ + ML_TRACE_IN("template <typename T> SegmentationEvaluationMetric::calcOutSubImage ()") + + outSubImg; + int segThreshold = _segmentationThresholdFld->getIntValue(); + int refThreshold = _referenceThresholdFld->getIntValue(); + + // called by processAllPages for the virtual output image with the index -1 + if (outIndex == -1) { + // Clamp page box to valid image regions since pages can reach outside the image. + SubImgBox box = SubImgBox::intersect(inSubImg1->getBox(), getInImg(0)->getBoxFromImgExt()); + + // Scan all voxels in both input subimages which have identical + // extents (as specified in calcInSubImageProps). + Vector p = box.v1; + for (p.u = box.v1.u; p.u <= box.v2.u; p.u++) + { + for (p.t = box.v1.t; p.t <= box.v2.t; p.t++) + { + for (p.c = box.v1.c; p.c <= box.v2.c; p.c++) + { + for (p.z = box.v1.z; p.z <= box.v2.z; p.z++) + { + for (p.y = box.v1.y; p.y <= box.v2.y; p.y++) + { + + // Calculate first voxel position in x row. + p.x = box.v1.x; + + // Get pointers to first voxels in x-rows of all input subimages. + T* i1P = inSubImg1->getImgPos(p); + T* i2P = inSubImg2->getImgPos(p); + + // Iterate over all voxels in input lines. + for (; p.x <= box.v2.x; p.x++) + { + T val1 = (*i1P); // segmentation + T val2 = (*i2P); // reference (ground truth) segmentation + + // true positive + if ( (val1 > segThreshold) && (val2 > refThreshold) ) { + _numTruePositive++; + } + // true negative + if ( (val1 <= segThreshold) && (val2 <= refThreshold) ) { + _numTrueNegative++; + } + // false positive + if ( (val1 > segThreshold) && (val2 <= refThreshold) ) { + _numFalsePositive++; + } + // false negative + if ( (val1 <= segThreshold) && (val2 > refThreshold) ) { + _numFalseNegative++; + } + // Move pointers forward in all input images. + ++i1P; + ++i2P; + } + } + } + } + } + } + } +} + + +//---------------------------------------------------------------------------------- +//! Main routine. +//---------------------------------------------------------------------------------- +void SegmentationEvaluationMetric::_process() +{ + ML_TRACE_IN("SegmentationEvaluationMetric::_process ()"); + + _numTruePositive = 0; + _numTrueNegative = 0; + _numFalsePositive = 0; + _numFalseNegative = 0; + double sensitivity = 0.0; + double specificity = 0.0; + unsigned int numVoxels = 0; + double prevalence = 0.0; + double levelOfTest = 0.0; + double dsc = 0.0; + double cFactor = 0.0; + + + + + // process all pages + MLErrorCode err = processAllPages(-1,0); + + if (err==ML_RESULT_OK) { + + // sensitivity + if ( (_numTruePositive + _numFalseNegative) > 0) { + sensitivity = _numTruePositive / (double)(_numTruePositive+_numFalseNegative); + } + + // specificity + if ( (_numTrueNegative + _numFalsePositive) > 0) { + specificity = _numTrueNegative / (double) (_numTrueNegative+_numFalsePositive); + } + + // total number of voxels + numVoxels = _numTruePositive + _numFalsePositive + _numFalseNegative + _numTrueNegative; + + // prevalence + if (numVoxels > 0) { + prevalence = (_numTruePositive + _numFalseNegative) / (double)numVoxels; + } + + // level of test + if (numVoxels > 0) { + levelOfTest = (_numTruePositive + _numFalsePositive) / (double)numVoxels; + } + + // Dice similarity coefficient + if ( 2*_numTruePositive + _numFalsePositive + _numFalseNegative > 0) { + dsc = 2.0 * _numTruePositive / (double)(2.0*_numTruePositive + _numFalsePositive + _numFalseNegative); + } + + // C-Factor + double p = sensitivity; + double q = specificity; + double d = (2.0 * p * (1 - q)) / (p + (1-q)) + (2 * (1-p) * q) / ((1-p) + p); + + if ( (p >= q) && (p > 1-q) ) { + cFactor = d; + } + else if ( (p < q) && (p > 1-q) ) { + cFactor = -d; + } + else if ( (p <= 1-q) ) { + // undefined + } + } + else { + // Set error status. + std::cerr << MLGetErrorCodeDescription(err); + } + + // set output + _truePositiveFld->setIntValue(_numTruePositive); + _trueNegativeFld->setIntValue(_numTrueNegative); + _falsePositiveFld->setIntValue(_numFalsePositive); + _falseNegativeFld->setIntValue(_numFalseNegative); + _sensitivityFld->setDoubleValue(sensitivity); + _specificityFld->setDoubleValue(specificity); + _prevalenceFld->setDoubleValue(prevalence); + _levelOfTestFld->setDoubleValue(levelOfTest); + _diceSimilarityCoefficientFld->setDoubleValue(dsc); + _cFactorFld->setDoubleValue(cFactor); +} + +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.h =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.h (rev 0) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/mlSegmentationEvaluationMetric.h 2009-07-22 16:47:31 UTC (rev 177) @@ -0,0 +1,124 @@ +//---------------------------------------------------------------------------------- +//! The ML module class SegmentationEvaluationMetric. +/*! +// \file mlSegmentationEvaluationMetric.h +// \author Stefan Saur +// \date 2009-07-21 +// +// Validatation metric for accuracy assessment in medical image segmentation as described in +// +// "Statistical validation metric for accuracy assessment in medical image segmentation" +// Aleksandra Popovic, Matias de la Fuente, Martin Engelhardt, Klaus Radermacher +// Int J CARS, 2007(2):169-181 +// DOI 10.1007/s11548-007-0125-1 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlSegmentationEvaluationMetric_H +#define __mlSegmentationEvaluationMetric_H + + +// Local includes +#include "CVLSegmentationEvaluationMetricSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +ML_START_NAMESPACE + + +//! +class CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT SegmentationEvaluationMetric : public BaseOp +{ +public: + + //! Constructor. + SegmentationEvaluationMetric (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + + //! Update internal module state after load or clone and enable notification handling again. + virtual void activateAttachments (); + + //! Calculates page \c outSubImg of output image with index \c outIndex by using \c inSubimgs. + //! \param outSubImg The subimage of output image \c outIndex calculated from \c inSubImgs. + //! \param outIndex The index of the output the subimage is calculated for. + //! \param inSubImgs Array of subimage(s) of the input(s) whose extents were specified + //! by \c calcInSubImageBox. Array size is given by \c getInputNum(). + virtual void calcOutSubImage (SubImg *outSubImg, int outIndex, SubImg *inSubImgs); + + //! Method template for type-specific page calculation. Called by \c calcOutSubImage(). + //! \param outSubImg The typed subimage of output image \c outIndex calculated from \c inSubImg?. + //! \param outIndex The index of the output the subimage is calculated for. + //! \param inSubImg1 Temporary subimage of input 1. + //! \param inSubImg2 Temporary subimage of input 2. + template <typename T> + void calcOutSubImage (TSubImg<T> *outSubImg, int outIndex, + TSubImg<T> *inSubImg1, + TSubImg<T> *inSubImg2); + + +private: + + //! Main routine. + void _process(); + + //! Number of true positives. + unsigned int _numTruePositive; + //! Number of true negatives. + unsigned int _numTrueNegative; + //! Number of false positives. + unsigned int _numFalsePositive; + //! Number of false negatives. + unsigned int _numFalseNegative; + + + // ---------------------------------------------------------- + //! \name Module field declarations + //@{ + // ---------------------------------------------------------- + + //! Threshold for segmentation image. + IntField *_segmentationThresholdFld; + //! Threshold for reference image. + IntField *_referenceThresholdFld; + //! True positive. + IntField *_truePositiveFld; + //! True negative. + IntField *_trueNegativeFld; + //! False positive. + IntField *_falsePositiveFld; + //! False negative. + IntField *_falseNegativeFld; + //! Sensitivity. + DoubleField *_sensitivityFld; + //! Specificity. + DoubleField *_specificityFld; + //! Prevalence. + DoubleField *_prevalenceFld; + //! Level of Test. + DoubleField *_levelOfTestFld; + //! Dice Similarity Coefficient + DoubleField *_diceSimilarityCoefficientFld; + //! c-Factor. + DoubleField *_cFactorFld; + + //! Apply. + NotifyField *_applyFld; + //! is auto apply. + BoolField *_isAutoApplyFld; + + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(SegmentationEvaluationMetric) +}; + + +ML_END_NAMESPACE + +#endif // __mlSegmentationEvaluationMetric_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ss...@us...> - 2009-07-26 07:59:19
|
Revision: 178 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=178&view=rev Author: ssaur Date: 2009-07-26 07:59:11 +0000 (Sun, 26 Jul 2009) Log Message: ----------- added module AscendingAortaDetection Added Paths: ----------- trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/ trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.def trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/html/ trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/html/AscendingAortaDetection.html trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.bat trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.pro trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.sh trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.cpp trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.h trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.cpp trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.h Added: trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.def =================================================================== --- trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.def (rev 0) +++ trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.def 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,96 @@ +//---------------------------------------------------------------------------------- +//! CVLAscendingAortaDetection module definitions. +/*! +// \file CVLAscendingAortaDetection.def +// \author Stefan Saur +// \date 2007-03-24 +// +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule AscendingAortaDetection +//---------------------------------------------------------------------------------- +MLModule AscendingAortaDetection { + DLL = "CVLAscendingAortaDetection" + + genre = "" + author = "Stefan Saur" + status = "stable" + comment = "Automatic detection of the ascending aorta in computed tomography coronary angiography data sets." + keywords = "" + seeAlso = "" + documentation = "$(LOCAL)/html/AscendingAortaDetection.html" + + Window { + Category "Main" { + + Box "Input" { + Field primaryThreshold {} + Field secondaryThreshold {} + Field minDiameter {} + Field maxDiameter {} + Field distanceCluster {} + Field increment {} + Field ratioLimit {} + Field useRatioLimit {} + Field startSearchArea {} + Field endSearchArea {} + } // Box "input" + + Box "Output" { + Field seedPoint { edit = NO } + Field runTime { edit = NO } + } // Box "output" + + Horizontal { + Field autoApply {} + Button apply {} + } + + + } // Category "Main" + + Category "LargestCluster" { + Field priClusterSize { title = "ClusterSize" edit = NO } + Field priMeanIntensity { title = "MeanIntensity" edit = NO } + Field priStdIntensity { title = "StdIntensity" edit = NO } + Field priBaryCenter { title = "BaryCenter" edit = NO } + Field priLowerCenter { title = "LowerCenter" edit = NO } + Field priUpperCenter { title = "UpperCenter" edit = NO } + Field priRadiusBC { title = "RadiusBaryCenter" edit = NO } + Field priBBLower { title = "BbLower" edit = NO } + Field priBBUpper { title = "BbUpper" edit = NO } + Field extensionLargestCluster { title = "Extension" edit = NO } + Field meanRadiusLargestCluster { title = "MeanRadisu" edit = NO } + Field stdRadiusLargestCluster { title = "StdRadius" edit = NO } + } // Category "LargestCluster" + + Category "SecondLargestCluster" { + Field secClusterSize { title = "ClusterSize" edit = NO } + Field secMeanIntensity { title = "MeanIntensity" edit = NO } + Field secStdIntensity { title = "StdIntensity" edit = NO } + Field secBaryCenter { title = "BaryCenter" edit = NO } + Field secLowerCenter { title = "LowerCenter" edit = NO } + Field secUpperCenter { title = "UpperCenter" edit = NO } + Field secRadiusBC { title = "RadiusBaryCenter" edit = NO } + Field secBBLower { title = "BbLower" edit = NO } + Field secBBUpper { title = "BbUpper" edit = NO } + Field extensionSecondLargestCluster { title = "Extension" edit = NO } + Field meanRadiusSecondLargestCluster { title = "MeanRadius" edit = NO } + Field stdRadiusSecondLargestCluster { title = "StdRadius" edit = NO } + } // Category "SecondLargestCluster" + + Category "Info" { + Vertical { expandY = yes + TextView info { + autoApply = yes + mw = 400 + mh = 300 + } // TextView + } // Vertical + } // Category "Info" + } // Window + +} // MLModule AscendingAortaDetection \ No newline at end of file Added: trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/html/AscendingAortaDetection.html =================================================================== --- trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/html/AscendingAortaDetection.html (rev 0) +++ trunk/Community/General/Modules/ML/CVLAscendingAortaDetection/html/AscendingAortaDetection.html 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,195 @@ +<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + + + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + + <meta name="Description" content="Template for an ILAB module"> + + + <title>AscendingAortaDetection</title> +<!--===============================================================--><!-- CommandBox --><!--===============================================================--> +</head> + + +<body> + +<center><a href="#Purpose">Purpose</a> +<a href="#Usage">Usage</a> +<a href="#Inputs">Inputs</a> +<a href="#Outputs">Outputs</a> +<a href="#Parameters">Parameters</a> +<a href="#EventInteract">Events&Interaction</a> +<a href="#Example">Example</a> +<a href="#Tips&Tricks">Tips&Tricks</a> +<a href="#KnownBugs">Known Bugs</a> +<hr width="100%"></center> + +<h2> +AscendingAortaDetection</h2> + +<h3> +<a name="Purpose"></a>Purpose</h3> + +<blockquote> + <p> +The <b>AscendingAorataDetection</b> module allows to detect the ascending aorta within a computed tomography coronary angiography (CTCA) data set. With some parameter changes, it is also possible to detect the descending aorta. The module is based on the publication<br/> +<br/> +<i>Automatic Ascending Aorta Detection in CTA Datasets</i><br/> +Stefan C. Saur and Caroline K\xFChnel and Tobias Boskamp and G\xE1bor Sz\xE9kely and Philippe Cattin<br/> +Bildverarbeitung f\xFCr die Medizin 2008<br/> +<a href="ftp://ftp.vision.ee.ethz.ch/publications/proceedings/eth_biwi_00536.pdf">Download paper in pdf format</a> + + </p> + +</blockquote> + +<h3> +<a name="Usage"></a>Usage</h3> + +<blockquote> +<p> + Just connect the input image, adapt the parameters (per default, they are set to detect the ascending aorta) and press the <b>Apply</b> button to start the detection. As output, the world coordinates of a seed point within the ascending aorta is given. Further, all candidate points are given at the output <b>outXMarkerList</b>. The candidate points from largest cluster representing the ascending aorta are given at the output <b>outXMarkerListLargestCluster</b> whereas the candidates from the second largest cluster are given at <b>outXMarkerListSecondLargestCluster</b>. +</p> +</blockquote> + +<h3> +<a name="Inputs"></a>Inputs</h3> + +<blockquote> +The module has one input image which will be internally casted to MLuint16type. +</blockquote> + +<h3> +<a name="Outputs"></a>Outputs</h3> + +<blockquote> +The module has three XMarkerLists as output\ +<ul> + <li><b>outXMarkerList</b>: all candidate points as determined by the algorithm. Points from different clusters have a different XMarker <i>type</i> property.</li> + <li><b>outXMarkerListLargestCluster</b>: all candidate points from the largest cluster.</li> + <li><b>outXMarkerListSecondLargestCluster</b>: all candidate points from the second largest cluster.</li> +</ul> +</blockquote> + +<h3> +<a name="Parameters"></a>Parameters</h3> + +<blockquote> + + <h4><b>Main</b></h4> + + + <ul> + <li><span style="font-weight: bold;">Primary Threshold</span>: primary threshold th_p in gray values.</li> + <li><span style="font-weight: bold;">Secondary Threshold</span>: secondary threshold th_s in gray values.</li> + <li><span style="font-weight: bold;">Min Diameter</span>: minimum diameter d_min in mm.</li> + <li><span style="font-weight: bold;">Max Diameter</span>: maximum diameter d_max in mm.</li> + <li><span style="font-weight: bold;">Distance Cluster</span>: distance limit for clustering d_clust.</li> + <li><span style="font-weight: bold;">Increment</span>: increment of search ray delta_x, delta_y, delta_z.</li> + <li><span style="font-weight: bold;">Radio Limit</span>: ratio a.</li> + <li><span style="font-weight: bold;">Use Ratio Limit</span>: if checked, ratio criterion is applied in the detection process.</li> + <li><span style="font-weight: bold;">Start Search Area</span>: start of search range VOI_x, VOI_y, VOI_z.</li> + <li><span style="font-weight: bold;">End Search Area</span>: end of search range VOI_x, VOI_y, VOI_z.</li> + <li><span style="font-weight: bold;">Seed Point</span>: seed point within the ascending aorta.</li> + <li><span style="font-weight: bold;">Run Time</span>: run time of the algorithm in seconds.</li> + <li><span style="font-weight: bold;">Auto Apply</span>: if checked, the algorithm is triggered upon connection of an input image.</li> + <li><span style="font-weight: bold;">Apply</span>: manually run algorithm.</li> + + <li><span style="font-weight: bold;">CommandList</span>: List of fields that should be touched. One field per line in the form <i>moduleName.fieldName</i>.</li> + + + <li><span style="font-weight: bold;">Apply</span>: Touch all fields one after the other as listed in <b>CommandList</b>.</li> + + </ul> + +</blockquote> + +<blockquote> + +<h4>LargestCluster</h4> + Statistical information about the detected largest cluster. + <ul> + <li><span style="font-weight: bold;">ClusterSize</span>: size of cluster i.e. number of candidate points.</li> + <li><span style="font-weight: bold;">MeanIntensity</span>: mean intensity within bounding box.</li> + <li><span style="font-weight: bold;">StdIntensity</span>: std intensity within bounding box.</li> + <li><span style="font-weight: bold;">BaryCenter</span>: barycenter of cluster.</li> + <li><span style="font-weight: bold;">LowerCenter</span>: center point at lower extend (z smallest) of cluster.</li> + <li><span style="font-weight: bold;">UpperCenter</span>: center point at upper extend (z largest) of cluster.</li> + <li><span style="font-weight: bold;">RadiusBaryCenter</span>: radius at bary center of cluster.</li> + <li><span style="font-weight: bold;">BbLower</span>: bounding box for cluster (see source code on how it is defined).</li> + <li><span style="font-weight: bold;">BbUpper</span>: bounding box for cluster (see source code on how it is defined).</li> + <li><span style="font-weight: bold;">Extension</span>: exentsion in z direction in mm.</li> + <li><span style="font-weight: bold;">MeanRadius</span>: mean radius in mm of candidates points within cluster.</li> + <li><span style="font-weight: bold;">StdRadius</span>: std of radius in mm of candidates points within cluster.</li> + </ul> +</blockquote> + +<blockquote> + +<h4>SecondLargestCluster</h4> + Statistical information about the detected second largest cluster (equivalent to the information for the largest cluster). + <ul> + <li><span style="font-weight: bold;">ClusterSize</span>: size of cluster i.e. number of candidate points.</li> + <li><span style="font-weight: bold;">MeanIntensity</span>: mean intensity within bounding box.</li> + <li><span style="font-weight: bold;">StdIntensity</span>: std intensity within bounding box.</li> + <li><span style="font-weight: bold;">BaryCenter</span>: barycenter of cluster.</li> + <li><span style="font-weight: bold;">LowerCenter</span>: center point at lower extend (z smallest) of cluster.</li> + <li><span style="font-weight: bold;">UpperCenter</span>: center point at upper extend (z largest) of cluster.</li> + <li><span style="font-weight: bold;">RadiusBaryCenter</span>: radius at bary center of cluster.</li> + <li><span style="font-weight: bold;">BbLower</span>: bounding box for cluster (see source code on how it is defined).</li> + <li><span style="font-weight: bold;">BbUpper</span>: bounding box for cluster (see source code on how it is defined).</li> + <li><span style="font-weight: bold;">Extension</span>: exentsion in z direction in mm.</li> + <li><span style="font-weight: bold;">MeanRadius</span>: mean radius in mm of candidates points within cluster.</li> + <li><span style="font-weight: bold;">StdRadius</span>: std of radius in mm of candidates points within cluster.</li> + </ul> +</blockquote> + +<blockquote> +<h4>Info</h4> + <ul> + <li><span style="font-weight: bold;">Info</span>: Textfield providing additional output information from the algorithm.</li> + </ul> +</blockquote> + + + + + + <h3> + </h3> + + + <h3> + <a name="EventInteract"></a>Events & Interaction</h3> + + + <blockquote>None.</blockquote> + + + <h3> + <a name="Example"></a>Example</h3> + + + <blockquote>None.</blockquote> + + + <h3> + <a name="Tips&Tricks"></a>Tips & Tricks</h3> + + + <blockquote>None.</blockquote> + + + <h3> + <a name="KnownBugs"></a>Known Bugs</h3> + + + <blockquote>None.</blockquote> + +</blockquote> + +</body> +</html> Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.bat =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.bat (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.bat 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" CVLAscendingAortaDetection Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.pro =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.pro (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.pro 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,40 @@ +# --------- CVLAscendingAortaDetection profile ------------------- +# +# Platform independent project and build file for +# project CVLAscendingAortaDetection. +# + +TARGET = CVLAscendingAortaDetection + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# add dependencies of this project here + +CONFIG += dll ML MLTools MLBase + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + + +MLAB_PACKAGES += MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += CVLASCENDINGAORTADETECTION_EXPORTS + +HEADERS += \ + CVLAscendingAortaDetectionInit.h \ + CVLAscendingAortaDetectionSystem.h \ + mlAscendingAortaDetection.h + +SOURCES += \ + CVLAscendingAortaDetectionInit.cpp \ + mlAscendingAortaDetection.cpp + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.def + + Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.sh =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.sh (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetection.sh 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,2 @@ +#!/bin/bash +python $MLAB_ROOT/MeVis/Foundation/BuildTools/Scripts/createProject.py CVLAscendingAortaDetection \ No newline at end of file Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.cpp 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file CVLAscendingAortaDetectionInit.cpp +// \author Stefan Saur +// \date 2007-03-24 +// +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#ifndef __CVLAscendingAortaDetectionSystem_H +#include "CVLAscendingAortaDetectionSystem.h" +#endif + +// Include definition of ML_INIT_LIBRARY. +#ifndef __mlLibraryInitMacros_H +#include "mlLibraryInitMacros.h" +#endif + +// Include all module headers ... +#ifndef __mlAscendingAortaDetection_H +#include "mlAscendingAortaDetection.h" +#endif + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int CVLAscendingAortaDetectionInit (void) +{ + ML_TRACE_IN("CVLAscendingAortaDetectionInit ()") + + AscendingAortaDetection::initClass(); + // Add initClass calls from all other modules here... + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(CVLAscendingAortaDetectionInit) + Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.h =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.h (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionInit.h 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,26 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file CVLAscendingAortaDetectionInit.h +// \author Stefan Saur +// \date 2007-03-24 +// +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __CVLAscendingAortaDetectionInit_H +#define __CVLAscendingAortaDetectionInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int CVLAscendingAortaDetectionInit (void); + +ML_END_NAMESPACE + +#endif // __CVLAscendingAortaDetectionInit_H + + Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,34 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file CVLAscendingAortaDetectionSystem.h +// \author Stefan Saur +// \date 2007-03-24 +// +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __CVLAscendingAortaDetectionSystem_H +#define __CVLAscendingAortaDetectionSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef CVLASCENDINGAORTADETECTION_EXPORTS +// Use the CVLASCENDINGAORTADETECTION_EXPORT macro to export classes and functions +#define CVLASCENDINGAORTADETECTION_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define CVLASCENDINGAORTADETECTION_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define CVLASCENDINGAORTADETECTION_EXPORT +#endif + + +#endif // __CVLAscendingAortaDetectionSystem_H + + Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.cpp =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.cpp (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.cpp 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,875 @@ +//---------------------------------------------------------------------------------- +//! The ML module class AscendingAortaDetection. +/*! +// \file mlAscendingAortaDetection.h +// \author Stefan Saur +// \date 2007-03-24 +// +// as published and described in +// "Automatic Ascending Aorta Detection in CTA Datasets" +// ftp://ftp.vision.ee.ethz.ch/publications/proceedings/eth_biwi_00536.pdf +// +// @InProceedings{eth_biwi_00536, +// author = {Stefan C. Saur and Caroline K\"uhnel and Tobias Boskamp and G\xE1bor Sz\xE9kely and Philippe Cattin}, +// title = {Automatic Ascending Aorta Detection in CTA Datasets}, +// booktitle = {Bildverarbeitung f\xFCr der Medizin 2008}, +// year = {2008}, +// month = {April}, +// pages = {323-327}} +// +// This code was created by support of the research project Co-Me (http://co-me.ch) +// at the Computer Vision Laboratory of ETH Zurich (http://www.vision.ee.ethz.ch) +// +// YOU MUST CITE THIS PAPER WHEN USING THE ALGORITHM IN YOUR PUBLICATION +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#ifndef __mlAscendingAortaDetection_H +#include "mlAscendingAortaDetection.h" +#endif + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(AscendingAortaDetection, BaseOp); + + +bool sortClusterPoints(XMarker elem1, XMarker elem2) +{ + return (elem1.z() < elem2.z()); +} + + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +AscendingAortaDetection::AscendingAortaDetection (void) + : BaseOp(1, 0) // in, out +{ + ML_TRACE_IN("AscendingAortaDetection::AscendingAortaDetection()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // input parameters + // primary threshold th_p in gray values + (_primaryThresholdFld = fields->addInt("primaryThreshold"))->setIntValue(1204); + // secondary threshold th_s in gray values + (_secondaryThresholdFld = fields->addInt("secondaryThreshold"))->setIntValue(1124); + // minimum diameter d_min in mm + (_minDiameterFld = fields->addInt("minDiameter"))->setIntValue(20); + // maximum diameter d_max in mm + (_maxDiameterFld = fields->addInt("maxDiameter"))->setIntValue(70); + // increment of search ray delta_x, delta_y, delta_z + (_incrementFld = fields->addVec3f("increment"))->setVec3fValue(vec3(1.0, 5.0, 1.0)); + // search range VOI_x, VOI_y, VOI_z + (_startSearchAreaFld = fields->addVec3f("startSearchArea"))->setVec3fValue(vec3(0.0, 0.25, 0.5)); + (_endSearchAreaFld = fields->addVec3f("endSearchArea"))->setVec3fValue(vec3(0.75, 0.70, 1.0)); + // ratio a + (_ratioLimitFld = fields->addDouble("ratioLimit"))->setDoubleValue(0.25); + (_useRatioLimitFld = fields->addBool("useRatioLimit"))->setBoolValue(true); + // distance limit for clustering d_clust + (_distanceClusterFld = fields->addVec3f("distanceCluster"))->setVec3fValue(vec3(5.0, 5.0, 5.0)); + + // apply + (_applyFld = fields->addNotify("apply")); + (_autoApplyFld = fields->addBool("autoApply"))->setBoolValue(false); + + // output + (_outXMarkerListFld = fields->addBase("outXMarkerList"))->setBaseValue(&_outXMarkerList); + (_outXMarkerListLargestClusterFld = fields->addBase("outXMarkerListLargestCluster"))->setBaseValue(&_outLargestCluster); + (_outXMarkerListSecondLargestClusterFld = fields->addBase("outXMarkerListSecondLargestCluster"))->setBaseValue(&_outSecondLargestCluster); + + // seedpoint for subsequent aorta segmentation as described in paper + (_seedPointFld = fields->addVec3f("seedPoint"))->setVec3fValue(vec3(0, 0, 0)); + + // primary / largest cluster + // size of cluster i.e. number of candidate points + (_priClusterSizeFld = fields->addInt("priClusterSize"))->setIntValue(0); + // mean intensity within bounding box + (_priMeanIntensityFld = fields->addDouble("priMeanIntensity"))->setDoubleValue(0.0); + // mean intensity within bounding box + (_priStdIntensityFld = fields->addDouble("priStdIntensity"))->setDoubleValue(0.0); + // barycenter of cluster + (_priBaryCenterFld = fields->addVec3f("priBaryCenter"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + // center point at lower extend (z smallest) of cluster + (_priLowerCenterFld = fields->addVec3f("priLowerCenter"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + // center point at upper extend (z largest) of cluster + (_priUpperCenterFld = fields->addVec3f("priUpperCenter"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + // radius at bary center of cluster + (_priRadiusBCFld = fields->addVec2f("priRadiusBC"))->setVec2fValue(vec2(0.0, 0.0)); + // bounding box for cluster (see computation on how it is defined) + (_priBBLowerFld = fields->addVec3f("priBBLower"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + (_priBBUpperFld = fields->addVec3f("priBBUpper"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + // exentsion in z direction in mm + (_extensionLargestClusterFld = fields->addDouble("extensionLargestCluster"))->setDoubleValue(0.0); + // mean radius in mm of candidates points within largest cluster + (_meanRadiusLargestClusterFld = fields->addDouble("meanRadiusLargestCluster"))->setDoubleValue(0.0); + // std of radius in mm of candidates points within largest cluster + (_stdRadiusLargestClusterFld = fields->addDouble("stdRadiusLargestCluster"))->setDoubleValue(0.0); + + + // secondary / second largest cluster + // description equivalent to largest cluster + (_secClusterSizeFld = fields->addInt("secClusterSize"))->setIntValue(0); + (_secMeanIntensityFld = fields->addDouble("secMeanIntensity"))->setDoubleValue(0.0); + (_secStdIntensityFld = fields->addDouble("secStdIntensity"))->setDoubleValue(0.0); + (_secBaryCenterFld = fields->addVec3f("secBaryCenter"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + (_secLowerCenterFld = fields->addVec3f("secLowerCenter"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + (_secUpperCenterFld = fields->addVec3f("secUpperCenter"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + (_secRadiusBCFld = fields->addVec2f("secRadiusBC"))->setVec2fValue(vec2(0.0, 0.0)); + (_secBBLowerFld = fields->addVec3f("secBBLower"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + (_secBBUpperFld = fields->addVec3f("secBBUpper"))->setVec3fValue(vec3(0.0, 0.0, 0.0)); + (_extensionSecondLargestClusterFld = fields->addDouble("extensionSecondLargestCluster"))->setDoubleValue(0.0); + (_meanRadiusSecondLargestClusterFld = fields->addDouble("meanRadiusSecondLargestCluster"))->setDoubleValue(0.0); + (_stdRadiusSecondLargestClusterFld = fields->addDouble("stdRadiusSecondLargestCluster"))->setDoubleValue(0.0); + + // info + (_infoFld = fields->addString("info"))->setStringValue(""); + + // statistic + (_runTimeFld = fields->addDouble("runTime"))->setDoubleValue(0.0); + + _applyFld->attachField(_outXMarkerListFld); + _applyFld->attachField(_outXMarkerListLargestClusterFld); + _applyFld->attachField(_outXMarkerListSecondLargestClusterFld); + + _virtInVol = NULL; + _outXMarkerList.clear(); + _outLargestCluster.clear(); + _outSecondLargestCluster.clear(); + + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Destructor +//---------------------------------------------------------------------------------- +AscendingAortaDetection::~AscendingAortaDetection(void) +{ + ML_TRACE_IN("AscendingAortaDetection::~AscendingAortaDetection()") + ML_DELETE(_virtInVol); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void AscendingAortaDetection::handleNotification (Field *field) +{ + ML_TRACE_IN("AscendingAortaDetection::handleNotification()") + + if ( (field == _applyFld) && (getUpdatedInImg(0)) ) { + _process(); + } + if ((field == getInField(0)) && getUpdatedInImg(0) && _autoApplyFld->getBoolValue() ) { + _process(); + } +} + + +//---------------------------------------------------------------------------------- +//! Main routine for the detection of the ascending aorta. +//---------------------------------------------------------------------------------- +void AscendingAortaDetection::_process() +{ + ML_TRACE_IN("AscendingAortaDetection::_process()") + _ss.str(""); + + // ++++++++++++++ TIME MEASUREMENT START ++++++++++++++ // + TimeCounter timeWhole; + + // any problems creating the virtual volume from the input volume? + if (!_initVirtualVolumes()) { + return; + } + + + // now we can process + int i, j; // loop variables + + // virtual volume is casted to MLuint16 + TVirtualVolume<MLuint16> vInVol(*_virtInVol); + + _outXMarkerList.clear(); + + Vector imgExt = getInImg(0)->getImgExt(); + vec3 voxSize = getInImg(0)->getVoxelSize(); + + vec3 startArea = _startSearchAreaFld->getVec3fValue(); // parameter where to start looking for aorta + vec3 endArea = _endSearchAreaFld->getVec3fValue(); // parameter where to stop looking for aorta + + TimeCounter timeCandidates; + + // read thresholds + unsigned primeThreshold = _primaryThresholdFld->getIntValue(); + unsigned secondThreshold = _secondaryThresholdFld->getIntValue(); + + + // determine search line distance + vec3 increment = _incrementFld->getVec3fValue(); + // convert mm to voxcel unit + int incX = increment[0] / voxSize[0]; + int incY = increment[1] / voxSize[1]; + int incZ = increment[2] / voxSize[2]; + + // minimum step size is 1 + if (incX < 1) { + incX = 1; + } + + if (incY < 1) { + incY = 1; + } + + if (incZ < 1) { + incZ = 1; + } + + _ss << "search ray increment " << incX << " | " << incY << " | " << incZ << " voxels" << std::endl; + + // search range in z direction + for (int z = imgExt[2]*startArea[2]; z < imgExt[2]*endArea[2]; z+=incZ) + { + // search range in y direction + for (int y = imgExt[1]*startArea[1]; y < imgExt[1]*endArea[1]; y+=incY) + { + int startX = 0; + int stopX = 0; + bool isPrimaryThreshold = false; + + // search range in x direction + for (int x = imgExt[0]*startArea[0]; x < imgExt[0]*endArea[0]; x+=incX) + { + int value = vInVol.getVoxel(Vector(x, y, z, 0, 0, 0)); + + // primary threshold is obtained for the first time for a object + if ( (!isPrimaryThreshold) && (value > _primaryThresholdFld->getIntValue()) ) { + isPrimaryThreshold = true; + startX = x; + stopX = x; + } + // candidate mode, primary threshold was triggered, looking for transition to secondary threshold + else if ( (isPrimaryThreshold) && (value > _primaryThresholdFld->getIntValue()) ) { + stopX = x; + } + // transition under secondary threshold + else if ( (isPrimaryThreshold) && (value < _secondaryThresholdFld->getIntValue()) ) { + double diameterX = (stopX - startX) * voxSize[0]; + // check if diameter is within allowed range for aorta + if ( (diameterX > _minDiameterFld->getIntValue()) && (diameterX < _maxDiameterFld->getIntValue()) ) { + int centerX = (stopX+startX)/2; + + // now look in y direction for this point + int startY = y; + int stopY = y; + int loopY = y; // just a loop variable + + int value = vInVol.getVoxel(Vector(centerX, loopY, z, 0, 0, 0)); + // first look for transition to the front + while ( (loopY>0) && (value > _secondaryThresholdFld->getIntValue()) ) + { + if (value > _primaryThresholdFld->getIntValue()) { + startY--; + } + loopY--; + value = vInVol.getVoxel(Vector(centerX, loopY, z, 0, 0, 0)); + } + + // now look for transition to the back + loopY = y; + value = vInVol.getVoxel(Vector(centerX, loopY, z, 0, 0, 0)); + while ( (loopY<imgExt[1]-1) && (value > _secondaryThresholdFld->getIntValue()) ) + { + if (value > _primaryThresholdFld->getIntValue()) { + stopY++; + } + loopY++; + value = vInVol.getVoxel(Vector(centerX, loopY, z, 0, 0, 0)); + } + + double diameterY = (stopY - startY) * voxSize[1]; + + // check if diameter is within allowed range for aorta + if ( (diameterY > _minDiameterFld->getIntValue()) && (diameterY < _maxDiameterFld->getIntValue()) ) + { + bool isRatioLimitOk = true; + + // should ratio limit be considered + if (_useRatioLimitFld->isOn()) { + isRatioLimitOk = (fabs(diameterY / diameterX - 1.0) < _ratioLimitFld->getDoubleValue() ); + } + + if (isRatioLimitOk) { + int centerY = (stopY+startY)/2; + vec3 voxPos = vec3(centerX, centerY, z); + + double diameterDiag1 = _singleRayBothDirections(voxPos, vec3(1, -1, 0), imgExt, primeThreshold, secondThreshold, voxSize); + double diameterDiag2 = _singleRayBothDirections(voxPos, vec3(1, 1, 0), imgExt, primeThreshold, secondThreshold, voxSize); + + if ( (diameterDiag1 > _minDiameterFld->getIntValue()) && (diameterDiag1 < _maxDiameterFld->getIntValue()) + && (diameterDiag2 > _minDiameterFld->getIntValue()) && (diameterDiag2 < _maxDiameterFld->getIntValue())) { + vec3 worldPos; + getInImg(0)->transformToWorldCoord(voxPos, worldPos); + XMarker tmpMarker = XMarker(worldPos); + tmpMarker.vec[0] = diameterX / 2.0; + tmpMarker.vec[1] = diameterY / 2.0; + tmpMarker.type = 0; + _outXMarkerList.push_back(tmpMarker); + } + } + } + } + + isPrimaryThreshold = false; + } + } + } + } + + _ss << "TIME AscendingAortaDetection.GetCandidates : " << timeCandidates.getRunningTimeInSeconds() << std::endl; + + + TimeCounter timeClustering; + + + // make clusters (assume a maximum number of 512 clusters) + int counter[512]; + for (j=0; j<512; j++) { + counter[j] = 0; + } + + int currClusterLabel = 1; + + for (i=0; i<_outXMarkerList.getSize(); i++) + { + XMarker *currXMarker = (XMarker*)_outXMarkerList.getItemAt(i); + int tmpClusterLabel; + // XMarker already belongs to cluster + if (currXMarker->type > 0) { + tmpClusterLabel = currXMarker->type; + } + // new cluster + else { + currXMarker->type = currClusterLabel; + tmpClusterLabel = currClusterLabel; + currClusterLabel++; + } + + // merge clusters if distance is within an ellipsoid + // + // ellipsoid equation + // x^2/a^2 + y^2/b^2 + z^2/c^2 = 1 + + vec3 distanceCluster = _distanceClusterFld->getVec3fValue(); + double a = distanceCluster[0]; + double b = distanceCluster[1]; + double c = distanceCluster[2]; + + for (j=0; j<_outXMarkerList.getSize(); j++) + { + if (j!=i) { + XMarker *tmpXMarker = (XMarker*)_outXMarkerList.getItemAt(j); + // compute distance between two XMarkers + // XMarker positions are stored in world coordinates + double distanceSquare = (currXMarker->x()-tmpXMarker->x()) * (currXMarker->x()-tmpXMarker->x()) / (a*a) + + (currXMarker->y()-tmpXMarker->y()) * (currXMarker->y()-tmpXMarker->y()) / (b*b) + + (currXMarker->z()-tmpXMarker->z()) * (currXMarker->z()-tmpXMarker->z()) / (c*c); + + // if distance smaller than threshold + if (distanceSquare < 1) { + if (tmpXMarker->type == 0) { + tmpXMarker->type = tmpClusterLabel; + } + else { + _mergeClusters(tmpXMarker->type, tmpClusterLabel); + } + } + } + } + } + + for (i=0; i<_outXMarkerList.getSize(); i++) + { + counter[((XMarker*)_outXMarkerList.getItemAt(i))->type]++; + } + + + int maxNumber = 0; + int maxLabel = 0; + int secMaxNumber = 0; + int secMaxLabel = 0; + + + // determine largest and second largest cluster + for (i=0; i<currClusterLabel; i++) + { + _ss << "cluster " << i+1 << " - size: " << counter[i] << std::endl; + + if (counter[i] > secMaxNumber) { + secMaxNumber = counter[i]; + secMaxLabel = i; + } + + if (counter[i] > maxNumber) { + secMaxNumber = maxNumber; + secMaxLabel = maxLabel; + maxNumber = counter[i]; + maxLabel = i; + } + } + + _ss << "-------------------------------------" << std::endl; + _ss << "largest cluster : " << maxLabel << " ( " << maxNumber << " elements) " << std::endl; + _ss << "second largest cluster : " << secMaxLabel << " ( " << secMaxNumber << " elements) " << std::endl; + + + _outLargestCluster.clear(); + _outSecondLargestCluster.clear(); + + // fill up largest cluster and second largest cluster list + for (i=0; i<_outXMarkerList.getSize(); i++) + { + XMarker *tmpMarker = (XMarker*)_outXMarkerList.getItemAt(i); + if (tmpMarker->type == maxLabel) { + _outLargestCluster.push_back(*tmpMarker); + } + if (tmpMarker->type == secMaxLabel) { + _outSecondLargestCluster.push_back(*tmpMarker); + } + } + + + + // get 90% quantile + std::sort(_outLargestCluster.begin(), _outLargestCluster.end(), sortClusterPoints); + + int pIndex = (_outLargestCluster.size() * 0.9); + + if (_outLargestCluster.size()) { + XMarker pMarker = _outLargestCluster.at(pIndex); + _seedPointFld->setVec3fValue(vec3(pMarker.x(), pMarker.y(), pMarker.z())); + } + else { + _seedPointFld->setVec3fValue(vec3(-1.0, -1.0, -1.0)); + } + _seedPointFld->notifyAttachments(); + + + // ++++++++++++++ TIME MEASUREMENT END ++++++++++++++ // + _runTimeFld->setDoubleValue(timeWhole.getRunningTimeInSeconds()); + _ss << "TIME AscendingAortaDetection.Clustering : " << timeClustering.getRunningTimeInSeconds() << std::endl; + _ss << "TIME AscendingAortaDetection : " << timeWhole.getRunningTimeInSeconds() << std::endl; + +_infoFld->setStringValue(_ss.str()); + // compute statistics about largest and second largest cluster + // pri = primary -> largestCluster + // sec = secondoary -> secondLargestCluster + + vec3 priBaryCenter; + vec3 priLowerCenter; + vec3 priUpperCenter; + double priMean; + double priStd; + vec2 priRadiusBC; + vec3 priBBLower; + vec3 priBBUpper; + + _computeBB(_outLargestCluster, priBaryCenter, priLowerCenter, priUpperCenter, priMean, priStd, priRadiusBC, priBBLower, priBBUpper); + _priClusterSizeFld->setIntValue(_outLargestCluster.getSize()); + _priMeanIntensityFld->setDoubleValue(priMean); + _priStdIntensityFld->setDoubleValue(priStd); + _priBaryCenterFld->setVec3fValue(priBaryCenter); + _priLowerCenterFld->setVec3fValue(priLowerCenter); + _priUpperCenterFld->setVec3fValue(priUpperCenter); + _priRadiusBCFld->setVec2fValue(priRadiusBC); + _priBBLowerFld->setVec3fValue(priBBLower); + _priBBUpperFld->setVec3fValue(priBBUpper); + + vec3 secBaryCenter; + vec3 secLowerCenter; + vec3 secUpperCenter; + double secMean; + double secStd; + vec2 secRadiusBC; + vec3 secBBLower; + vec3 secBBUpper; + + _computeBB(_outSecondLargestCluster, secBaryCenter, secLowerCenter, secUpperCenter, secMean, secStd, secRadiusBC, secBBLower, secBBUpper); + _secClusterSizeFld->setIntValue(_outSecondLargestCluster.getSize()); + _secMeanIntensityFld->setDoubleValue(secMean); + _secStdIntensityFld->setDoubleValue(secStd); + _secBaryCenterFld->setVec3fValue(secBaryCenter); + _secLowerCenterFld->setVec3fValue(secLowerCenter); + _secUpperCenterFld->setVec3fValue(secUpperCenter); + _secRadiusBCFld->setVec2fValue(secRadiusBC); + _secBBLowerFld->setVec3fValue(secBBLower); + _secBBUpperFld->setVec3fValue(secBBUpper); + + double extMinZ = DBL_MAX; + double extMaxZ = DBL_MIN; + + for (int i=0; i<_outLargestCluster.getSize(); i++) + { + XMarker *tmpMarker = (XMarker*)_outLargestCluster.getItemAt(i); + + if (tmpMarker->z() < extMinZ) { + extMinZ = tmpMarker->z(); + } + + if (tmpMarker->z() > extMaxZ) { + extMaxZ = tmpMarker->z(); + } + } + _extensionLargestClusterFld->setDoubleValue(extMaxZ-extMinZ); + + extMinZ = DBL_MAX; + extMaxZ = DBL_MIN; + double minY = 0.0; + double minX = 0.0; + + for (int i=0; i<_outSecondLargestCluster.getSize(); i++) + { + XMarker *tmpMarker = (XMarker*)_outSecondLargestCluster.getItemAt(i); + + if (tmpMarker->z() < extMinZ) { + extMinZ = tmpMarker->z(); + minX = tmpMarker->x(); + minY = tmpMarker->y(); + } + + if (tmpMarker->z() > extMaxZ) { + extMaxZ = tmpMarker->z(); + } + + } + + _secLowerCenterFld->setVec3fValue(vec3(minX, minY, extMinZ)); + _extensionSecondLargestClusterFld->setDoubleValue(extMaxZ-extMinZ); + + _statistics(); + _infoFld->setStringValue(_ss.str()); + + _ss << "TIME AscendingAortaDetection.statistics: " << timeWhole.getRunningTimeInSeconds() << std::endl; + +} + +//---------------------------------------------------------------------------------- +//! Compute bounding box and some other statistics of given cluster. +//---------------------------------------------------------------------------------- +void AscendingAortaDetection::_computeBB(XMarkerList &_list, vec3 &baryCenter, vec3 &lowerCenter, vec3 &upperCenter, double &mean, double &std, vec2 &radiusBC, vec3 &bbLower, vec3 &bbUpper) +{ + TVirtualVolume<MLuint16> vInVol(*_virtInVol); + + if (_list.getSize() == 0) { + return; + } + + baryCenter = vec3(0, 0, 0); + double minZCoord = DBL_MAX; + double maxZCoord = -DBL_MAX; + for (int i=0; i<_list.getSize(); i++) + { + XMarker *tmpMarker = (XMarker*)_list.getItemAt(i); + baryCenter[0] += tmpMarker->x(); + baryCenter[1] += tmpMarker->y(); + baryCenter[2] += tmpMarker->z(); + + if (tmpMarker->z() < minZCoord) { + minZCoord = tmpMarker->z(); + lowerCenter = vec3(tmpMarker->x(), tmpMarker->y(), tmpMarker->z()); + } + + if (tmpMarker->z() > maxZCoord) { + maxZCoord = tmpMarker->z(); + upperCenter = vec3(tmpMarker->x(), tmpMarker->y(), tmpMarker->z()); + } + } + baryCenter[0] /= (double)_list.getSize(); + baryCenter[1] /= (double)_list.getSize(); + baryCenter[2] /= (double)_list.getSize(); + + // get radius of aorta at baryCenter + vec3 baryCenterVox ; // baryCenter in voxel coordinates + getInImg(0)->transformToVoxelCoord(baryCenter, baryCenterVox); + + // radius at barycenter + radiusBC[0] = 0.5 * _singleRayBothDirections(baryCenterVox, vec3(1, 0, 0), getInImg(0)->getImgExt(), _primaryThresholdFld->getIntValue(), _secondaryThresholdFld->getIntValue(), getInImg(0)->getVoxelSize()); + radiusBC[1] = 0.5 * _singleRayBothDirections(baryCenterVox, vec3(0, 1, 0), getInImg(0)->getImgExt(), _primaryThresholdFld->getIntValue(), _secondaryThresholdFld->getIntValue(), getInImg(0)->getVoxelSize()); + + // extension of bounding box in xy-plane + double bbExtension = _minDiameterFld->getIntValue()*0.5*0.6; // 0.5 to get the radius, 0.6 -> 60% of radius + + bool ok = false; + + while (!ok) + { + Vector corner[8]; + vec3 cornerWorld; + vec3 cornerVoxel; + + cornerWorld = vec3(baryCenter[0]-bbExtension, baryCenter[1]-bbExtension, baryCenter[2]); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[0] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + cornerWorld = vec3(baryCenter[0]+bbExtension, baryCenter[1]-bbExtension, baryCenter[2]); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[1] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + cornerWorld = vec3(baryCenter[0]-bbExtension, baryCenter[1]+bbExtension, baryCenter[2]); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[2] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + cornerWorld = vec3(baryCenter[0]+bbExtension, baryCenter[1]+bbExtension, baryCenter[2]); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[3] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + cornerWorld = vec3(baryCenter[0]-bbExtension, baryCenter[1]-bbExtension, (baryCenter[2]+minZCoord)/2.0); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[4] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + cornerWorld = vec3(baryCenter[0]+bbExtension, baryCenter[1]-bbExtension, (baryCenter[2]+minZCoord)/2.0); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[5] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + cornerWorld = vec3(baryCenter[0]-bbExtension, baryCenter[1]+bbExtension, (baryCenter[2]+minZCoord)/2.0); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[6] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + cornerWorld = vec3(baryCenter[0]+bbExtension, baryCenter[1]+bbExtension, (baryCenter[2]+minZCoord)/2.0); + getInImg(0)->transformToVoxelCoord(cornerWorld, cornerVoxel); + corner[7] = Vector(cornerVoxel[0], cornerVoxel[1], cornerVoxel[2], 0, 0, 0); + + + // check the 8 corners of the bounding box if their intensity is greater than the primary threshold + if ( (vInVol.getVoxel(corner[0]) > _primaryThresholdFld->getIntValue()) + && (vInVol.getVoxel(corner[1]) > _primaryThresholdFld->getIntValue()) + && (vInVol.getVoxel(corner[2]) > _primaryThresholdFld->getIntValue()) + && (vInVol.getVoxel(corner[3]) > _primaryThresholdFld->getIntValue()) + && (vInVol.getVoxel(corner[4]) > _primaryThresholdFld->getIntValue()) + && (vInVol.getVoxel(corner[5]) > _primaryThresholdFld->getIntValue()) + && (vInVol.getVoxel(corner[6]) > _primaryThresholdFld->getIntValue()) + && (vInVol.getVoxel(corner[7]) > _primaryThresholdFld->getIntValue()) ) { + ok = true; + } + else { + bbExtension -= 1.0; + } + if (bbExtension < 0) { + ok = true; + bbExtension = 0.0; + } + + } + + bbLower = vec3(baryCenter[0]-bbExtension, baryCenter[1]-bbExtension, baryCenter[2]); + bbUpper = vec3(baryCenter[0]+bbExtension, baryCenter[1]+bbExtension, (baryCenter[2]+minZCoord)/2.0); + + // compute statistics + vec3 bbLowerVox; + vec3 bbUpperVox; + getInImg(0)->transformToVoxelCoord(bbLower, bbLowerVox); + getInImg(0)->transformToVoxelCoord(bbUpper, bbUpperVox); + + bbLowerVox[0] = (int)bbLowerVox[0]; + bbLowerVox[1] = (int)bbLowerVox[1]; + bbLowerVox[2] = (int)bbLowerVox[2]; + bbUpperVox[0] = (int)bbUpperVox[0]; + bbUpperVox[1] = (int)bbUpperVox[1]; + bbUpperVox[2] = (int)bbUpperVox[2]; + + for (int i=0; i<3; i++) + { + if (bbUpperVox[i] < bbLowerVox[i]) { + int tmp = bbLowerVox[i]; + bbLowerVox[i] = bbUpperVox[i]; + bbUpperVox[i] = tmp; + } + } + + // mean + mean = 0.0; + unsigned meanCounter = 0; + for (int z = bbLowerVox[2]; z <= bbUpperVox[2]; z++) + { + for (int y = bbLowerVox[1]; y <= bbUpperVox[1]; y++) + { + for (int x = bbLowerVox[0]; x <= bbLowerVox[0]; x++) + { + unsigned value = vInVol.getVoxel(Vector(x, y, z, 0, 0, 0)); + meanCounter++; + mean += value; + } + } + } + mean /= (double)meanCounter; + + // standard deviation + std = 0.0; + for (int z = bbLowerVox[2]; z <= bbUpperVox[2]; z++) + { + for (int y = bbLowerVox[1]; y <= bbUpperVox[1]; y++) + { + for (int x = bbLowerVox[0]; x <= bbLowerVox[0]; x++) + { + unsigned value = vInVol.getVoxel(Vector(x, y, z, 0, 0, 0)); + std += (value - mean) * (value - mean); + } + } + } + std /= (double)meanCounter; + std = sqrt(std); +} + +//---------------------------------------------------------------------------------- +//! Compute some additional statistics. +//---------------------------------------------------------------------------------- +void AscendingAortaDetection::_statistics() +{ + // mean radius largest cluster + double meanRadiusLargestCluster = 0.0; + for (int i=0; i<_outLargestCluster.getSize(); i++) { + XMarker *tmpMarker = (XMarker*)_outLargestCluster.getItemAt(i); + meanRadiusLargestCluster += tmpMarker->vec[0]; + meanRadiusLargestCluster += tmpMarker->vec[1]; + } + meanRadiusLargestCluster /= (2.0 * _outLargestCluster.getSize()); + _ss << "meanRadiusLargestCluster " << meanRadiusLargestCluster << std::endl; + + // mean radius second largest cluster + double meanRadiusSecondLargestCluster = 0.0; + for (int i=0; i<_outSecondLargestCluster.getSize(); i++) { + XMarker *tmpMarker = (XMarker*)_outSecondLargestCluster.getItemAt(i); + meanRadiusSecondLargestCluster += tmpMarker->vec[0]; + meanRadiusSecondLargestCluster += tmpMarker->vec[1]; + } + meanRadiusSecondLargestCluster /= (2.0 * _outSecondLargestCluster.getSize()); + _ss << "meanRadiusSecondLargestCluster " << meanRadiusSecondLargestCluster << std::endl; + + // std radius largest cluster + double stdRadiusLargestCluster = 0.0; + for (int i=0; i<_outLargestCluster.getSize(); i++) + { + XMarker *tmpMarker = (XMarker*)_outLargestCluster.getItemAt(i); + stdRadiusLargestCluster += (tmpMarker->vec[0]-meanRadiusLargestCluster) * (tmpMarker->vec[0]-meanRadiusLargestCluster); + stdRadiusLargestCluster += (tmpMarker->vec[1]-meanRadiusLargestCluster) * (tmpMarker->vec[1]-meanRadiusLargestCluster); + } + stdRadiusLargestCluster /= (2.0 * _outLargestCluster.getSize()); + stdRadiusLargestCluster = sqrt(stdRadiusLargestCluster); + _ss << "stdRadiusLargestCluster " << stdRadiusLargestCluster << std::endl; + + // std radius second largest cluster + double stdRadiusSecondLargestCluster = 0.0; + for (int i=0; i<_outSecondLargestCluster.getSize(); i++) + { + XMarker *tmpMarker = (XMarker*)_outSecondLargestCluster.getItemAt(i); + stdRadiusSecondLargestCluster += (tmpMarker->vec[0]-meanRadiusSecondLargestCluster) * (tmpMarker->vec[0]-meanRadiusSecondLargestCluster); + stdRadiusSecondLargestCluster += (tmpMarker->vec[1]-meanRadiusSecondLargestCluster) * (tmpMarker->vec[1]-meanRadiusSecondLargestCluster); + } + stdRadiusSecondLargestCluster /= (2.0 * _outSecondLargestCluster.getSize()); + stdRadiusSecondLargestCluster = sqrt(stdRadiusSecondLargestCluster); + _ss << "stdRadiusSecondLargestCluster " << stdRadiusSecondLargestCluster << std::endl; + + _meanRadiusLargestClusterFld->setDoubleValue(meanRadiusLargestCluster); + _stdRadiusLargestClusterFld->setDoubleValue(stdRadiusLargestCluster); + _meanRadiusSecondLargestClusterFld->setDoubleValue(meanRadiusSecondLargestCluster); + _stdRadiusSecondLargestClusterFld->setDoubleValue(stdRadiusSecondLargestCluster); +} + +//---------------------------------------------------------------------------------- +//! Merge two clusters in _outXMarkerList as given by their cluster label. +//---------------------------------------------------------------------------------- +void AscendingAortaDetection::_mergeClusters(int from, int to) +{ + for (int i=0; i<_outXMarkerList.getSize(); i++) + { + XMarker *tmpXMarker = (XMarker*)_outXMarkerList.getItemAt(i); + if (tmpXMarker->type == from) + { + tmpXMarker->type = to; + } + } +} + +//---------------------------------------------------------------------------------- +//! _initVirtualVolumes +//! return value 1: no problems while creating virtual volume +//! return value -1: error while creating virtual volume +//! +//---------------------------------------------------------------------------------- +int AscendingAortaDetection::_initVirtualVolumes() +{ + + if (_virtInVol) { + ML_DELETE(_virtInVol); + } + + if (getUpdatedInImg(0)) { + //ML_CHECK_NEW(_virtInVol, VirtualVolume(this, 0, getInImg(0)->getDataType())); + // explicitely cast to MLuint16Type + ML_CHECK_NEW(_virtInVol, VirtualVolume(this, 0, MLuint16Type)); + } + else { + _virtInVol = NULL; + } + + if (CVL_IS_VIRTUALVOLUME_NOT_OK(_virtInVol)) { + return -1; + } + return 1; +} + +//---------------------------------------------------------------------------------- +//! Propagate ray in two directions. +//---------------------------------------------------------------------------------- +double AscendingAortaDetection::_singleRayBothDirections(vec3 start, vec3 direction, Vector imgExt, unsigned primeThreshold, unsigned secondThreshold, vec3 voxSize) +{ + double result = 0.0; + + vec3 resDir1 = _singleRay(start, direction, imgExt, primeThreshold, secondThreshold); + vec3 resDir2 = _singleRay(start, -direction, imgExt, primeThreshold, secondThreshold); + + result = sqrt((resDir1[0]-resDir2[0])*(resDir1[0]-resDir2[0])*voxSize[0]*voxSize[0] + + (resDir1[1]-resDir2[1])*(resDir1[1]-resDir2[1])*voxSize[1]*voxSize[1] + + (resDir1[2]-resDir2[2])*(resDir1[2]-resDir2[2])*voxSize[2]*voxSize[2]); + + return result; +} + +//---------------------------------------------------------------------------------- +//! Propagate ray in one direction as described in the paper. +//---------------------------------------------------------------------------------- +vec3 AscendingAortaDetection::_singleRay(vec3 start, vec3 direction, Vector imgExt, unsigned primeThreshold, unsigned secondThreshold) +{ + TVirtualVolume<MLuint16> vInVol(*_virtInVol); + vec3 result = start; + + unsigned value = vInVol.getVoxel(CVL_VEC3_TO_VECTOR(start)); + + // as long as intensity greater than second threshold + while (value > secondThreshold) + { + start = start + direction; + if (CVL_IS_IN_VOLUME(start, imgExt)) { + value = vInVol.getVoxel(CVL_VEC3_TO_VECTOR(start)); + // the result is the last voxel with an intensity greater than + // the primary threshold + if (value > primeThreshold) { + result = start; + } + } + else { + // this will cause the while loop to end + value = 0; + } + } + return result; +} + +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.h =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.h (rev 0) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/mlAscendingAortaDetection.h 2009-07-26 07:59:11 UTC (rev 178) @@ -0,0 +1,208 @@ +//---------------------------------------------------------------------------------- +//! The ML module class AscendingAortaDetection. +/*! +// \file mlAscendingAortaDetection.h +// \author Stefan Saur +// \date 2007-03-24 +// +// as published and described in +// "Automatic Ascending Aorta Detection in CTA Datasets" +// ftp://ftp.vision.ee.ethz.ch/publications/proceedings/eth_biwi_00536.pdf +// +// @InProceedings{eth_biwi_00536, +// author = {Stefan C. Saur and Caroline K\"uhnel and Tobias Boskamp and G\xE1bor Sz\xE9kely and Philippe Cattin}, +// title = {Automatic Ascending Aorta Detection in CTA Datasets}, +// booktitle = {Bildverarbeitung f\xFCr der Medizin 2008}, +// year = {2008}, +// month = {April}, +// pages = {323-327}} +// +// This code was created by support of the research project Co-Me (http://co-me.ch) +// at the Computer Vision Laboratory of ETH Zurich (http://www.vision.ee.ethz.ch) +// +// YOU MUST CITE THIS PAPER WHEN USING THE ALGORITHM IN YOUR PUBLICATION +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlAscendingAortaDetection_H +#define __mlAscendingAortaDetection_H + + +// Local includes +#ifndef __CVLAscendingAortaDetectionSystem_H +#include "CVLAscendingAortaDetectionSystem.h" +#endif + +// ML includes +#include "mlOperatorIncludes.h" +#include "mlVersion.h" + +//! Include Virtual volume classes from MLTools project. +#include "mlTVirtualVolume.h" + +//! Include XMarker stuff +#include "mlXMarkerList.h" +#include "mlTimeCounter.h" + +#include <sstream> + +ML_START_NAMESPACE + +// checks if a given virtual volume is valid +#define CVL_IS_VIRTUALVOLUME_NOT_OK(vv) (!vv || (vv && !vv->isValid())) +// converts a vec3 to a vector +#define CVL_VEC3_TO_VECTOR(input) Vector(input[0], input[1], input[2], 0, 0, 0) +// check if given point is within volume +#define CVL_IS_IN_VOLUME(point, extension) (point[0] >= 0) && (point[1] >= 0) && (point[2] >= 0) && (point[0]<extension[0]) && (point[1]<extension[1]) && (point[2]<extension[2]) + + +//! +class CVLASCENDINGAORTADETECTION_EXPORT AscendingAortaDetection : public BaseOp +{ +public: + + //! Constructor. + AscendingAortaDetection (void); + //! Destructor. + ~AscendingAortaDetection (void); + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + +private: + + + //! Propagate ray in one direction, returns points which meets threshold conditions. + vec3 _singleRay(vec3 start, vec3 direction, Vector imgExt, unsigned primeThreshold, unsigned secondThreshold); + //! Propagate ray in two directions, returns diameter. + double _singleRayBothDirections(vec3 start, vec3 direction, Vector imgExt, unsigned primeThreshold, unsigned secondThreshold, vec3 voxSize); + //! Initialize virtual volume. + int _initVirtualVolumes(); + //! Main routine. + void _process(); + //! Merge two clusters in _outXMarkerList as given by their cluster label. + void _mergeClusters(int from, int to); + //! Compute some additional statistics. + void _statistics(); + //! Compute bounding box and some other statistics of given cluster. + void _computeBB(XMarkerList &_list, vec3 &baryCenter, vec3 &lowerCenter, vec3 &upperCenter, double &mean, double &std, vec2 &radiusBC, vec3 &bbLower, vec3 &bbUpper); + + std::stringstream _ss; + + //! MarkerList with all clusters. + XMarkerList _outXMarkerList; + //! MarkerList with largest cluster. + XMarkerList _outLargestCluster; + //! MarkerList with second largest cluster. + XMarkerList _outSecondLargestCluster; + + //! Virtual volume of input image. + VirtualVolume *_virtInVol; + + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + //! Output field for MarkerList with all clusters. + BaseField *_outXMarkerListFld; + //! Output field for MarkerList with largest cluster. + BaseField *_outXMarkerListLargestClusterFld; + //! Output field for MarkerList with second largest cluster. + BaseField *_outXMarkerListSecondLargestClusterFld; + //! Primary threshold th_p in gray values. + IntField *_primaryThresholdFld; + //! Secondary threshold th_s in gray values. + IntField *_secondaryThresholdFld; + //! Minimum diameter d_min in mm + IntField *_minDiameterFld; + //! Maximum diameter d_max in mm + IntField *_maxDiameterFld; + //! Distance limit for clustering d_clust. + Vec3fField *_distanceClusterFld; + //! Ratio a. + DoubleField *_ratioLimitFld; + //! Apply ratio limit. + BoolField *_useRatioLimitFld; + //! Output during computation. + StringField *_infoFld; + //! increment for search rays in mm + Vec3fField *_incrementFld; + //! percentage in respect to the image extension where the algorithm starts looking for the aorta + Vec3fField *_startSearchAreaFld; + //! percentage in respect to the image extension where the algorithm... [truncated message content] |
From: <wc...@us...> - 2009-08-16 15:51:24
|
Revision: 185 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=185&view=rev Author: wcl_sd Date: 2009-08-16 15:51:13 +0000 (Sun, 16 Aug 2009) Log Message: ----------- New Bridge for OsiriX and MeVisLab Added Paths: ----------- trunk/Community/General/Modules/ML/MLOsiriXImporter/ trunk/Community/General/Modules/ML/MLOsiriXImporter/MLOsiriXImporter.def trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/ trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXExporterExample.mlab trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXImporterExample.mlab trunk/Community/General/Sources/ML/MLOsiriXImporter/ trunk/Community/General/Sources/ML/MLOsiriXImporter/A Transparent Bridge Between OsiriX and MeVisLab.docx trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.h trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.bat trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.pro trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.sh trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/project.pbxproj trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/qt_preprocess.mak trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterSystem.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter_debug.xcodeproj/ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter_debug.xcodeproj/project.pbxproj trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter_debug.xcodeproj/qt_preprocess.mak trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLab2OsiriXTBridge.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLab2OsiriXTBridge.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/ trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/3DRotate.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Brush.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/CMIVDCMView.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/CMIVDCMView.m trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/ConfigCoreDataDelegate.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/ConfigCoreDataDelegate.m trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Cross.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/English.lproj/ trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/English.lproj/InfoPlist.strings trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/English.lproj/locversion.plist trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Info.plist trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Length.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisHubGUI.xib trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisHubWindowController.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisHubWindowController.m trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisLabHub.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisLabHub.m trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisLabHub.xcodeproj/ trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisLabHub.xcodeproj/project.pbxproj trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisLabHubPref.xcdatamodel/ trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisLabHubPref.xcdatamodel/elements trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisLabHubPref.xcdatamodel/layout trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/MeVisOsiriXProxyProtocol.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Move.tif trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Opened Polygon.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/ trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/DCMPix.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/DCMView.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/MyPoint.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/OSIWindowController.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/PluginFilter.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/ROI.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/Schedulable.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/Scheduler.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/StaticScheduler.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/ViewerController.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX Headers/dicomFile.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX2MeVisLabTBridge.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX2MeVisLabTBridge.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX2MeVisLabTBridge2222.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/OsiriX2MeVisLabTBridge2222.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Oval.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Pencil.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/PlugProxyForMeVisLab.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/PlugProxyForMeVisLab.m trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Point.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Polygon.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Rectangle.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Rotate.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/SharedImagesManager.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/SharedImagesManager.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/WLWW.tif trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/Zoom.tiff trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/logo.jpg trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisLabHub/version.plist trunk/Community/General/Sources/ML/MLOsiriXImporter/MeVisOsiriXProxyProtocol.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MevisProxyForOsiriX.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MevisProxyForOsiriX.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/SharedImagesManager.h trunk/Community/General/Sources/ML/MLOsiriXImporter/SharedImagesManager.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/mlOsiriXExporter.h trunk/Community/General/Sources/ML/MLOsiriXImporter/mlOsiriXExporter.mm trunk/Community/General/Sources/ML/MLOsiriXImporter/mlOsiriXImporter.h trunk/Community/General/Sources/ML/MLOsiriXImporter/mlOsiriXImporter.mm Added: trunk/Community/General/Modules/ML/MLOsiriXImporter/MLOsiriXImporter.def =================================================================== --- trunk/Community/General/Modules/ML/MLOsiriXImporter/MLOsiriXImporter.def (rev 0) +++ trunk/Community/General/Modules/ML/MLOsiriXImporter/MLOsiriXImporter.def 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,129 @@ +//---------------------------------------------------------------------------------- +//! MLOsiriXImporter module definitions. +/*! +// \file MLOsiriXImporter.def +// \author Chunliang Wang +// \date 2009-07-07 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule OsiriXImporter +//---------------------------------------------------------------------------------- +MLModule OsiriXImporter { + DLL = "MLOsiriXImporter" + + genre = "File" + author = "Chunliang Wang" + status = "work-in-progress" + comment = "import image from OsiriX via shared memory" + keywords = "OsriX Import" + seeAlso = "OsriXExporter" + documentation = "$(LOCAL)/html/OsiriXImporter.html" + exampleNetwork = "$(LOCAL)/networks/OsiriXImporterExample.mlab" + + Window { + Vertical { + Field OperationName { + tooltip = "The name of this operation (should be unique on the system)" + } + + Field Modified { + tooltip = "if it is true, the caching data should be recaculated." + } + Field Release { + tooltip = "When triggered, OsiriXImporter should free all memory. And set export port to empty." + } + Field ShowMeVisLabWindow { + tooltip = "If set true, MeVisLab will be activated from background" + } + Field ParaName0 { + tooltip = "The name of parameter0" + } + + Field Parameter0Value { + tooltip = "The value of parameter0" + } + + Field ParaName1 { + tooltip = "The name of parameter1" + } + + Field Parameter1Value { + tooltip = "The value of parameter1" + } + + Field ParaName2 { + tooltip = "The name of parameter2" + } + + Field Parameter2Value { + tooltip = "The value of parameter2" + } + + Field ParaName3 { + tooltip = "The name of parameter3" + } + Field Parameter3Value { + tooltip = "The value of parameter3" + } + Field ParaName4 { + tooltip = "The name of parameter4" + } + Field Parameter4Value { + tooltip = "The value of parameter4" + } + + Field ParaName5 { + tooltip = "The name of parameter5" + } + Field Parameter5Value { + tooltip = "The value of parameter5" + } + + Field DICOM_Series_UID { + tooltip = "The Series UID of the images on which the operation is performing. This can be used as a uniqe filename for saving intermediate result in MeVisLab" + } + + } + } +} // MLModule OsiriXImporter +//---------------------------------------------------------------------------------- +//! MLOsiriXExporter module definitions. +/*! +// \file MLOsiriXExporter.def +// \author Chunliang Wang +// \date 2009-08-04 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule OsiriXExporter +//---------------------------------------------------------------------------------- +MLModule OsiriXExporter { + DLL = "MLOsiriXImporter" + + genre = "File" + author = "Chunliang Wang" + status = "work-in-progress" + comment = "Export image to OsiriX" + keywords = "OsiriX Export" + seeAlso = "OsiriXImporter" + documentation = "$(LOCAL)/html/OsiriXExporter.html" + exampleNetwork = "$(LOCAL)/networks/OsiriXExporterExample.mlab" + + Window { + Vertical { + Field OperationName { + tooltip = "The name of this operation (should be unique on the system)" + } + Field SendBackButton { + tooltip = "If triggered send results back to OsiriX" + } + } + } +} // MLModule OsiriXExporter + + Added: trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXExporterExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXExporterExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXExporterExample.mlab 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,7 @@ +module OsiriXExporter { + fields { + instanceName = OsiriXExporter + } + +} + Added: trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXImporterExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXImporterExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLOsiriXImporter/networks/OsiriXImporterExample.mlab 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,7 @@ +module OsiriXImporter { + fields { + instanceName = OsiriXImporter + } + +} + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/A Transparent Bridge Between OsiriX and MeVisLab.docx =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Sources/ML/MLOsiriXImporter/A Transparent Bridge Between OsiriX and MeVisLab.docx ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.h =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.h (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.h 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,18 @@ +// +// ImporterNotificationHandler.h +// MLOsiriXImporter_debug +// +// Created by chuwa on 8/5/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import "mlOsiriXImporter.h" + +@interface ImporterNotificationHandler : NSObject { + ml::OsiriXImporter* importerML; +} +- (id) initWithImporterML:(ml::OsiriXImporter*) aML; +- (void) registerSelfToNSNotificationCenter; +- (void) exporterIsAdded: (NSNotification *)notification; +@end Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.mm =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.mm (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/ImporterNotificationHandler.mm 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,40 @@ +// +// ImporterNotificationHandler.m +// MLOsiriXImporter_debug +// +// Created by chuwa on 8/5/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "ImporterNotificationHandler.h" + + +@implementation ImporterNotificationHandler +- (id) initWithImporterML:(ml::OsiriXImporter*) aML +{ + if ((self = [super init])) { + + importerML=aML; + + [self registerSelfToNSNotificationCenter]; + + + } + return self; + +} +-(void)registerSelfToNSNotificationCenter +{ + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exporterIsAdded:) name:@"AnOsiriXExporterAdded" object:nil]; +} +-(void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver: self]; + [super dealloc]; +} +- (void) exporterIsAdded: (NSNotification *)notification +{ + importerML->setBridgeToOsiriX([notification object]); + [[NSNotificationCenter defaultCenter] removeObserver: self]; +} +@end Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.bat =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.bat (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.bat 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,3 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" MLOsiriXImporter + + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.pro =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.pro (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.pro 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,44 @@ +# ----------------------------------------------------------------------------- +# MLOsiriXImporter project profile +# +# \file MLOsiriXImporter.pro +# \author Chunliang Wang +# \date 2009-07-07 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = MLOsiriXImporter + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + +# add used projects here (see included pri files below for available projects) +CONFIG += dll ML + +MLAB_PACKAGES += Community_General \ + MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += MLOSIRIXIMPORTER_EXPORTS + +HEADERS += \ + MLOsiriXImporterInit.h \ + MLOsiriXImporterSystem.h \ + mlOsiriXImporter.h \ + mlOsiriXExporter.h + +SOURCES += \ + MLOsiriXImporterInit.mm \ + mlOsiriXImporter.mm \ + mlOsiriXExporter.mm + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/MLOsiriXImporter/MLOsiriXImporter.def + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.sh =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.sh (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.sh 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,35 @@ +#! /bin/bash +#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------- +# +# Copyright (c) 2001-2009, MeVis Medical Solutions AG, Bremen, Germany +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of MeVis Medical Solutions AG nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY MEVIS MEDICAL SOLUTIONS AG ''AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL MEVIS MEDICAL SOLUTIONS AG BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#----------------------------------------------------------------------------- +if [ "`uname -s`" = "Darwin" && "$MLAB_ROOT" = "" ]; then + echo "Generate Xcode projects by double-clicking the file 'MLOsiriXImporter.pro' in Finder or use the MeVisLabProjectGenerator.app from the command line to customize the project creation." +else + python $MLAB_ROOT/MeVis/Foundation/BuildTools/Scripts/createProject.py MLOsiriXImporter +fi + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/project.pbxproj =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/project.pbxproj (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/project.pbxproj 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,618 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 1BBB0A3DF8176E3D7F0EC937 /* MLLinearAlgebra in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 639C40EFA979D07223FB6D58 /* MLLinearAlgebra */; }; + 3E90BBBE7067749EB6E1A9AC /* MLMemoryManager in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 0396DDF436C166B7BD26D0B2 /* MLMemoryManager */; }; + 83F2502FFDB5618D046FE2CD /* ML in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 650C0173642193369E858602 /* ML */; }; + 93F55C3A15ECCECAE7259376 /* boost_thread-xgcc40-mt-1_36 in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 6CA34A6677CCFB3CB5DC43C3 /* boost_thread-xgcc40-mt-1_36 */; }; + B914129F10385C69007C9DC7 /* MeVisLab2OsiriXTBridge.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B914129A10385C69007C9DC7 /* MeVisLab2OsiriXTBridge.mm */; }; + B91412A010385C69007C9DC7 /* SharedImagesManager.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B914129B10385C69007C9DC7 /* SharedImagesManager.mm */; }; + B91412A110385C69007C9DC7 /* mlOsiriXExporter.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B914129C10385C69007C9DC7 /* mlOsiriXExporter.mm */; }; + B91412A210385C69007C9DC7 /* mlOsiriXImporter.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B914129D10385C69007C9DC7 /* mlOsiriXImporter.mm */; }; + B91412A310385C69007C9DC7 /* MLOsiriXImporterInit.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B914129E10385C69007C9DC7 /* MLOsiriXImporterInit.mm */; }; + B914132D10385CD4007C9DC7 /* Foundation.framework in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B914132C10385CD4007C9DC7 /* Foundation.framework */; }; + B914133210385CEB007C9DC7 /* Cocoa.framework in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B914133110385CEB007C9DC7 /* Cocoa.framework */; }; + B914133410385D35007C9DC7 /* libMLBase.dylib in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B914133310385D35007C9DC7 /* libMLBase.dylib */; }; + B9F001BD10233AE200B69533 /* libMLOsiriXImporter.dylib in Project Copy */ = {isa = PBXBuildFile; fileRef = B9F001BB10233AE200B69533 /* libMLOsiriXImporter.dylib */; }; + F104824F7EFA3CD00301325E /* MLUtilities in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 983DA09CED0D1524CC13DD71 /* MLUtilities */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + F6069D5A5DA8AA28EDB8B3C6 /* Project Copy */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /Users/chuwa/develop/MeVis/trunk/Community/General/lib; + dstSubfolderSpec = 0; + files = ( + B9F001BD10233AE200B69533 /* libMLOsiriXImporter.dylib in Project Copy */, + ); + name = "Project Copy"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0396DDF436C166B7BD26D0B2 /* MLMemoryManager */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = MLMemoryManager; path = /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib/libMLMemoryManager.dylib; sourceTree = "<absolute>"; }; + 25C7BAC79DA03EA6D5BE1D3C /* MLOsiriXImporter.def */ = {isa = PBXFileReference; lastKnownFileType = text; name = MLOsiriXImporter.def; path = ../../../Modules/ML/MLOsiriXImporter/MLOsiriXImporter.def; sourceTree = "<group>"; }; + 639C40EFA979D07223FB6D58 /* MLLinearAlgebra */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = MLLinearAlgebra; path = /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib/libMLLinearAlgebra.dylib; sourceTree = "<absolute>"; }; + 650C0173642193369E858602 /* ML */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = ML; path = /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib/libML.dylib; sourceTree = "<absolute>"; }; + 6CA34A6677CCFB3CB5DC43C3 /* boost_thread-xgcc40-mt-1_36 */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "boost_thread-xgcc40-mt-1_36"; path = "/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/lib/libboost_thread-xgcc40-mt-1_36.dylib"; sourceTree = "<absolute>"; }; + 7BFBD16BCB5F8557F53D3809 /* MLOsiriXImporter.pro */ = {isa = PBXFileReference; lastKnownFileType = text; path = MLOsiriXImporter.pro; sourceTree = "<group>"; }; + 983DA09CED0D1524CC13DD71 /* MLUtilities */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = MLUtilities; path = /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib/libMLUtilities.dylib; sourceTree = "<absolute>"; }; + B914129A10385C69007C9DC7 /* MeVisLab2OsiriXTBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MeVisLab2OsiriXTBridge.mm; sourceTree = "<group>"; }; + B914129B10385C69007C9DC7 /* SharedImagesManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedImagesManager.mm; sourceTree = "<group>"; }; + B914129C10385C69007C9DC7 /* mlOsiriXExporter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mlOsiriXExporter.mm; sourceTree = "<group>"; }; + B914129D10385C69007C9DC7 /* mlOsiriXImporter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mlOsiriXImporter.mm; sourceTree = "<group>"; }; + B914129E10385C69007C9DC7 /* MLOsiriXImporterInit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MLOsiriXImporterInit.mm; sourceTree = "<group>"; }; + B91412A410385C7B007C9DC7 /* MeVisLab2OsiriXTBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeVisLab2OsiriXTBridge.h; sourceTree = "<group>"; }; + B91412A510385C7B007C9DC7 /* SharedImagesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedImagesManager.h; sourceTree = "<group>"; }; + B91412A610385C7B007C9DC7 /* mlOsiriXExporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mlOsiriXExporter.h; sourceTree = "<group>"; }; + B91412A710385C7B007C9DC7 /* mlOsiriXImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mlOsiriXImporter.h; sourceTree = "<group>"; }; + B91412A810385C7B007C9DC7 /* MeVisOsiriXProxyProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeVisOsiriXProxyProtocol.h; sourceTree = "<group>"; }; + B91412A910385C7B007C9DC7 /* MLOsiriXImporterInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOsiriXImporterInit.h; sourceTree = "<group>"; }; + B91412AA10385C7B007C9DC7 /* MLOsiriXImporterSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOsiriXImporterSystem.h; sourceTree = "<group>"; }; + B914132C10385CD4007C9DC7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; + B914133110385CEB007C9DC7 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; + B914133310385D35007C9DC7 /* libMLBase.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMLBase.dylib; path = /Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib/libMLBase.dylib; sourceTree = "<absolute>"; }; + B9F001BB10233AE200B69533 /* libMLOsiriXImporter.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libMLOsiriXImporter.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2A1043669E6E5A7426EA502A /* Frameworks & Libraries */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 83F2502FFDB5618D046FE2CD /* ML in Frameworks & Libraries */, + 1BBB0A3DF8176E3D7F0EC937 /* MLLinearAlgebra in Frameworks & Libraries */, + 3E90BBBE7067749EB6E1A9AC /* MLMemoryManager in Frameworks & Libraries */, + F104824F7EFA3CD00301325E /* MLUtilities in Frameworks & Libraries */, + 93F55C3A15ECCECAE7259376 /* boost_thread-xgcc40-mt-1_36 in Frameworks & Libraries */, + B914132D10385CD4007C9DC7 /* Foundation.framework in Frameworks & Libraries */, + B914133210385CEB007C9DC7 /* Cocoa.framework in Frameworks & Libraries */, + B914133410385D35007C9DC7 /* libMLBase.dylib in Frameworks & Libraries */, + ); + name = "Frameworks & Libraries"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 05596AB53D8D521C69802C27 /* MLOsiriXImporter */ = { + isa = PBXGroup; + children = ( + FB61758D0F0FDA4BA867C3D5 /* Sources */, + 883D7615C4D2DE3FA1218F12 /* Headers */, + 7CABE3C80E79AD2B307756D2 /* Sources [qmake] */, + 19D61F18B2F38D0DC87E7D4B /* Sources [Related Files] */, + ED1E82605DD74B483AF3C982 /* External Frameworks and Libraries */, + B9F001BC10233AE200B69533 /* Products */, + ); + name = MLOsiriXImporter; + sourceTree = "<group>"; + }; + 1858B2A289DE2AF6BC1E59D9 /* ML */ = { + isa = PBXGroup; + children = ( + 4558565CD3BFE5BCBBC8650F /* MLOsiriXImporter */, + ); + name = ML; + sourceTree = "<group>"; + }; + 19D61F18B2F38D0DC87E7D4B /* Sources [Related Files] */ = { + isa = PBXGroup; + children = ( + 78826E689BEDD00FC7D51DA2 /* .. */, + ); + name = "Sources [Related Files]"; + sourceTree = "<group>"; + }; + 4558565CD3BFE5BCBBC8650F /* MLOsiriXImporter */ = { + isa = PBXGroup; + children = ( + 25C7BAC79DA03EA6D5BE1D3C /* MLOsiriXImporter.def */, + ); + name = MLOsiriXImporter; + sourceTree = "<group>"; + }; + 78826E689BEDD00FC7D51DA2 /* .. */ = { + isa = PBXGroup; + children = ( + 7BA26FA3DF94E452AB39912C /* .. */, + ); + name = ..; + sourceTree = "<group>"; + }; + 7BA26FA3DF94E452AB39912C /* .. */ = { + isa = PBXGroup; + children = ( + FEB573B7CDBCE52BAF2BAA43 /* .. */, + ); + name = ..; + sourceTree = "<group>"; + }; + 7CABE3C80E79AD2B307756D2 /* Sources [qmake] */ = { + isa = PBXGroup; + children = ( + 7BFBD16BCB5F8557F53D3809 /* MLOsiriXImporter.pro */, + ); + name = "Sources [qmake]"; + sourceTree = "<group>"; + }; + 883D7615C4D2DE3FA1218F12 /* Headers */ = { + isa = PBXGroup; + children = ( + B91412A410385C7B007C9DC7 /* MeVisLab2OsiriXTBridge.h */, + B91412A510385C7B007C9DC7 /* SharedImagesManager.h */, + B91412A610385C7B007C9DC7 /* mlOsiriXExporter.h */, + B91412A710385C7B007C9DC7 /* mlOsiriXImporter.h */, + B91412A810385C7B007C9DC7 /* MeVisOsiriXProxyProtocol.h */, + B91412A910385C7B007C9DC7 /* MLOsiriXImporterInit.h */, + B91412AA10385C7B007C9DC7 /* MLOsiriXImporterSystem.h */, + ); + name = Headers; + sourceTree = "<group>"; + }; + B9F001BC10233AE200B69533 /* Products */ = { + isa = PBXGroup; + children = ( + B9F001BB10233AE200B69533 /* libMLOsiriXImporter.dylib */, + ); + name = Products; + sourceTree = "<group>"; + }; + D61DEF2323826D36DB78B32E /* Modules */ = { + isa = PBXGroup; + children = ( + 1858B2A289DE2AF6BC1E59D9 /* ML */, + ); + name = Modules; + sourceTree = "<group>"; + }; + ED1E82605DD74B483AF3C982 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + B914132C10385CD4007C9DC7 /* Foundation.framework */, + B914133110385CEB007C9DC7 /* Cocoa.framework */, + 650C0173642193369E858602 /* ML */, + B914133310385D35007C9DC7 /* libMLBase.dylib */, + 639C40EFA979D07223FB6D58 /* MLLinearAlgebra */, + 0396DDF436C166B7BD26D0B2 /* MLMemoryManager */, + 983DA09CED0D1524CC13DD71 /* MLUtilities */, + 6CA34A6677CCFB3CB5DC43C3 /* boost_thread-xgcc40-mt-1_36 */, + ); + name = "External Frameworks and Libraries"; + sourceTree = "<group>"; + }; + FB61758D0F0FDA4BA867C3D5 /* Sources */ = { + isa = PBXGroup; + children = ( + B914129A10385C69007C9DC7 /* MeVisLab2OsiriXTBridge.mm */, + B914129B10385C69007C9DC7 /* SharedImagesManager.mm */, + B914129C10385C69007C9DC7 /* mlOsiriXExporter.mm */, + B914129D10385C69007C9DC7 /* mlOsiriXImporter.mm */, + B914129E10385C69007C9DC7 /* MLOsiriXImporterInit.mm */, + ); + name = Sources; + sourceTree = "<group>"; + }; + FEB573B7CDBCE52BAF2BAA43 /* .. */ = { + isa = PBXGroup; + children = ( + D61DEF2323826D36DB78B32E /* Modules */, + ); + name = ..; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 84DF9BF26397BB1ED8618223 /* libMLOsiriXImporter */ = { + isa = PBXNativeTarget; + buildConfigurationList = B9F001C810233AEE00B69533 /* Build configuration list for PBXNativeTarget "libMLOsiriXImporter" */; + buildPhases = ( + A0A52A2ADF7A1E2A99738674 /* Qt Preprocessors */, + F6069D5A5DA8AA28EDB8B3C6 /* Project Copy */, + C29B8785722055ED95EF7B57 /* Build Sources */, + 2A1043669E6E5A7426EA502A /* Frameworks & Libraries */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = libMLOsiriXImporter; + productInstallPath = ../../../lib/; + productName = libMLOsiriXImporter; + productReference = B9F001BB10233AE200B69533 /* libMLOsiriXImporter.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 91B15E841AA80083484172DE /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 2A951308CDB28F104D0A4BD2 /* Build configuration list for PBXProject "MLOsiriXImporter" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 05596AB53D8D521C69802C27 /* MLOsiriXImporter */; + productRefGroup = B9F001BC10233AE200B69533 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 84DF9BF26397BB1ED8618223 /* libMLOsiriXImporter */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + A0A52A2ADF7A1E2A99738674 /* Qt Preprocessors */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + name = "Qt Preprocessors"; + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "make -C /Users/chuwa/develop/MeVis/trunk/Community/General/Sources/ML/MLOsiriXImporter -f MLOsiriXImporter.xcodeproj/qt_preprocess.mak"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C29B8785722055ED95EF7B57 /* Build Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B914129F10385C69007C9DC7 /* MeVisLab2OsiriXTBridge.mm in Build Sources */, + B91412A010385C69007C9DC7 /* SharedImagesManager.mm in Build Sources */, + B91412A110385C69007C9DC7 /* mlOsiriXExporter.mm in Build Sources */, + B91412A210385C69007C9DC7 /* mlOsiriXImporter.mm in Build Sources */, + B91412A310385C69007C9DC7 /* MLOsiriXImporterInit.mm in Build Sources */, + ); + name = "Build Sources"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 8DB1DD96F65B1BF1FFC506E0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + }; + name = Debug; + }; + 95E1EB2E5DDD587BE5B3E548 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + }; + name = Release; + }; + B9F001C010233AE300B69533 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_ROOT = /Users/chuwa/develop/MeVis/trunk/Community/General/Sources/ML/MLOsiriXImporter; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1.0; + DYLIB_CURRENT_VERSION = 1.0.0; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + HEADER_SEARCH_PATHS = ( + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/Sources/ML/MLBase, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/SharedIncludes, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/ML/include, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLMemoryManager/Include, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/Sources/misc/boost, + ., + tmp/release/ui, + /usr/local/include, + /System/Library/Frameworks/CarbonCore.framework/Headers, + "/Users/chuwa/Applications/MeVisLab.app/Contents/Support/MeVisLabProjectGenerator.app/Contents/Resources/mkspecs/macx-xcode", + ); + INSTALL_DIR = /Users/chuwa/develop/MeVis/trunk/Community/General/Sources/ML/MLOsiriXImporter/../../../lib/; + INSTALL_PATH = ""; + LEXFLAGS = ""; + LIBRARY_SEARCH_PATHS = ( + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/lib, + /Users/chuwa/develop/MeVis/trunk/Community/General/lib, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib, + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_APPS_DIR)/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib\""; + LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OBJROOT = tmp/release/obj/; + OTHER_CFLAGS = ( + "-pipe", + "-O2", + "-Wall", + "-W", + "-fPIC", + "-DMEVIS_TARGET=MLOsiriXImporter", + "-DBOOST_ALL_DYN_LINK", + "-DMeVisLab", + "-DILAB5", + "-DMEVISLAB", + "-DUNIX", + "-DUNICODE", + "-D__STDC_LIMIT_MACROS", + "-D__STDC_CONSTANT_MACROS", + "-DMACOS", + "-Dlinux", + "-DLINUX", + "-DLinux", + "-DMLOSIRIXIMPORTER_EXPORTS", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-pipe", + "-O2", + "-Wall", + "-W", + "-fPIC", + "-DMEVIS_TARGET=MLOsiriXImporter", + "-DBOOST_ALL_DYN_LINK", + "-DMeVisLab", + "-DILAB5", + "-DMEVISLAB", + "-DUNIX", + "-DUNICODE", + "-D__STDC_LIMIT_MACROS", + "-D__STDC_CONSTANT_MACROS", + "-DMACOS", + "-Dlinux", + "-DLINUX", + "-DLinux", + "-DMLOSIRIXIMPORTER_EXPORTS", + ); + OTHER_LDFLAGS = ( + "-headerpad_max_install_names", + "-single_module", + "-dynamiclib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/lib", + "-L/Users/chuwa/develop/MeVis/trunk/Community/General/lib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib", + ); + OTHER_REZFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = libMLOsiriXImporter; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ""; + YACCFLAGS = "-d"; + }; + name = Debug; + }; + B9F001C110233AE300B69533 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_ROOT = /Users/chuwa/develop/MeVis/trunk/Community/General/Sources/ML/MLOsiriXImporter; + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1.0; + DYLIB_CURRENT_VERSION = 1.0.0; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + HEADER_SEARCH_PATHS = ( + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/SharedIncludes, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/ML/include, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLMemoryManager/Include, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/Sources/misc/boost, + ., + tmp/release/ui, + /usr/local/include, + /System/Library/Frameworks/CarbonCore.framework/Headers, + "/Users/chuwa/Applications/MeVisLab.app/Contents/Support/MeVisLabProjectGenerator.app/Contents/Resources/mkspecs/macx-xcode", + ); + INSTALL_DIR = /Users/chuwa/develop/MeVis/trunk/Community/General/Sources/ML/MLOsiriXImporter/../../../lib/; + INSTALL_PATH = ""; + LEXFLAGS = ""; + LIBRARY_SEARCH_PATHS = ( + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/lib, + /Users/chuwa/develop/MeVis/trunk/Community/General/lib, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib, + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_APPS_DIR)/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib\""; + LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OBJROOT = tmp/release/obj/; + OTHER_CFLAGS = ( + "-pipe", + "-O2", + "-Wall", + "-W", + "-fPIC", + "-DMEVIS_TARGET=MLOsiriXImporter", + "-DBOOST_ALL_DYN_LINK", + "-DMeVisLab", + "-DILAB5", + "-DMEVISLAB", + "-DUNIX", + "-DUNICODE", + "-D__STDC_LIMIT_MACROS", + "-D__STDC_CONSTANT_MACROS", + "-DMACOS", + "-Dlinux", + "-DLINUX", + "-DLinux", + "-DMLOSIRIXIMPORTER_EXPORTS", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-pipe", + "-O2", + "-Wall", + "-W", + "-fPIC", + "-DMEVIS_TARGET=MLOsiriXImporter", + "-DBOOST_ALL_DYN_LINK", + "-DMeVisLab", + "-DILAB5", + "-DMEVISLAB", + "-DUNIX", + "-DUNICODE", + "-D__STDC_LIMIT_MACROS", + "-D__STDC_CONSTANT_MACROS", + "-DMACOS", + "-Dlinux", + "-DLINUX", + "-DLinux", + "-DMLOSIRIXIMPORTER_EXPORTS", + ); + OTHER_LDFLAGS = ( + "-headerpad_max_install_names", + "-single_module", + "-dynamiclib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/lib", + "-L/Users/chuwa/develop/MeVis/trunk/Community/General/lib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib", + ); + OTHER_REZFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = libMLOsiriXImporter; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ""; + YACCFLAGS = "-d"; + }; + name = Release; + }; + B9F001C210233AE300B69533 /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_ROOT = /Users/chuwa/develop/MeVis/trunk/Community/General/Sources/ML/MLOsiriXImporter; + DYLIB_COMPATIBILITY_VERSION = 1.0; + DYLIB_CURRENT_VERSION = 1.0.0; + HEADER_SEARCH_PATHS = ( + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/SharedIncludes, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/ML/include, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLMemoryManager/Include, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/Sources/misc/boost, + ., + tmp/release/ui, + /usr/local/include, + /System/Library/Frameworks/CarbonCore.framework/Headers, + "/Users/chuwa/Applications/MeVisLab.app/Contents/Support/MeVisLabProjectGenerator.app/Contents/Resources/mkspecs/macx-xcode", + ); + INSTALL_DIR = /Users/chuwa/develop/MeVis/trunk/Community/General/Sources/ML/MLOsiriXImporter/../../../lib/; + INSTALL_PATH = ""; + LEXFLAGS = ""; + LIBRARY_SEARCH_PATHS = ( + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/lib, + /Users/chuwa/develop/MeVis/trunk/Community/General/lib, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib, + /Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib, + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_APPS_DIR)/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib\""; + LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OBJROOT = tmp/release/obj/; + OTHER_CFLAGS = ( + "-pipe", + "-O2", + "-Wall", + "-W", + "-fPIC", + "-DMEVIS_TARGET=MLOsiriXImporter", + "-DBOOST_ALL_DYN_LINK", + "-DMeVisLab", + "-DILAB5", + "-DMEVISLAB", + "-DUNIX", + "-DUNICODE", + "-D__STDC_LIMIT_MACROS", + "-D__STDC_CONSTANT_MACROS", + "-DMACOS", + "-Dlinux", + "-DLINUX", + "-DLinux", + "-DMLOSIRIXIMPORTER_EXPORTS", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-pipe", + "-O2", + "-Wall", + "-W", + "-fPIC", + "-DMEVIS_TARGET=MLOsiriXImporter", + "-DBOOST_ALL_DYN_LINK", + "-DMeVisLab", + "-DILAB5", + "-DMEVISLAB", + "-DUNIX", + "-DUNICODE", + "-D__STDC_LIMIT_MACROS", + "-D__STDC_CONSTANT_MACROS", + "-DMACOS", + "-Dlinux", + "-DLINUX", + "-DLinux", + "-DMLOSIRIXIMPORTER_EXPORTS", + ); + OTHER_LDFLAGS = ( + "-headerpad_max_install_names", + "-single_module", + "-dynamiclib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/lib", + "-L/Users/chuwa/develop/MeVis/trunk/Community/General/lib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVisLab/Standard/lib", + "-L/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/lib", + ); + OTHER_REZFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = libMLOsiriXImporter; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ""; + YACCFLAGS = "-d"; + }; + name = Default; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2A951308CDB28F104D0A4BD2 /* Build configuration list for PBXProject "MLOsiriXImporter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DB1DD96F65B1BF1FFC506E0 /* Debug */, + 95E1EB2E5DDD587BE5B3E548 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B9F001C810233AEE00B69533 /* Build configuration list for PBXNativeTarget "libMLOsiriXImporter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B9F001C010233AE300B69533 /* Debug */, + B9F001C110233AE300B69533 /* Release */, + B9F001C210233AE300B69533 /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; +/* End XCConfigurationList section */ + }; + rootObject = 91B15E841AA80083484172DE /* Project object */; +} Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/qt_preprocess.mak =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/qt_preprocess.mak (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter.xcodeproj/qt_preprocess.mak 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,51 @@ +############################################################################# +# Makefile for building: libMLOsiriXImporter.dylib +# Generated by qmake (2.01a) (Qt 4.4.3) on: Tue Jul 7 15:18:25 2009 +# Project: MLOsiriXImporter.pro +# Template: lib +# Command: /Users/chuwa/Applications/MeVisLab.app/Contents/Support/MeVisLabProjectGenerator.app/Contents/Resources/qmake -spec /Users/chuwa/Applications/MeVisLab.app/Contents/Support/MeVisLabProjectGenerator.app/Contents/Resources/mkspecs/macx-xcode -macx INITIAL_CONFIG=$$CONFIG -o MLOsiriXImporter.xcodeproj/project.pbxproj MLOsiriXImporter.pro +############################################################################# + +MOC = /bin/moc +UIC = /bin/uic +LEX = flex +LEXFLAGS = +YACC = yacc +YACCFLAGS = -d +DEFINES = -DMEVIS_TARGET=MLOsiriXImporter -DBOOST_ALL_DYN_LINK -DMeVisLab -DILAB5 -DMEVISLAB -DUNIX -DUNICODE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DMACOS -Dlinux -DLINUX -DLinux -DMLOSIRIXIMPORTER_EXPORTS +INCPATH = -I/Users/chuwa/Applications/MeVisLab.app/Contents/Support/MeVisLabProjectGenerator.app/Contents/Resources/mkspecs/macx-xcode -I. -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/SharedIncludes -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/ML/include -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLLinearAlgebra -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLUtilities -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/Foundation/Sources/MLMemoryManager/Include -I/Users/chuwa/Applications/MeVisLab.app/Contents/Packages/MeVis/ThirdParty/Sources/misc/boost -I. -Itmp/release/ui -I/usr/local/include -I/System/Library/Frameworks/CarbonCore.framework/Headers +DEL_FILE = rm -f +MOVE = mv -f + +IMAGES = +PARSERS = +preprocess: $(PARSERS) compilers +clean preprocess_clean: parser_clean compiler_clean + +parser_clean: +compilers: $(OBJECTS_DIR)mlab_related_dummy_file +compiler_related_make_all: $(OBJECTS_DIR)mlab_related_dummy_file +compiler_related_clean: + -$(DEL_FILE) $(OBJECTS_DIR)mlab_related_dummy_file +$(OBJECTS_DIR)mlab_related_dummy_file: ../../../Modules/ML/MLOsiriXImporter/MLOsiriXImporter.def + true + +compiler_objective_c_make_all: +compiler_objective_c_clean: +compiler_rez_source_make_all: +compiler_rez_source_clean: +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_related_clean + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.h =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.h (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.h 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLOsiriXImporterInit.h +// \author Chunliang Wang +// \date 2009-07-07 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLOsiriXImporterInit_H +#define __MLOsiriXImporterInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int MLOsiriXImporterInit (); + +ML_END_NAMESPACE + +#endif // __MLOsiriXImporterInit_H + + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.mm =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.mm (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterInit.mm 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLOsiriXImporterInit.cpp +// \author Chunliang Wang +// \date 2009-07-07 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "MLOsiriXImporterSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... +#include "mlOsiriXImporter.h" +#include "mlOsiriXExporter.h" + + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int MLOsiriXImporterInit () +{ + ML_TRACE_IN("MLOsiriXImporterInit ()") + + OsiriXImporter::initClass(); + // Add initClass calls from all other modules here... + OsiriXExporter::initClass(); + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(MLOsiriXImporterInit) + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterSystem.h 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLOsiriXImporterSystem.h +// \author Chunliang Wang +// \date 2009-07-07 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLOsiriXImporterSystem_H +#define __MLOsiriXImporterSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef MLOSIRIXIMPORTER_EXPORTS +// Use the MLOSIRIXIMPORTER_EXPORT macro to export classes and functions +#define MLOSIRIXIMPORTER_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define MLOSIRIXIMPORTER_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define MLOSIRIXIMPORTER_EXPORT +#endif + + +#endif // __MLOsiriXImporterSystem_H + + Added: trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter_debug.xcodeproj/project.pbxproj =================================================================== --- trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter_debug.xcodeproj/project.pbxproj (rev 0) +++ trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporter_debug.xcodeproj/project.pbxproj 2009-08-16 15:51:13 UTC (rev 185) @@ -0,0 +1,646 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 1A570F4D3FEB07A3EC4D6FEE /* ML_debug in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 22714C4463A4F1862E994DE0 /* ML_debug */; }; + 51AC20053BF3711383DADDEE /* MLUtilities_debug in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B4AB392E468F2AB2265B0DE3 /* MLUtilities_debug */; }; + B91362821029752900C21B6D /* MeVisLab2OsiriXTBridge.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B91362811029752900C21B6D /* MeVisLab2OsiriXTBridge.mm */; }; + B93F27A0102872D3004C2554 /* SharedImagesManager.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B93F279F102872D3004C2554 /* SharedImagesManager.mm */; }; + B97ECFCC1033A74C00E7F1E9 /* libMLBase_debug.dylib in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B97ECFCB1033A74C00E7F1E9 /* libMLBase_debug.dylib */; }; + B98F13DB100382B400CAAC21 /* libMLOsiriXImporter_debug.dylib in Project Copy */ = {isa = PBXBuildFile; fileRef = B98F13D9100382B400CAAC21 /* libMLOsiriXImporter_debug.dylib */; }; + B9CECC851004E54F00015EEC /* Cocoa.framework in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B9CECC841004E54F00015EEC /* Cocoa.framework */; }; + B9CECC891004E55C00015EEC /* Foundation.framework in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = B9CECC881004E55C00015EEC /* Foundation.framework */; }; + B9F5A1914BA927C868214462 /* MLMemoryManager_debug in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 139CC4B9050016A0C0D8C5FB /* MLMemoryManager_debug */; }; + B9F6777C1028E3A50061D45A /* mlOsiriXExporter.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = B9F6777A1028E3A50061D45A /* mlOsiriXExporter.mm */; }; + C5115CA3D5DCB9DCC1FBEFEB /* MLLinearAlgebra_debug in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = BBACF83D6A2781E09BDF440A /* MLLinearAlgebra_debug */; }; + D5973D63170B3E0649BC87DF /* MLOsiriXImporterInit.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = 2D62CB0FCA44C0859FA7E9A6 /* MLOsiriXImporterInit.mm */; settings = {ATTRIBUTES = (); }; }; + F48EE120B373A7A82FC38D2F /* boost_thread-xgcc40-mt-d-1_36 in Frameworks & Libraries */ = {isa = PBXBuildFile; fileRef = 63D842A671870C6EC442677C /* boost_thread-xgcc40-mt-d-1_36 */; }; + F7A6061EB2D921838BB58D49 /* mlOsiriXImporter.mm in Build Sources */ = {isa = PBXBuildFile; fileRef = 0094FEC7719E76FA95ECA588 /* mlOsiriXImporter.mm */; settings = {ATTRIBUTES = (); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + F6069D5A5DA8AA28EDB8B3C6 /* Project Copy */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /Users/chuwa/develop/MeVis/trunk/Community/General/lib; + dstSubfolderSpec = 0; + files = ( + B98F13DB100382B400CAAC21 /* libMLOsiriXImporter_debug.dylib in Project Copy */, + ); + name = "Project Copy"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0094FEC7719E76FA95ECA588 /* mlOsiriXImporter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = mlOsiriXImporter... [truncated message content] |
From: <coe...@us...> - 2009-08-20 12:45:34
|
Revision: 200 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=200&view=rev Author: coertmetz Date: 2009-08-20 12:45:23 +0000 (Thu, 20 Aug 2009) Log Message: ----------- CM: -BUG: Solved a bug which caused the centerline not to be outputted as XMarkerList when the Graph classes are not available. -ENH: Now the vesselnumber is outputted as the type of the markers to make separation of the centerlines easy. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLLoadCAT08Data/html/LoadCAT08Data.html trunk/Community/General/Sources/ML/MLLoadCAT08Data/mlLoadCAT08Data.cpp Modified: trunk/Community/General/Modules/ML/MLLoadCAT08Data/html/LoadCAT08Data.html =================================================================== --- trunk/Community/General/Modules/ML/MLLoadCAT08Data/html/LoadCAT08Data.html 2009-08-17 18:30:17 UTC (rev 199) +++ trunk/Community/General/Modules/ML/MLLoadCAT08Data/html/LoadCAT08Data.html 2009-08-20 12:45:23 UTC (rev 200) @@ -118,7 +118,7 @@ Points S<br> Points E<br> <br> -An XMarkerList with all center line points.<br> +An XMarkerList with all center line points (the type of the XMarkers is set to the vessel number).<br> An ML Graph structure which can be visualized with the <span style="font-weight: bold;">SoVascularSystem</span> module.<br> </blockquote> Modified: trunk/Community/General/Sources/ML/MLLoadCAT08Data/mlLoadCAT08Data.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLLoadCAT08Data/mlLoadCAT08Data.cpp 2009-08-17 18:30:17 UTC (rev 199) +++ trunk/Community/General/Sources/ML/MLLoadCAT08Data/mlLoadCAT08Data.cpp 2009-08-20 12:45:23 UTC (rev 200) @@ -181,25 +181,30 @@ dataFileName.str(""); // This is a strange way to clear the dataFileName, but dataFileName.clear() does not work file_to_read.close(); - #if ML_GRAPH_IS_AVAILABLE - // Get vessel centerline as XMarkers and Vessel Graph - dataFileName << pathname << "vessel" << vesselNbr << "/" << "reference.txt"; - file_to_read.open(dataFileName.str().c_str()); - if(file_to_read) { - int pointNbr = 0; + // Get vessel centerline as XMarkers and Vessel Graph + dataFileName << pathname << "vessel" << vesselNbr << "/" << "reference.txt"; + file_to_read.open(dataFileName.str().c_str()); + if(file_to_read) { + int pointNbr = 0; + #if ML_GRAPH_IS_AVAILABLE // Create a new vessel graph edge VesselEdge *graphEdge = new VesselEdge; VesselNode *rootNode = NULL; - do { + #endif + do { + // Extract point and radius + double x,y,z,r,foo; + file_to_read >> x >> y >> z >> r >> foo; + vec3 pos(x,y,z); - // Extract point and radius - double x,y,z,r,foo; - file_to_read >> x >> y >> z >> r >> foo; - vec3 pos(x,y,z); + // Create a marker and set its type to the vessel number + XMarker marker (vec6(pos,0,0,0), vec3(0)); + marker.type = vesselNbr; - // Add to XMarker list - _centerLineList.appendItem(XMarker(vec6(pos,0,0,0), vec3(0))); + // Add to XMarker list + _centerLineList.appendItem(marker); + #if ML_GRAPH_IS_AVAILABLE // If this is the first point, add new root to the Vessel Graph if(0 == pointNbr) { rootNode = new VesselNode(pos); // Create new node @@ -209,11 +214,13 @@ } // Create a skeleton and add it to the edge graphEdge->addSkeleton(Skeleton(pos, r, r)); + #endif - // Increment - ++pointNbr; - }while(!file_to_read.eof()); + // Increment + ++pointNbr; + }while(!file_to_read.eof()); + #if ML_GRAPH_IS_AVAILABLE // Finish generating the vessel graph by adding the edge and end node to the graph VesselNode *endNode = new VesselNode(graphEdge->backSkeleton()->pos); _outputGraph.addNode(endNode); @@ -222,8 +229,9 @@ graphEdge->setSucc(endNode); // Add the vessel edge to the graph _outputGraph.attachIdEdge(graphEdge,rootNode->getId(),endNode->getId()); - } - #endif + #endif + } + dataFileName.str(""); // This is a strange way to clear the dataFileName, but dataFileName.clear() does not work file_to_read.close(); file_to_read.clear(); // Another strange thing, clear() must be called when we read the file to eof, otherwise we cannot reopen file_to_read later. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tm...@us...> - 2009-09-02 14:51:13
|
Revision: 204 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=204&view=rev Author: tmoench Date: 2009-09-02 14:51:06 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Two changes to enable referencing from other packages: - Added export to MinimalDistancePointClouds.h - Added project MLCSOCommunityModules to Community_General.pri Modified Paths: -------------- trunk/Community/General/Configuration/Community_General.pri trunk/Community/General/Sources/ML/MLCSOCommunityModules/MinimalDistancePointClouds/MinimalDistancePointClouds.h Modified: trunk/Community/General/Configuration/Community_General.pri =================================================================== --- trunk/Community/General/Configuration/Community_General.pri 2009-09-02 11:53:16 UTC (rev 203) +++ trunk/Community/General/Configuration/Community_General.pri 2009-09-02 14:51:06 UTC (rev 204) @@ -44,6 +44,15 @@ # -- ML Projects ------------------------------------------------------------- +MLCSOCommunityModules { + CONFIG_FOUND += MLCSOCommunityModules + INCLUDEPATH += $${PACKAGE_SOURCES}/ML/MLCSOCommunityModules + INCLUDEPATH += $${PACKAGE_SOURCES}/ML/MLCSOCommunityModules/CSODistance + INCLUDEPATH += $${PACKAGE_SOURCES}/ML/MLCSOCommunityModules/MinimalDistancePointClouds + win32:LIBS += MLCSOCommunityModules$${d}.lib + unix:LIBS += -lMLCSOCommunityModules$${d} +} + # -- Inventor Projects ------------------------------------------------------- # -- Shared Projects --------------------------------------------------------- Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/MinimalDistancePointClouds/MinimalDistancePointClouds.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/MinimalDistancePointClouds/MinimalDistancePointClouds.h 2009-09-02 11:53:16 UTC (rev 203) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/MinimalDistancePointClouds/MinimalDistancePointClouds.h 2009-09-02 14:51:06 UTC (rev 204) @@ -37,7 +37,7 @@ //! The MinimalDistancePointClouds implements //! a fast nearest pair search algorithm described by Sean Quinlan //! in 'Efficient Distance Computation between Non-Convex Objects'. -class MinimalDistancePointClouds +class MLCSOCOMMUNITYMODULES_EXPORT MinimalDistancePointClouds { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tm...@us...> - 2009-10-01 09:09:42
|
Revision: 207 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=207&view=rev Author: tmoench Date: 2009-10-01 09:08:50 +0000 (Thu, 01 Oct 2009) Log Message: ----------- Added module UMDsplitCurveList Added Paths: ----------- trunk/Community/General/Modules/ML/UMDsplitCurveList/ trunk/Community/General/Modules/ML/UMDsplitCurveList/UMDsplitCurveList.def trunk/Community/General/Modules/ML/UMDsplitCurveList/html/ trunk/Community/General/Modules/ML/UMDsplitCurveList/html/UMDsplitCurveList.html trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/ trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab trunk/Community/General/Sources/ML/UMDsplitCurveList/ trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.bat trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.pro trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.sh trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.cpp trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.h trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListSystem.h trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.h Added: trunk/Community/General/Modules/ML/UMDsplitCurveList/UMDsplitCurveList.def =================================================================== --- trunk/Community/General/Modules/ML/UMDsplitCurveList/UMDsplitCurveList.def (rev 0) +++ trunk/Community/General/Modules/ML/UMDsplitCurveList/UMDsplitCurveList.def 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,45 @@ +//---------------------------------------------------------------------------------- +//! UMDsplitCurveList module definitions. +/*! +// \file UMDsplitCurveList.def +// \author Tobias M\xF6nch +// \date 2009-08-05 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule UMDsplitCurveList +//---------------------------------------------------------------------------------- +MLModule UMDsplitCurveList { + DLL = "UMDsplitCurveList" + + genre = "" + author = "Tobias M\xF6nch, Sylvia Gla\xDFer" + status = stable + comment = "Splits a given CurveList into the selected curve and the remaining curveLists." + keywords = "CurveData, CurveList" + seeAlso = "" + documentation = "$(LOCAL)/html/UMDsplitCurveList.html" + exampleNetwork = "$(LOCAL)/networks/UMDsplitCurveListExample.mlab" + + Window { + expandX = True + width = 500 + Category { + width = 500 + expandX = True + alignX = Left + + Horizontal { + Label {title = "Select Curve: "} + ComboBox AvailableCurves{ + comboField = AvailableCurvesStr + comboSeparator = "," + editable = False + } + } + } + } +} // MLModule UMDsplitCurveList + Added: trunk/Community/General/Modules/ML/UMDsplitCurveList/html/UMDsplitCurveList.html =================================================================== --- trunk/Community/General/Modules/ML/UMDsplitCurveList/html/UMDsplitCurveList.html (rev 0) +++ trunk/Community/General/Modules/ML/UMDsplitCurveList/html/UMDsplitCurveList.html 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,141 @@ +<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + + + + + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + + + + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + + + + + <meta name="Description" content="MeVisLab module help page template"> + + + + + <title>Module Help Page</title> +</head> + + +<body> + + + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> +<a href="#Details">Details</a> <a href="#Inputs">Inputs</a> +<a href="#Outputs">Outputs</a> <a href="#Parameters">Parameters</a> +<a href="#EventInteract">Events&Interaction</a> <a href="#Example">Example</a> +<a href="#Tips&Tricks">Tips&Tricks</a> <a href="#KnownBugs">Known +Bugs</a> +<hr width="100%"></center> + + + +<h2> +TestFilter</h2> + + + +<h3> +<a name="Purpose"></a>Purpose</h3> + + + +<blockquote>The module allows to select a single curve from a collection of several curves (CurveList) and therefor splits the input CurveList into (1) the selected curve, (2) the curves preceding the selection and (3) the remaining curves.</blockquote> + + + +<h3> +<a name="Usage"></a>Usage</h3> + + + +<blockquote>Just connect a module providing a CurveList and then select the desired curve using the GUI<br> + +</blockquote> + + + +<h3> +<a name="Details"></a>Details</h3> + + + +<blockquote> - </blockquote> + + + +<h3> +<a name="Inputs"></a>Inputs</h3> + + + +<blockquote>There is only one input for the required CurveList.</blockquote> + + + +<h3> +<a name="Outputs"></a>Outputs</h3> + + + +<blockquote>The module provides three outputs:<br> +(1) <i>outCurveList1</i> - the list of curves from the input CurveList beginning from index 0 till the selected curve. The output will be empty if the user selects the first provided curve. Selection of the last curve in the list will result in an output with n-1 curves.<br> +(2) <i>outCurveData</i> - the curve that has been selected by the user.<br> +(3) <i>outCurveList2</i> - the list of curves from the input CurveList beginning after the selected curve till the end. The output will be empty if the user selects the last provided curve. Selection of the first curve in the list will result in an output with n-1 curves.</blockquote> + + + +<h3> +<a name="Parameters"></a>Parameters</h3> + + +<blockquote> - </blockquote> + + + +<h3> +<a name="EventInteract"></a>Events & Interaction</h3> + + + +<blockquote> - </blockquote> + + + +<h3> +<a name="Example"></a>Example</h3> + + + +<blockquote> - </blockquote> + + + +<h3> +<a name="Tips&Tricks"></a>Tips & Tricks</h3> + + + +<blockquote> - </blockquote> + + + +<h3> +<a name="KnownBugs"></a>Known Bugs</h3> + + + +<blockquote> - </blockquote> + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,938 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module UMDsplitCurveList { + internal { + frame = "-187 -67 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "118 141 500 31" + sizeHint = "500 31" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = UMDsplitCurveList + AvailableCurvesStr = "1: Face Area,2: Face Area" + AvailableCurves = "2: Face Area" + } +} +module LocalImage { + internal { + frame = "-223 429 96 56" + moduleGroupName = "" + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module WEMIsoSurface { + internal { + frame = "-235 285 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "506 550 380 413" + sizeHint = "380 413" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMIsoSurface + isProcessing = FALSE + elapsedTime = 0.2809999883 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.266667008399963 0.266667008399963 0.266667008399963" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.0666669979691505 0.0666669979691505 0.0666669979691505" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + isoMinValue = 1200 + isoMaxValue = 2000 + useMinValue = FALSE + useMaxValue = TRUE + cellExtend = "1 1 1" + useWorldCoords = TRUE + useInterpolation = TRUE + useQuadrification = FALSE + useFaceValueList = FALSE + useValenceThreeRemoval = TRUE + useZeroLengthEdgeRemoval = TRUE + selectedTab = 0 + } +} +module WEMInfo { + internal { + frame = "-259 125 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "45 554 464 326" + sizeHint = "464 326" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "1958 306 307 440" + sizeHint = "307 440" + wasOpen = no + wasActive = no + } + window _scriptconsole { + geometry = "1155 445 256 192" + sizeHint = "256 192" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInfo + isProcessing = FALSE + elapsedTime = 0.07800000161 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + listenToFinishingNotifications = TRUE + listenToRepaintNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + WEMs = "2@" + selectedWEMs = "" + informationFieldsValid = TRUE + numNodes = 13333 + numEdges = 40005 + numFaces = 26670 + uniqueId = 2 + patchType = Triangles + hasEdges = TRUE + surfaceArea = 9452.926758 + surfaceVolume = 11593.98047 + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.266667008399963 0.266667008399963 0.266667008399963" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.0666669979691505 0.0666669979691505 0.0666669979691505" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBox = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + center = "32 32.49152374267578 12.5" + minimum = "0 0.983045220375061 0" + maximum = "64 64 25" + size = "64 63.01695477962494 25" + radius = 46.61581421 + mainAxisCenter = "37.00667572021484 31.91140174865723 11.19961833953857" + xMainAxis = "0.8188340067863464 0.5700684189796448 -0.06732727587223053" + yMainAxis = "-0.5646404027938843 0.8210079073905945 0.08442250639200211" + zMainAxis = "0.1034028306603432 -0.03111230954527855 0.994152843952179" + xExt = 76.54521942 + yExt = 77.21954346 + zExt = 29.9910202 + primitiveValueLists = "LUT,Edge Length,Face Area,Face Quality,Node Curvature,Node Valence" + selectedPrimitiveValueList = "Face Area" + primitiveValueListValid = TRUE + minPrimitiveValueList = 0 + maxPrimitiveValueList = 1.142393827438354 + meanPrimitiveValueList = 0.35443971761418 + primitiveValueListUnits = mm2 + edgeLengthUnits = mm + faceAreaUnits = mm2 + curveScaleFactor = 1 + selectedTab = 2 + } +} +module Diagram2D { + internal { + frame = "-191 -203 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "735 382 483 554" + sizeHint = "483 554" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 13 + autoRangeX = TRUE + minY = 0 + maxY = 47.28749847 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = TRUE + diagramTitleString = "Face Area" + borderH = 26 + autoBorderH = TRUE + borderV = 40 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn] vc" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 1 1" + lineStyle = Solid + markerType = None + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = -0.9825582504 + mousePosY = 53.12361526 + mousePosValid = TRUE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = TRUE + } +} +module SoRenderArea { + internal { + frame = "-199 -299 112 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "675 102 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoRenderArea + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + } +} +module WEMInfo { + internal { + frame = "-147 125 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "535 590 464 326" + sizeHint = "464 326" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "1729 290 307 440" + sizeHint = "307 440" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInfo1 + isProcessing = FALSE + elapsedTime = 0.03200000152 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + listenToFinishingNotifications = TRUE + listenToRepaintNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + WEMs = "4@" + selectedWEMs = "" + informationFieldsValid = TRUE + numNodes = 3980 + numEdges = 12000 + numFaces = 8000 + uniqueId = 4 + patchType = Triangles + hasEdges = TRUE + surfaceArea = 9087.744141 + surfaceVolume = 11418.16016 + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.266667008399963 0.266667008399963 0.266667008399963" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.0666669979691505 0.0666669979691505 0.0666669979691505" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBox = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + center = "32.18994140625 32.51465225219727 12.5" + minimum = "0.3798865675926208 1.029304265975952 0" + maximum = "64 64 25" + size = "63.62011343240738 62.97069573402405 25" + radius = 46.46995926 + mainAxisCenter = "36.68818664550781 31.71071624755859 11.26501941680908" + xMainAxis = "0.8260845541954041 0.5626350045204163 -0.03203367441892624" + yMainAxis = "-0.5583527684211731 0.8248476982116699 0.088703952729702" + zMainAxis = "0.07633084803819656 -0.05539087951183319 0.9955427646636963" + xExt = 76.63578033 + yExt = 76.85345459 + zExt = 28.82315826 + primitiveValueLists = "LUT,Quadric Error,Edge Length,Face Area,Face Quality,Node Curvature,Node Valence" + selectedPrimitiveValueList = "Face Area" + primitiveValueListValid = TRUE + minPrimitiveValueList = 0 + maxPrimitiveValueList = 12.19644355773926 + meanPrimitiveValueList = 1.135967058496957 + primitiveValueListUnits = mm2 + edgeLengthUnits = mm + faceAreaUnits = mm2 + curveScaleFactor = 1 + selectedTab = 2 + } +} +module ConcatenateCurves { + internal { + frame = "-215 33 144 64" + moduleGroupName = "" + windows { + window _default { + geometry = "1183 466 138 104" + sizeHint = "138 104" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = CatCurves + enable1 = TRUE + enable2 = TRUE + enable3 = TRUE + enable4 = TRUE + } +} +module StylePalette { + internal { + frame = "-311 37 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "1399 317 629 488" + sizeHint = "629 488" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 4 + markerSize2 = 4 + markerSize3 = 4 + markerSize4 = 4 + markerSize5 = 4 + markerSize6 = 4 + markerSize7 = 4 + markerSize8 = 4 + markerSize9 = 4 + markerSize10 = 4 + markerSize11 = 4 + markerSize12 = 4 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module SubImage { + internal { + frame = "-219 353 88 64" + moduleGroupName = "" + windows { + window _default { + geometry = "48 88 431 319" + sizeHint = "431 319" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Subimage + boxInput = "0 0 0 0 0 0 -1 -1 -1 -1 -1 -1" + autoApplyBox = FALSE + x = 0 + sx = 64 + modifyX = FALSE + y = 0 + sy = 64 + modifyY = FALSE + z = 0 + sz = 25 + modifyZ = TRUE + c = 0 + sc = 1 + modifyC = FALSE + t = 0 + st = 1 + modifyT = FALSE + u = 0 + su = 1 + modifyU = FALSE + fillValue = 0 + mode = VoxelStartSize + autoApply = TRUE + } +} +module Comment { + internal { + frame = "-27 253 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "47 93 379 408" + sizeHint = "256 209" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Comment + comment = "In this example a WEM is reduced with WEMReducePolygons and information on both the original mesh and the reduced mesh is put against each other. + +On the general panel the number of primitives can be seen, as well as some administrative information. + +The statistics panel shows minimum, maximum and mean values for different statistical modes. Change the primitive value to see these values. + +In this example all primitive values have a curve which displays the coverage of set statistic across the WEM. + +Notice the significant increase in 'Edge Length', 'Face Area', 'Face Quality' and 'Node Curvature' due to the mesh reduction by WEMReducePolygons." + } + internalFields = "" +} +module WEMReducePolygons { + internal { + frame = "-163 205 152 56" + moduleGroupName = "" + windows { + window _default { + geometry = "220 114 341 413" + sizeHint = "341 413" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMReducePolygons + isProcessing = FALSE + elapsedTime = 1.281000018 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.266667008399963 0.266667008399963 0.266667008399963" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.0666669979691505 0.0666669979691505 0.0666669979691505" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + copyInputWEMs = TRUE + listenToFinishNotifications = TRUE + forwardRepaintNotifications = TRUE + forwardSelectionNotifications = TRUE + triangulationMode = Strip + modifyAttributes = FALSE + targetReduction = 70 + smooth = TRUE + numEdgeCollapses = 9101 + reduction = 70 + useExpertMode = FALSE + vertexPlacementMode = Middle + areaWeightedQuadrics = TRUE + valenceWeightedQuadrics = TRUE + edgeWeightedQuadrics = TRUE + selectedTab = 0 + outputTabSelected = TRUE + } +} +module SoWEMRenderer { + internal { + frame = "9 -155 128 56" + moduleGroupName = "" + windows { + window _default { + geometry = "1162 495 337 404" + sizeHint = "337 404" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoWEMRenderer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + useHighlightSelected = FALSE + usePolygonOffset = TRUE + useShapeHints = TRUE + allowHits = TRUE + parameterOverwriteMode = OVERWRITE_MODE_ALL + overwriteColorMode = FALSE + overwriteFaceParameters = FALSE + overwriteEdgeParameters = FALSE + overwriteNodeParameters = FALSE + overwriteBoundingBoxParameters = FALSE + colorMode = WEM_COLOR_GENERAL + drawFaces = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + drawEdges = TRUE + edgeColor = "0 0 0" + drawNodes = FALSE + nodeColor = "1 1 1" + drawBoundingBoxes = FALSE + boundingBoxColor = "1 1 1" + drawFaceNormals = FALSE + drawNodeNormals = FALSE + faceNormalColor = "1 1 1" + nodeNormalColor = "1 1 1" + faceNormalScaling = 1 + nodeNormalScaling = 1 + faceAlphaValue = 1 + faceShininessValue = 1 + lineWidth = 1 + pointSize = 1 + useEdgeColoringMode = FALSE + nodeRenderingMode = WEM_NODE_RENDERING_NORMAL + boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED + primitiveValueLists = "LUT,Face Area" + selectedPrimitiveValueList = LUT + primitiveValueListValid = TRUE + selectedTab = 0 + } +} +module SoExaminerViewer { + internal { + frame = "45 -307 152 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "598 535 566 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + stereoViewing = FALSE + stereoOffset = 3 + height = 0.7853980064 + position = "56.50242614746094 -37.72786712646484 85.03986358642578" + orientation = "0.9552596807479858 0.05349960178136826 -0.2908898293972015 0.7712323665618896" + nearDistance = 68.03115082 + farDistance = 134.368103 + focalDistance = 113.3730011 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module SoBackground { + internal { + frame = "-31 -227 112 56" + moduleGroupName = "" + } + fields { + instanceName = SoBackground + rotate = TRUE + flip = FALSE + on = TRUE + depthBuffer = TRUE + } +} +module SoWEMRenderer { + internal { + frame = "133 -155 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "795 427 337 404" + sizeHint = "337 404" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoWEMRenderer1 + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + useHighlightSelected = FALSE + usePolygonOffset = TRUE + useShapeHints = TRUE + allowHits = TRUE + parameterOverwriteMode = OVERWRITE_MODE_ALL + overwriteColorMode = FALSE + overwriteFaceParameters = FALSE + overwriteEdgeParameters = FALSE + overwriteNodeParameters = FALSE + overwriteBoundingBoxParameters = FALSE + colorMode = WEM_COLOR_GENERAL + drawFaces = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + drawEdges = TRUE + edgeColor = "0 0 0" + drawNodes = FALSE + nodeColor = "1 1 1" + drawBoundingBoxes = FALSE + boundingBoxColor = "1 1 1" + drawFaceNormals = FALSE + drawNodeNormals = FALSE + faceNormalColor = "1 1 1" + nodeNormalColor = "1 1 1" + faceNormalScaling = 1 + nodeNormalScaling = 1 + faceAlphaValue = 1 + faceShininessValue = 1 + lineWidth = 1 + pointSize = 1 + useEdgeColoringMode = FALSE + nodeRenderingMode = WEM_NODE_RENDERING_NORMAL + boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED + primitiveValueLists = "LUT,Quadric Error,Face Area" + selectedPrimitiveValueList = LUT + primitiveValueListValid = TRUE + selectedTab = 0 + } +} +module SoTranslation { + internal { + frame = "73 -227 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "826 554 274 37" + sizeHint = "274 37" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoTranslation + translation = "66 0 0" + } +} +connections { + UMDsplitCurveList.inCurveList = CatCurves.outCurveList + WEMIsoSurface.input0 = Subimage.output0 + WEMInfo.inWEM = WEMIsoSurface.outWEM + Diagram2D.inStylePalette = StylePalette.outStylePalette + Diagram2D.inCurveList = UMDsplitCurveList.outCurveData + Diagram2D.diagramTitleString = WEMInfo.selectedPrimitiveValueList + SoRenderArea.children = Diagram2D.outNode + WEMInfo1.inWEM = WEMReducePolygons.outWEM + WEMInfo1.selectedWEMs = WEMInfo.selectedWEMs + WEMInfo1.selectedPrimitiveValueList = WEMInfo.selectedPrimitiveValueList + CatCurves.inCurve1 = WEMInfo.outputCurveData + CatCurves.inCurve2 = WEMInfo1.outputCurveData + Subimage.input0 = LocalImage.outImage + WEMReducePolygons.inWEM = WEMIsoSurface.outWEM + SoWEMRenderer.inWEM = WEMIsoSurface.outWEM + SoExaminerViewer.children = "SoBackground.self SoWEMRenderer.self SoTranslation.self SoWEMRenderer1.self" + SoWEMRenderer1.inWEM = WEMReducePolygons.outWEM +} +networkModel = "" Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.bat =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.bat (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.bat 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,3 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" UMDsplitCurveList + + Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.pro =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.pro (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.pro 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,42 @@ +# ----------------------------------------------------------------------------- +# UMDsplitCurveList project profile +# +# \file UMDsplitCurveList.pro +# \author Tobias M\xF6nch +# \date 2009-08-05 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = UMDsplitCurveList + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + +# add used projects here (see included pri files below for available projects) +CONFIG += dll ML MLBase + +MLAB_PACKAGES += Community_General \ + MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += UMDSPLITCURVELIST_EXPORTS + +HEADERS += \ + UMDsplitCurveListInit.h \ + UMDsplitCurveListSystem.h \ + mlUMDsplitCurveList.h + +SOURCES += \ + UMDsplitCurveListInit.cpp \ + mlUMDsplitCurveList.cpp + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/UMDsplitCurveList/UMDsplitCurveList.def + Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.sh =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.sh (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveList.sh 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,35 @@ +#! /bin/bash +#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------- +# +# Copyright (c) 2001-2009, MeVis Medical Solutions AG, Bremen, Germany +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of MeVis Medical Solutions AG nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY MEVIS MEDICAL SOLUTIONS AG ''AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL MEVIS MEDICAL SOLUTIONS AG BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#----------------------------------------------------------------------------- +if [ "`uname -s`" = "Darwin" && "$MLAB_ROOT" = "" ]; then + echo "Generate Xcode projects by double-clicking the file 'UMDsplitCurveList.pro' in Finder or use the MeVisLabProjectGenerator.app from the command line to customize the project creation." +else + python $MLAB_ROOT/MeVis/Foundation/BuildTools/Scripts/createProject.py UMDsplitCurveList +fi + Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.cpp 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,42 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file UMDsplitCurveListInit.cpp +// \author Tobias M\xF6nch +// \date 2009-08-05 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "UMDsplitCurveListSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... +#include "mlUMDsplitCurveList.h" + + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int UMDsplitCurveListInit () +{ + ML_TRACE_IN("UMDsplitCurveListInit ()") + + UMDsplitCurveList::initClass(); + // Add initClass calls from all other modules here... + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(UMDsplitCurveListInit) + Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.h =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.h (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListInit.h 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file UMDsplitCurveListInit.h +// \author Tobias M\xF6nch +// \date 2009-08-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __UMDsplitCurveListInit_H +#define __UMDsplitCurveListInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int UMDsplitCurveListInit (); + +ML_END_NAMESPACE + +#endif // __UMDsplitCurveListInit_H + + Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListSystem.h =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListSystem.h 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file UMDsplitCurveListSystem.h +// \author Tobias M\xF6nch +// \date 2009-08-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __UMDsplitCurveListSystem_H +#define __UMDsplitCurveListSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef UMDSPLITCURVELIST_EXPORTS +// Use the UMDSPLITCURVELIST_EXPORT macro to export classes and functions +#define UMDSPLITCURVELIST_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define UMDSPLITCURVELIST_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define UMDSPLITCURVELIST_EXPORT +#endif + + +#endif // __UMDsplitCurveListSystem_H + + Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,167 @@ +//---------------------------------------------------------------------------------- +//! The ML module class UMDsplitCurveList. +/*! +// \file mlUMDsplitCurveList.cpp +// \author Tobias M\xF6nch +// \date 2009-08-05 +// +// Extracts single curves and several curves from a CureList object. +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlUMDsplitCurveList.h" + +ML_START_NAMESPACE + +using namespace std; + +std::string +asString( double d, int precision = 6 ) +{ +std::ostringstream s ; +s.precision( precision ) ; +s << d ; +return s.str() ; +} + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(UMDsplitCurveList, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +UMDsplitCurveList::UMDsplitCurveList () + : BaseOp(0, 0) +{ + ML_TRACE_IN("UMDsplitCurveList::UMDsplitCurveList ()"); + + // Suppress calls of handleNotification on field changes to + // avoid side effects during initialization phase. + handleNotificationOff(); + + FieldContainer *fc = getFieldContainer(); + + // add input field + _inputCurveListFld = fc->addBase("inCurveList"); + + // output fields + (_curveList1Fld = fc->addBase("outCurveList1"))->setBaseValue(&_curveList1); + (_curveDataFld = fc->addBase("outCurveData"))->setBaseValue(&_curveData); + (_curveList2Fld = fc->addBase("outCurveList2"))->setBaseValue(&_curveList2); + + // GUI element(s) + _availableCurvesStrFld = fc->addString("AvailableCurvesStr"); + _availableCurvesFld = fc->addString("AvailableCurves"); + _availableCurvesFld->setStringValue(""); + + + this->activateAttachments(); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void UMDsplitCurveList::handleNotification (Field *field) +{ + ML_TRACE_IN("UMDsplitCurveList::handleNotification ()"); + // Handle changes of module parameters and connectors here. + + // some status variable + bool inputOK = false; + + // check if input is available + if (_inputCurveListFld->getBaseValue() != NULL) + { + // initially clear the list of curves + _availableCurvesStrFld->setStringValue(""); + _availableCurves.clear(); + _availableCurvesVec.clear(); + + // if the input is of type "CurveList" .... + if (strcmpi(_inputCurveListFld->getBaseValue()->getTypeIdName(),"CurveList")==0) + { + // set status + inputOK = true; + + // get the data + _inputCurveList = (ml::CurveList *)_inputCurveListFld->getBaseValue(); + + // run over the curves + for (int i=0; i<_inputCurveList->getNumCurves(); i++) + { + // add a "," as separator + if (i!=0) _availableCurves.append(","); + + // append the strings to both: the output string and a similar string-vector + //_availableCurves.append(asString(i+1,0)); + //_availableCurves.append(": "); + _availableCurves.append(asString(i+1,0) + ": " + _inputCurveList->getCurveList()[i]->getTitle().c_str()); + + _availableCurvesVec.push_back(asString(i+1,0) + ": " + _inputCurveList->getCurveList()[i]->getTitle().c_str()); + } + // assign the string to the field + _availableCurvesStrFld->setStringValue(_availableCurves); + } + } + // clear the list + else _availableCurvesStrFld->setStringValue(""); + + // check again if input is available + if ((_inputCurveListFld->getBaseValue() != NULL) && (_inputCurveList->getNumCurves() > 0) && inputOK) + { + // clear the output curveLists and the curveData + _curveList1.getCurveList().clear(); + _curveList2.getCurveList().clear(); + _curveData.clear(); + + // status and index variables + int selectionIdx=0; + bool found = false; + + // run over the available curves ... + for (int i=0; i<_availableCurvesVec.size(); i++) + { + // check which curve has been selected + if (_availableCurvesVec[i].compare(_availableCurvesFld->getStringValue()) == 0) + { + // remember its index and set status to true + selectionIdx = i; + found = true; + } + // as long as the selected curve was not found in the list, push all curves into curveList1 + if (!found) _curveList1.getCurveList().push_back(_inputCurveList->getCurveList()[i]); + + // after the selected curve has been found, push all curves into curveList2 + else if (found && (i>selectionIdx)) _curveList2.getCurveList().push_back(_inputCurveList->getCurveList()[i]); + } + // assign the selected curve as single output + _curveData = *_inputCurveList->getCurveList()[selectionIdx]; + + // do the output to the fields + _curveList1Fld->setBaseValue(&_curveList1); + _curveList2Fld->setBaseValue(&_curveList2); + _curveDataFld->setBaseValue(&_curveData); + } +} + +//---------------------------------------------------------------------------------- +//! Update internal module state after load or clone and enable notification handling again. +//---------------------------------------------------------------------------------- +void UMDsplitCurveList::activateAttachments () +{ + ML_TRACE_IN("UMDsplitCurveList::activateAttachments ()"); + + // Update members to new field state here. + // Call super class functionality to enable notification handling again. + BaseOp::activateAttachments (); +} + + + +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.h =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.h (rev 0) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.h 2009-10-01 09:08:50 UTC (rev 207) @@ -0,0 +1,74 @@ +//---------------------------------------------------------------------------------- +//! The ML module class UMDsplitCurveList. +/*! +// \file mlUMDsplitCurveList.h +// \author Tobias M\xF6nch +// \date 2009-08-05 +// +// Extracts single curves and several curves from a CureList object. +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlUMDsplitCurveList_H +#define __mlUMDsplitCurveList_H + + +// Local includes +#include "UMDsplitCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" +#include "mlCurveData.h" +#include "mlCurveList.h" + +ML_START_NAMESPACE + + +//! Extracts single curves and several curves from a CureList object. +class UMDSPLITCURVELIST_EXPORT UMDsplitCurveList : public BaseOp +{ +public: + + //! Constructor. + UMDsplitCurveList (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + + //! Update internal module state after load or clone and enable notification handling again. + virtual void activateAttachments (); + + //@} + +private: + + // input and output fields + BaseField *_inputCurveListFld; + BaseField *_curveList1Fld; + BaseField *_curveList2Fld; + BaseField *_curveDataFld; + + // the internal data + CurveData _curveData; + CurveList _curveList1; + CurveList _curveList2; + CurveList *_inputCurveList; + + // GUI element(s) + StringField *_availableCurvesFld; + StringField *_availableCurvesStrFld; + + // for handling the curve names + std::vector<std::string> _availableCurvesVec; + std::string _availableCurves; + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(UMDsplitCurveList) +}; + + +ML_END_NAMESPACE + +#endif // __mlUMDsplitCurveList_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tm...@us...> - 2009-10-08 10:47:40
|
Revision: 209 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=209&view=rev Author: tmoench Date: 2009-10-08 10:47:25 +0000 (Thu, 08 Oct 2009) Log Message: ----------- further fixes to remove warnings and changes in the example network Modified Paths: -------------- trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp Modified: trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab 2009-10-08 08:25:24 UTC (rev 208) +++ trunk/Community/General/Modules/ML/UMDsplitCurveList/networks/UMDsplitCurveListExample.mlab 2009-10-08 10:47:25 UTC (rev 209) @@ -2,6 +2,200 @@ network { watchlist = "" } +module WEMInfo { + internal { + frame = "37 109 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "535 590 464 326" + sizeHint = "464 326" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "1729 290 307 440" + sizeHint = "307 440" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInfo3 + isProcessing = FALSE + elapsedTime = 0.03099999949 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + listenToFinishingNotifications = TRUE + listenToRepaintNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + WEMs = "4@" + selectedWEMs = "" + informationFieldsValid = TRUE + numNodes = 3980 + numEdges = 12000 + numFaces = 8000 + uniqueId = 4 + patchType = Triangles + hasEdges = TRUE + surfaceArea = 9088.235352 + surfaceVolume = 11417.07031 + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.266667008399963 0.266667008399963 0.266667008399963" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.0666669979691505 0.0666669979691505 0.0666669979691505" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBox = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + center = "32.18994140625 32.51465225219727 12.5" + minimum = "0.3798865675926208 1.029304265975952 0" + maximum = "64 64 25" + size = "63.62011343240738 62.97069573402405 25" + radius = 46.46995926 + mainAxisCenter = "36.70425415039062 31.73256301879883 11.25884342193604" + xMainAxis = "0.8256326913833618 0.5631536841392517 -0.0344751663506031" + yMainAxis = "-0.5586679577827454 0.8245398998260498 0.08957722038030624" + zMainAxis = "0.07887189090251923 -0.05469771102070808 0.995383083820343" + xExt = 76.63206482 + yExt = 76.86981964 + zExt = 28.9629631 + primitiveValueLists = "LUT,Quadric Error,Face Area,Edge Length,Face Quality,Node Curvature,Node Valence" + selectedPrimitiveValueList = "Face Quality" + primitiveValueListValid = TRUE + minPrimitiveValueList = 0 + maxPrimitiveValueList = 99.99987030029297 + meanPrimitiveValueList = 91.96286586308479 + primitiveValueListUnits = % + edgeLengthUnits = mm + faceAreaUnits = mm2 + curveScaleFactor = 1 + selectedTab = 2 + } +} +module WEMInfo { + internal { + frame = "-67 117 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "535 590 466 326" + sizeHint = "466 326" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "1729 290 307 440" + sizeHint = "307 440" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInfo2 + isProcessing = FALSE + elapsedTime = 0.04699999839 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + listenToFinishingNotifications = TRUE + listenToRepaintNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + WEMs = "4@" + selectedWEMs = "" + informationFieldsValid = TRUE + numNodes = 3980 + numEdges = 12000 + numFaces = 8000 + uniqueId = 4 + patchType = Triangles + hasEdges = TRUE + surfaceArea = 9088.235352 + surfaceVolume = 11417.07031 + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.266667008399963 0.266667008399963 0.266667008399963" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.0666669979691505 0.0666669979691505 0.0666669979691505" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBox = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + center = "32.18994140625 32.51465225219727 12.5" + minimum = "0.3798865675926208 1.029304265975952 0" + maximum = "64 64 25" + size = "63.62011343240738 62.97069573402405 25" + radius = 46.46995926 + mainAxisCenter = "36.70425415039062 31.73256301879883 11.25884342193604" + xMainAxis = "0.8256326913833618 0.5631536841392517 -0.0344751663506031" + yMainAxis = "-0.5586679577827454 0.8245398998260498 0.08957722038030624" + zMainAxis = "0.07887189090251923 -0.05469771102070808 0.995383083820343" + xExt = 76.63206482 + yExt = 76.86981964 + zExt = 28.9629631 + primitiveValueLists = "LUT,Quadric Error,Face Area,Edge Length,Face Quality,Node Curvature,Node Valence" + selectedPrimitiveValueList = "Edge Length" + primitiveValueListValid = TRUE + minPrimitiveValueList = 0 + maxPrimitiveValueList = 8.441550254821777 + meanPrimitiveValueList = 1.72643531275789 + primitiveValueListUnits = mm + edgeLengthUnits = mm + faceAreaUnits = mm2 + curveScaleFactor = 1 + selectedTab = 2 + } +} module UMDsplitCurveList { internal { frame = "-187 -67 136 56" @@ -10,15 +204,15 @@ window _default { geometry = "118 141 500 31" sizeHint = "500 31" - wasOpen = yes + wasOpen = no wasActive = no } } } fields { instanceName = UMDsplitCurveList - AvailableCurvesStr = "1: Face Area,2: Face Area" - AvailableCurves = "2: Face Area" + AvailableCurvesStr = "1: Face Area,2: Face Area,3: Edge Length,4: Face Quality" + AvailableCurves = "3: Edge Length" } } module LocalImage { @@ -29,7 +223,7 @@ fields { instanceName = LocalImage name = $(DemoDataPath)/Bone.tiff - trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + trueName = "C:/Program Files/MeVisLab2.0VC9-64/Packages/MeVisLab/Resources/DemoData/Bone.tiff" autoLoad = TRUE status = "File open" } @@ -51,7 +245,7 @@ fields { instanceName = WEMIsoSurface isProcessing = FALSE - elapsedTime = 0.2809999883 + elapsedTime = 0.5929999948 id = 0 autoApply = TRUE autoUpdate = TRUE @@ -131,7 +325,7 @@ fields { instanceName = WEMInfo isProcessing = FALSE - elapsedTime = 0.07800000161 + elapsedTime = 0.03099999949 autoApply = TRUE autoUpdate = TRUE autoClear = TRUE @@ -147,7 +341,7 @@ uniqueId = 2 patchType = Triangles hasEdges = TRUE - surfaceArea = 9452.926758 + surfaceArea = 9452.927734 surfaceVolume = 11593.98047 label = "" description = "" @@ -186,11 +380,11 @@ maximum = "64 64 25" size = "64 63.01695477962494 25" radius = 46.61581421 - mainAxisCenter = "37.00667572021484 31.91140174865723 11.19961833953857" - xMainAxis = "0.8188340067863464 0.5700684189796448 -0.06732727587223053" + mainAxisCenter = "37.00667190551758 31.91140556335449 11.19961738586426" + xMainAxis = "0.8188340067863464 0.5700684189796448 -0.06732726097106934" yMainAxis = "-0.5646404027938843 0.8210079073905945 0.08442250639200211" - zMainAxis = "0.1034028306603432 -0.03111230954527855 0.994152843952179" - xExt = 76.54521942 + zMainAxis = "0.103402815759182 -0.03111232072114944 0.994152843952179" + xExt = 76.54521179 yExt = 77.21954346 zExt = 29.9910202 primitiveValueLists = "LUT,Edge Length,Face Area,Face Quality,Node Curvature,Node Valence" @@ -198,7 +392,7 @@ primitiveValueListValid = TRUE minPrimitiveValueList = 0 maxPrimitiveValueList = 1.142393827438354 - meanPrimitiveValueList = 0.35443971761418 + meanPrimitiveValueList = 0.3544397210796681 primitiveValueListUnits = mm2 edgeLengthUnits = mm faceAreaUnits = mm2 @@ -222,10 +416,10 @@ fields { instanceName = Diagram2D minX = 0 - maxX = 13 + maxX = 9 autoRangeX = TRUE minY = 0 - maxY = 47.28749847 + maxY = 99.92875671 autoRangeY = TRUE axisColor = "1 1 1" axisRotation = LeftBottom @@ -258,8 +452,8 @@ shift = IGNORED ctrl = IGNORED alt = IGNORED - mousePosX = -0.9825582504 - mousePosY = 53.12361526 + mousePosX = -0.6802326441 + mousePosY = 53.3061676 mousePosValid = TRUE curveSelection = Diagram selectionTolerance = 5 @@ -276,7 +470,7 @@ moduleGroupName = "" windows { window _viewer { - geometry = "675 102 400 400" + geometry = "978 171 400 400" sizeHint = "400 400" wasOpen = yes wasActive = no @@ -331,7 +525,7 @@ fields { instanceName = WEMInfo1 isProcessing = FALSE - elapsedTime = 0.03200000152 + elapsedTime = 0.01600000076 autoApply = TRUE autoUpdate = TRUE autoClear = TRUE @@ -347,8 +541,8 @@ uniqueId = 4 patchType = Triangles hasEdges = TRUE - surfaceArea = 9087.744141 - surfaceVolume = 11418.16016 + surfaceArea = 9088.235352 + surfaceVolume = 11417.07031 label = "" description = "" show = TRUE @@ -386,19 +580,19 @@ maximum = "64 64 25" size = "63.62011343240738 62.97069573402405 25" radius = 46.46995926 - mainAxisCenter = "36.68818664550781 31.71071624755859 11.26501941680908" - xMainAxis = "0.8260845541954041 0.5626350045204163 -0.03203367441892624" - yMainAxis = "-0.5583527684211731 0.8248476982116699 0.088703952729702" - zMainAxis = "0.07633084803819656 -0.05539087951183319 0.9955427646636963" - xExt = 76.63578033 - yExt = 76.85345459 - zExt = 28.82315826 + mainAxisCenter = "36.70425415039062 31.73256301879883 11.25884342193604" + xMainAxis = "0.8256326913833618 0.5631536841392517 -0.0344751663506031" + yMainAxis = "-0.5586679577827454 0.8245398998260498 0.08957722038030624" + zMainAxis = "0.07887189090251923 -0.05469771102070808 0.995383083820343" + xExt = 76.63206482 + yExt = 76.86981964 + zExt = 28.9629631 primitiveValueLists = "LUT,Quadric Error,Edge Length,Face Area,Face Quality,Node Curvature,Node Valence" selectedPrimitiveValueList = "Face Area" primitiveValueListValid = TRUE minPrimitiveValueList = 0 - maxPrimitiveValueList = 12.19644355773926 - meanPrimitiveValueList = 1.135967058496957 + maxPrimitiveValueList = 8.992372512817383 + meanPrimitiveValueList = 1.136028095684553 primitiveValueListUnits = mm2 edgeLengthUnits = mm faceAreaUnits = mm2 @@ -620,7 +814,7 @@ fields { instanceName = WEMReducePolygons isProcessing = FALSE - elapsedTime = 1.281000018 + elapsedTime = 1.980999947 id = 0 autoApply = TRUE autoUpdate = TRUE @@ -666,7 +860,7 @@ modifyAttributes = FALSE targetReduction = 70 smooth = TRUE - numEdgeCollapses = 9101 + numEdgeCollapses = 9097 reduction = 70 useExpertMode = FALSE vertexPlacementMode = Middle @@ -749,7 +943,7 @@ window _viewer { geometry = "598 535 566 400" sizeHint = "400 400" - wasOpen = yes + wasOpen = no wasActive = no } } @@ -917,11 +1111,13 @@ } } connections { + WEMInfo3.inWEM = WEMReducePolygons.outWEM + WEMInfo2.inWEM = WEMReducePolygons.outWEM UMDsplitCurveList.inCurveList = CatCurves.outCurveList WEMIsoSurface.input0 = Subimage.output0 WEMInfo.inWEM = WEMIsoSurface.outWEM Diagram2D.inStylePalette = StylePalette.outStylePalette - Diagram2D.inCurveList = UMDsplitCurveList.outCurveData + Diagram2D.inCurveList = UMDsplitCurveList.outCurveList1 Diagram2D.diagramTitleString = WEMInfo.selectedPrimitiveValueList SoRenderArea.children = Diagram2D.outNode WEMInfo1.inWEM = WEMReducePolygons.outWEM @@ -929,6 +1125,8 @@ WEMInfo1.selectedPrimitiveValueList = WEMInfo.selectedPrimitiveValueList CatCurves.inCurve1 = WEMInfo.outputCurveData CatCurves.inCurve2 = WEMInfo1.outputCurveData + CatCurves.inCurve3 = WEMInfo2.outputCurveData + CatCurves.inCurve4 = WEMInfo3.outputCurveData Subimage.input0 = LocalImage.outImage WEMReducePolygons.inWEM = WEMIsoSurface.outWEM SoWEMRenderer.inWEM = WEMIsoSurface.outWEM Modified: trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp =================================================================== --- trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp 2009-10-08 08:25:24 UTC (rev 208) +++ trunk/Community/General/Sources/ML/UMDsplitCurveList/mlUMDsplitCurveList.cpp 2009-10-08 10:47:25 UTC (rev 209) @@ -25,7 +25,6 @@ return s.str() ; } - //! Implements code for the runtime type system of the ML ML_BASEOP_CLASS_SOURCE(UMDsplitCurveList, BaseOp); @@ -110,7 +109,7 @@ else _availableCurvesStrFld->setStringValue(""); // check again if input is available - if ((_inputCurveListFld->getBaseValue() != NULL) && (_inputCurveList->getNumCurves() > 0) && inputOK) + if (((field == _availableCurvesFld) ||(field == _inputCurveListFld)) && (_inputCurveListFld->getBaseValue() != NULL) && (_inputCurveList->getNumCurves() > 0) && inputOK) { // clear the output curveLists and the curveData _curveList1.getCurveList().clear(); @@ -122,7 +121,7 @@ bool found = false; // run over the available curves ... - for (int i=0; i<_availableCurvesVec.size(); i++) + for (unsigned int i=0; i<_availableCurvesVec.size(); i++) { // check which curve has been selected if (_availableCurvesVec[i].compare(_availableCurvesFld->getStringValue()) == 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bar...@us...> - 2009-10-15 07:50:55
|
Revision: 210 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=210&view=rev Author: bartdedobbelaer Date: 2009-10-15 07:50:46 +0000 (Thu, 15 Oct 2009) Log Message: ----------- - Added support for strings, vectors and matrices. No checking is done on the dimensions of the returned vectors and matrices though. This is still to-do. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2009-10-08 10:47:25 UTC (rev 209) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2009-10-15 07:50:46 UTC (rev 210) @@ -79,37 +79,111 @@ Category Scalars{ Horizontal { Vertical { - //Box "Input scalars" { - Horizontal { - Field scalarName0 {title = "Name:" expandX = yes} - Field scalar0 {title = "Value:" expandX = yes} - } - Horizontal { - Field scalarName1 {title = "Name:" expandX = yes} - Field scalar1 {title = "Value:" expandX = yes} - } - Horizontal { - Field scalarName2 {title = "Name:" expandX = yes} - Field scalar2 {title = "Value:" expandX = yes} - } - //} - //Box "Output scalars" { - Horizontal { - Field scalarName3 {title = "Name:" expandX = yes} - Field scalar3 {title = "Value:" expandX = yes} - } - Horizontal { - Field scalarName4 {title = "Name:" expandX = yes} - Field scalar4 {title = "Value:" expandX = yes} - } - Horizontal { - Field scalarName5 {title = "Name:" expandX = yes} - Field scalar5 {title = "Value:" expandX = yes} - } - //} + Horizontal { + Field scalarName0 {title = "Name:" expandX = yes} + Field scalar0 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName1 {title = "Name:" expandX = yes} + Field scalar1 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName2 {title = "Name:" expandX = yes} + Field scalar2 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName3 {title = "Name:" expandX = yes} + Field scalar3 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName4 {title = "Name:" expandX = yes} + Field scalar4 {title = "Value:" expandX = yes} + } + Horizontal { + Field scalarName5 {title = "Name:" expandX = yes} + Field scalar5 {title = "Value:" expandX = yes} + } } } } + Category Strings { + Horizontal { + Vertical { + Horizontal { + Field stringName0 {title = "Name:" expandX = yes} + Field string0 {title = "Value:" expandX = yes} + } + Horizontal { + Field stringName1 {title = "Name:" expandX = yes} + Field string1 {title = "Value:" expandX = yes} + } + Horizontal { + Field stringName2 {title = "Name:" expandX = yes} + Field string2 {title = "Value:" expandX = yes} + } + Horizontal { + Field stringName3 {title = "Name:" expandX = yes} + Field string3 {title = "Value:" expandX = yes} + } + Horizontal { + Field stringName4 {title = "Name:" expandX = yes} + Field string4 {title = "Value:" expandX = yes} + } + Horizontal { + Field stringName5 {title = "Name:" expandX = yes} + Field string5 {title = "Value:" expandX = yes} + } + } + } + } + Category Vectors{ + Horizontal { + Vertical { + Horizontal { + Field vectorName0 {title = "Name:" expandX = yes} + Field vector0 {title = "Value:" expandX = yes} + } + Horizontal { + Field vectorName1 {title = "Name:" expandX = yes} + Field vector1 {title = "Value:" expandX = yes} + } + Horizontal { + Field vectorName2 {title = "Name:" expandX = yes} + Field vector2 {title = "Value:" expandX = yes} + } + Horizontal { + Field vectorName3 {title = "Name:" expandX = yes} + Field vector3 {title = "Value:" expandX = yes} + } + Horizontal { + Field vectorName4 {title = "Name:" expandX = yes} + Field vector4 {title = "Value:" expandX = yes} + } + Horizontal { + Field vectorName5 {title = "Name:" expandX = yes} + Field vector5 {title = "Value:" expandX = yes} + } + } + } + } + Category Matrices { + Horizontal { + Vertical { + Vertical { + Field matrixName0 {title = "Name:" expandX = yes} + TextView matrix0 {title = "" expandX = yes autoApply = Yes} + } + Vertical { + Field matrixName1 {title = "Name:" expandX = yes} + TextView matrix1 {title = "" expandX = yes autoApply = Yes} + } + Vertical { + Field matrixName2 {title = "Name:" expandX = yes} + TextView matrix2 {title = "" expandX = yes autoApply = Yes} + } + } + } + } } // Window } // MLModule MatlabScriptWrapper Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2009-10-08 10:47:25 UTC (rev 209) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2009-10-15 07:50:46 UTC (rev 210) @@ -113,6 +113,42 @@ (_scalarNameFld[5] = fields->addString("scalarName5"))->setStringValue("scalar5"); (_scalarFld[5] = fields->addDouble("scalar5"))->setDoubleValue(0.0); + // Set string name and value fields. + (_stringNameFld[0] = fields->addString("stringName0"))->setStringValue("string0"); + (_stringFld[0] = fields->addString("string0"))->setStringValue(""); + (_stringNameFld[1] = fields->addString("stringName1"))->setStringValue("string1"); + (_stringFld[1] = fields->addString("string1"))->setStringValue(""); + (_stringNameFld[2] = fields->addString("stringName2"))->setStringValue("string2"); + (_stringFld[2] = fields->addString("string2"))->setStringValue(""); + (_stringNameFld[3] = fields->addString("stringName3"))->setStringValue("string3"); + (_stringFld[3] = fields->addString("string3"))->setStringValue(""); + (_stringNameFld[4] = fields->addString("stringName4"))->setStringValue("string4"); + (_stringFld[4] = fields->addString("string4"))->setStringValue(""); + (_stringNameFld[5] = fields->addString("stringName5"))->setStringValue("string5"); + (_stringFld[5] = fields->addString("string5"))->setStringValue(""); + + // Set vector name and value fields. + (_vectorNameFld[0] = fields->addString("vectorName0"))->setStringValue("vector0"); + (_vectorFld[0] = fields->addVec4f("vector0"))->setStringValue("0 0 0 0"); + (_vectorNameFld[1] = fields->addString("vectorName1"))->setStringValue("vector1"); + (_vectorFld[1] = fields->addVec4f("vector1"))->setStringValue("0 0 0 0"); + (_vectorNameFld[2] = fields->addString("vectorName2"))->setStringValue("vector2"); + (_vectorFld[2] = fields->addVec4f("vector2"))->setStringValue("0 0 0 0"); + (_vectorNameFld[3] = fields->addString("vectorName3"))->setStringValue("vector3"); + (_vectorFld[3] = fields->addVec4f("vector3"))->setStringValue("0 0 0 0"); + (_vectorNameFld[4] = fields->addString("vectorName4"))->setStringValue("vector4"); + (_vectorFld[4] = fields->addVec4f("vector4"))->setStringValue("0 0 0 0"); + (_vectorNameFld[5] = fields->addString("vectorName5"))->setStringValue("vector5"); + (_vectorFld[5] = fields->addVec4f("vector5"))->setStringValue("0 0 0 0"); + + // Set matrix name and value fields. + (_matrixNameFld[0] = fields->addString("matrixName0"))->setStringValue("matrix0"); + (_matrixFld[0] = fields->addMatrix("matrix0"))->setStringValue("1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1"); + (_matrixNameFld[1] = fields->addString("matrixName1"))->setStringValue("matrix1"); + (_matrixFld[1] = fields->addMatrix("matrix1"))->setStringValue("1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1"); + (_matrixNameFld[2] = fields->addString("matrixName2"))->setStringValue("matrix2"); + (_matrixFld[2] = fields->addMatrix("matrix2"))->setStringValue("1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1"); + //! Reactivate calls of handleNotification on field changes. handleNotificationOn(); @@ -215,6 +251,12 @@ _copyInputImageDataToMatlab(); // Copy scalar values to matlab. _copyInputScalarsToMatlab(); + // Copy string values to matlab. + _copyInputStringsToMatlab(); + // Copy vector values to matlab. + _copyInputVectorsToMatlab(); + // Copy matrix values to matlab. + _copyInputMatricesToMatlab(); // Insert at the end of the script variable to proof execution status @@ -255,7 +297,43 @@ _scalarFld[k]->notifyAttachments(); } } + // Get strings back from matlab. First store the current strings so that + // we can check if they change. A notification is only sent upon change. + std::string tmpstrings[6]; + for(int k=0; k<6; ++k) { + tmpstrings[k] = _stringFld[k]->getStringValue(); + } + _getStringsBackFromMatlab(); + for(int k=0; k<6; ++k) { + if(tmpstrings[k] == _stringFld[k]->getStringValue()) { + _stringFld[k]->notifyAttachments(); + } + } + // Get vectors back from matlab. First store the current vectors so that + // we can check if they change. A notification is only sent upon change. + for(int k=0; k<6; ++k) { + tmpstrings[k] = _vectorFld[k]->getStringValue(); + } + _getVectorsBackFromMatlab(); + for(int k=0; k<6; ++k) { + if(tmpstrings[k] == _vectorFld[k]->getStringValue()) { + _vectorFld[k]->notifyAttachments(); + } + } + + // Get matrices back from matlab. First store the current matrices so that + // we can check if they change. A notification is only sent upon change. + for(int k=0; k<3; ++k) { + tmpstrings[k] = _matrixFld[k]->getStringValue(); + } + _getMatricesBackFromMatlab(); + for(int k=0; k<3; ++k) { + if(tmpstrings[k] == _matrixFld[k]->getStringValue()) { + _matrixFld[k]->notifyAttachments(); + } + } + // Notify image attachments that are new images calculated so that they // update themselves and call the calcOutSubImage() getOutField(0)->notifyAttachments(); @@ -786,6 +864,166 @@ temp = NULL; } +//! Copies string values to matlab. +void MatlabScriptWrapper::_copyInputStringsToMatlab() +{ + // Check if Matlab is started. + if (!_checkMatlabIsStarted()) + { + std::cerr << "_copyInputStringsToMatlab(): Cannot find matlab engine!" << std::endl << std::flush; + return; + } + // Internal loop. + MLint i = 0; + // Compose string that contains input scalars. + std::ostringstream execute; + // Put only input scalars into matlab. + for(i=0; i<6; i++) + { + execute<<_stringNameFld[i]->getStringValue()<<"='"<<(_stringFld[i]->getStringValue())<<"'\n"; + } + // Execute string and write input scalars into matlab. + engEvalString(m_pEngine, execute.str().c_str()); +} + +//! Copies string values from matlab. +void MatlabScriptWrapper::_getStringsBackFromMatlab() +{ + // Check if Matlab is started. + if (!_checkMatlabIsStarted()) + { + std::cerr << "_getStringsBackFromMatlab(): Cannot finding matlab engine!" << std::endl << std::flush; + return; + } + + // Internal loop. + mxArray *temp = NULL; + int tempsize = 0; + char *fieldVal; + // Get only output scalars. + for(MLint i=0; i<6; i++) + { + temp = engGetVariable(m_pEngine, (_stringNameFld[i]->getStringValue()).c_str()); + if(temp!=NULL) + { + tempsize = mxGetN(temp)+1; + ML_CHECK_NEW(fieldVal,char[tempsize]); + mxGetString(temp,fieldVal,tempsize); + _stringFld[i]->setStringValue(fieldVal); + ML_DELETE(fieldVal); + } + } + mxDestroyArray(temp); + temp = NULL; +} + +//! Copy input vectors to matlab. +void MatlabScriptWrapper::_copyInputVectorsToMatlab() +{ + // Proof if Matlab is started. + if (!_checkMatlabIsStarted()) + { + std::cerr << "_copyInputVectorsToMatlab(): Cannot finding matlab engine!" << std::endl << std::flush; + return; + } + // Internal loop. + MLint i = 0; + // Compose string that contains input vectors. + std::ostringstream execute; + // Put only input vectors into matlab. + for(i=0; i<6; i++) + { + execute<<_vectorNameFld[i]->getStringValue()<<"=["; + + vec4 vec = _vectorFld[i]->getVec4fValue(); + execute<<vec[0]<<","<<vec[1]<<","<<vec[2]<<","<<vec[3]; + execute<<"];"; + } + // Execute string and write input vectors into matlab. + engEvalString(m_pEngine, execute.str().c_str()); +} + +//! Copies vector values from matlab. +void MatlabScriptWrapper::_getVectorsBackFromMatlab() +{ + // Check if Matlab is started. + if (!_checkMatlabIsStarted()) + { + std::cerr << "_getVectorssBackFromMatlab(): Cannot finding matlab engine!" << std::endl << std::flush; + return; + } + + // Internal loop. + mxArray *temp = NULL; + // Get only output vectors. + for(MLint i=0; i<6; i++) + { + temp = engGetVariable(m_pEngine, (_vectorNameFld[i]->getStringValue()).c_str()); + if(temp!=NULL) + { + double *fieldVal = static_cast<double*>(mxGetPr(temp)); + _vectorFld[i]->setVec4fValue(vec4(fieldVal[0],fieldVal[1],fieldVal[2],fieldVal[3])); + } + } + mxDestroyArray(temp); + temp = NULL; +} + +//! Copy input matrices to matlab. +void MatlabScriptWrapper::_copyInputMatricesToMatlab() +{ + // Proof if Matlab is started. + if (!_checkMatlabIsStarted()) + { + std::cerr << "_copyInputMatricesToMatlab(): Cannot finding matlab engine!" << std::endl << std::flush; + return; + } + // Internal loop. + MLint i = 0; + // Compose string that contains input matrices. + std::ostringstream execute; + // Put only input matrices into matlab. + for(i=0; i<3; i++) + { + execute<<_matrixNameFld[i]->getStringValue()<<"=["; + + mat4 mat = _matrixFld[i]->getMatrixValue(); + execute<<mat[0][0]<<","<<mat[1][0]<<","<<mat[2][0]<<","<<mat[3][0]<<";"; + execute<<mat[0][1]<<","<<mat[1][1]<<","<<mat[2][1]<<","<<mat[3][1]<<";"; + execute<<mat[0][2]<<","<<mat[1][2]<<","<<mat[2][2]<<","<<mat[3][2]<<";"; + execute<<mat[0][3]<<","<<mat[1][3]<<","<<mat[2][3]<<","<<mat[3][3]; + execute<<"];"; + } + // Execute string and write input matrices into matlab. + engEvalString(m_pEngine, execute.str().c_str()); +} + +//! Copies matrix values from matlab. +void MatlabScriptWrapper::_getMatricesBackFromMatlab() +{ + // Check if Matlab is started. + if (!_checkMatlabIsStarted()) + { + std::cerr << "_getMatricesBackFromMatlab(): Cannot finding matlab engine!" << std::endl << std::flush; + return; + } + + // Internal loop. + mxArray *temp = NULL; + // Get only output matrices. + for(MLint i=0; i<3; i++) + { + temp = engGetVariable(m_pEngine, (_matrixNameFld[i]->getStringValue()).c_str()); + if(temp!=NULL) + { + double *fieldVal = static_cast<double*>(mxGetPr(temp)); + _matrixFld[i]->setMatrixValue(mat4(fieldVal)); + } + } + mxDestroyArray(temp); + temp = NULL; +} + //! Check if Matlab is started. bool MatlabScriptWrapper::_checkMatlabIsStarted() { @@ -810,6 +1048,17 @@ clearString << _scalarNameFld[i]->getStringValue() << " "; } + // Clear strings + for(int i=0; i<6; i++) { + clearString << _stringNameFld[i]->getStringValue() << " "; + } + + // Clear matrices + for(int i=0; i<3; i++) { + clearString << _matrixNameFld[i]->getStringValue() << " "; + } + + // Clear input images for(int i=0; i<3; i++) { clearString << _inDataNameFld[i]->getStringValue() << " "; Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2009-10-08 10:47:25 UTC (rev 209) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2009-10-15 07:50:46 UTC (rev 210) @@ -121,6 +121,18 @@ bool _checkMatlabIsStarted(); //! Clear all variables that have been put in the Matlab workspace. void _clearAllVariables(); + //! Copies string values to matlab. + void _copyInputStringsToMatlab(); + //! Copies string values from matlab. + void _getStringsBackFromMatlab(); + //! Copies vector values to matlab. + void _copyInputVectorsToMatlab(); + //! Copies vector values from matlab. + void _getVectorsBackFromMatlab(); + //! Copies matrix values to matlab. + void _copyInputMatricesToMatlab(); + //! Copies matrix values from matlab. + void _getMatricesBackFromMatlab(); // ---------------------------------------------------------- //@{ \name Module field declarations // ---------------------------------------------------------- @@ -167,6 +179,21 @@ StringField *_scalarNameFld[6]; //@} + //{@ String values. + StringField *_stringFld[6]; + StringField *_stringNameFld[6]; + //@} + + //{@ Matrix values. + Vec4fField *_vectorFld[6]; + StringField *_vectorNameFld[6]; + //@} + + //{@ Matrix values. + MatrixField *_matrixFld[3]; + StringField *_matrixNameFld[3]; + //@} + //! Implements interface for the runtime type system of the ML. ML_BASEOP_CLASS_HEADER(MatlabScriptWrapper) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bar...@us...> - 2009-12-10 12:49:44
|
Revision: 220 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=220&view=rev Author: bartdedobbelaer Date: 2009-12-10 12:49:35 +0000 (Thu, 10 Dec 2009) Log Message: ----------- - Added image and voxel dimensions to output of AnalyzeHeader Modified Paths: -------------- trunk/Community/General/Modules/ML/MLImageUtilities/MLImageUtilities.def trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.cpp trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.h Modified: trunk/Community/General/Modules/ML/MLImageUtilities/MLImageUtilities.def =================================================================== --- trunk/Community/General/Modules/ML/MLImageUtilities/MLImageUtilities.def 2009-11-18 13:21:19 UTC (rev 219) +++ trunk/Community/General/Modules/ML/MLImageUtilities/MLImageUtilities.def 2009-12-10 12:49:35 UTC (rev 220) @@ -61,6 +61,9 @@ Field funused1 { edit = NO minLength = 10 } Field funused2 { edit = NO minLength = 10 } Field funused3 { edit = NO minLength = 10 } + Separator { direction = Horizontal } + Field dimensions { edit = NO minLength = 10 } + Field voxelSize { edit = NO minLength = 10 } } } } // MLModule AnalyzeHeader Modified: trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.cpp 2009-11-18 13:21:19 UTC (rev 219) +++ trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.cpp 2009-12-10 12:49:35 UTC (rev 220) @@ -28,10 +28,12 @@ (_filenameFld = getFieldContainer()->addString("filename"))->setStringValue(""); - (_funused1Fld = getFieldContainer()->addFloat("funused1"))->setFloatValue(0.0f); (_funused2Fld = getFieldContainer()->addFloat("funused2"))->setFloatValue(0.0f); (_funused3Fld = getFieldContainer()->addFloat("funused3"))->setFloatValue(0.0f); + + (_dimensionsFld = getFieldContainer()->addVec4f("dimensions"))->setVec4fValue(vec4(0.0f,0.0f,0.0f,0.0f)); + (_voxelSizeFld = getFieldContainer()->addVec4f("voxelSize"))->setVec4fValue(vec4(0.0f,0.0f,0.0f,0.0f)); handleNotificationOn(); } @@ -78,7 +80,7 @@ FILE *file; int nr,i; - unsigned short d[3]; + unsigned short d[8]; bool swapendian; int hdrsize,extents,glmax,glmin,views,vols_added,start_field,field_skip,omax, @@ -89,8 +91,11 @@ unsigned short session_error,unused1,datatypean,bitpix,dim_un0,origin[5]; float pixdim[8],vox_offset,cal_max,cal_min,compressed,verified; - float funused1 = 0.0f, funused2 = 0.0f, funused3 = 0.0f; + for (i = 0;i < 8; i ++) { + d[i] = 0; + pixdim[i] = 0.0f; + } file=fopen(filename,"rb"); @@ -110,16 +115,10 @@ fread(&extents,4,1,file);if (swapendian) swap(&extents,4); fread(&session_error,2,1,file);if (swapendian) swap(&session_error,2); fread(®ular,1,1,file); - fread(&hkey_un0,1,1,file); - - fseek(file,2,SEEK_CUR);//skip two bytes - fread(&d[0],2,1,file);if (swapendian) swap(&d[0],2); - fread(&d[1],2,1,file);if (swapendian) swap(&d[1],2); - fread(&d[2],2,1,file);if (swapendian) swap(&d[2],2); - //dim[0]=d[0]; - //dim[1]=d[1]; - //dim[2]=d[2]; - fseek(file,8,SEEK_CUR);//skip eight bytes + fread(&hkey_un0,1,1,file); + for (i=0;i<8;i++) { + fread(&d[i],2,1,file);if (swapendian) swap(&d[i],2); + } fread(&vox_units[0],4,1,file); fread(&cal_units[0],8,1,file); fread(&unused1,2,1,file);if (swapendian) swap(&unused1,2); @@ -129,9 +128,6 @@ for (i=0;i<8;i++) { fread(&pixdim[i],4,1,file);if (swapendian) swap(&pixdim[i],4); } - //voxdim[0]=pixdim[1]; - //voxdim[1]=pixdim[2]; - //voxdim[2]=pixdim[3]; fread(&vox_offset,4,1,file);if (swapendian) swap(&vox_offset,4); fread(&funused1,4,1,file);if (swapendian) swap(&funused1,4); fread(&funused2,4,1,file);if (swapendian) swap(&funused2,4); @@ -168,14 +164,14 @@ fclose(file); } - _funused1Fld->setFloatValue(funused1); _funused2Fld->setFloatValue(funused2); _funused3Fld->setFloatValue(funused3); + _dimensionsFld->setVec4fValue(vec4(d[1],d[2],d[3],d[4])); + _voxelSizeFld->setVec4fValue(vec4(pixdim[1],pixdim[2],pixdim[3],pixdim[4])); - - } + BaseOp::handleNotification(field); } Modified: trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.h =================================================================== --- trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.h 2009-11-18 13:21:19 UTC (rev 219) +++ trunk/Community/General/Sources/ML/MLImageUtilities/AnalyzeHeader/AnalyzeHeader.h 2009-12-10 12:49:35 UTC (rev 220) @@ -37,6 +37,8 @@ private: StringField *_filenameFld; + Vec4fField *_dimensionsFld; + Vec4fField *_voxelSizeFld; FloatField *_funused1Fld; FloatField *_funused2Fld; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <of...@us...> - 2009-12-14 13:55:40
|
Revision: 221 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=221&view=rev Author: ofriman Date: 2009-12-14 13:55:27 +0000 (Mon, 14 Dec 2009) Log Message: ----------- New module FuzzyConnectedness. Added Paths: ----------- trunk/Community/General/Modules/ML/MLFuzzyConnectedness/ trunk/Community/General/Modules/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.def trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/ trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/MLFuzzyConnectedness.html trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/ trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/FuzzyConnectednessSeeds.png trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/FuzzyConnectednessVoxel.png trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Neighbor.png trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Nodes.png trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Path.png trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/PathStrength.png trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Rho.png trunk/Community/General/Modules/ML/MLFuzzyConnectedness/networks/ trunk/Community/General/Modules/ML/MLFuzzyConnectedness/networks/MLFuzzyConnectednessExample.mlab trunk/Community/General/Sources/ML/MLFuzzyConnectedness/ trunk/Community/General/Sources/ML/MLFuzzyConnectedness/CMIVFuzzyConnectedness.cpp trunk/Community/General/Sources/ML/MLFuzzyConnectedness/CMIVFuzzyConnectedness.h trunk/Community/General/Sources/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.bat trunk/Community/General/Sources/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.pro trunk/Community/General/Sources/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.sh trunk/Community/General/Sources/ML/MLFuzzyConnectedness/MLFuzzyConnectednessInit.cpp trunk/Community/General/Sources/ML/MLFuzzyConnectedness/MLFuzzyConnectednessSystem.h trunk/Community/General/Sources/ML/MLFuzzyConnectedness/gpl.txt trunk/Community/General/Sources/ML/MLFuzzyConnectedness/lgpl.txt trunk/Community/General/Sources/ML/MLFuzzyConnectedness/mlFuzzyConnectedness.cpp trunk/Community/General/Sources/ML/MLFuzzyConnectedness/mlFuzzyConnectedness.h Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.def =================================================================== --- trunk/Community/General/Modules/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.def (rev 0) +++ trunk/Community/General/Modules/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.def 2009-12-14 13:55:27 UTC (rev 221) @@ -0,0 +1,39 @@ +// **InsertLicense** code +//---------------------------------------------------------------------------------- +//! MLFuzzyConnectedness module definitions. +/*! +// \file MLFuzzyConnectedness.def +// \author Markus H\xFCllebrand +// \date 2009-06-12 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule MLFuzzyConnectedness +//---------------------------------------------------------------------------------- +MLModule FuzzyConnectedness { + DLL = "MLFuzzyConnectedness" + + genre = "Fuzzy" + author = "Markus H\xFCllebrand, Chunliang Wang, Ola Friman" + status = "stable" + comment = "Calculates a fuzzy connectedness classification" + keywords = "fuzzy connectedness classification segmentation" + seeAlso = "MarkerToMask" + documentation = "$(LOCAL)/html/MLFuzzyConnectedness.html" + exampleNetwork = "$(LOCAL)/networks/MLFuzzyConnectednessExample.mlab" + + Window { + Vertical { + margin = 5 + Horizontal { + Button startButton { + title = "Start" + } + Field autoUpdate {} + } + } + } +} // MLModule MLFuzzyConnectedness + Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/MLFuzzyConnectedness.def ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/MLFuzzyConnectedness.html =================================================================== --- trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/MLFuzzyConnectedness.html (rev 0) +++ trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/MLFuzzyConnectedness.html 2009-12-14 13:55:27 UTC (rev 221) @@ -0,0 +1,380 @@ +<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + + + + + + + + + + + + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + + + + + + + + + + + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + + + + + + + + + + + + <meta name="Description" content="MeVisLab module help page template"> + + + + + + + + + + + <title>Module Help Page</title> +</head> + + +<body> + + + + + + +<center><a href="#Purpose">Purpose</a> +<a href="#Usage">Usage</a> +<a href="#Details">Details</a> +<a href="#Inputs">Inputs</a> +<a href="#Outputs">Outputs</a> +<a href="#Parameters">Parameters</a> +<a href="#EventInteract">Events&Interaction</a> +<a href="#Example">Example</a> +<a href="#Tips&Tricks">Tips&Tricks</a> +<a href="#KnownBugs">Known +Bugs</a> +<hr width="100%"></center> + + + + + + +<h2>FuzzyConnectedness</h2> + + + + + + +<h3> +<a name="Purpose"></a>Purpose</h3> + + + + + + +<blockquote>Given an input image and an image with seed points, the <span style="font-weight: bold;">FuzzyConnectedness</span> module +calculates a map of connectivities from each voxel to the seed points, +as well as a label image in which each voxel is labeled according to +which seed point it is closest to in the fuzzy connectivity sense. Due +to the definition of fuzzy connectedness (see below), the implemented +algorithm is suited for segmenting or separating bright objects on a +dark background.</blockquote> + + + + + + +<h3> +<a name="Usage"></a>Usage</h3> + + + + + + +<blockquote>A 2D or 3D scalar gray-value image is attached to <span style="font-weight: bold;">input0</span>. +An image of the same size containing different seed regions, +labeled with integer number from 1 to 64, is attached to <span style="font-weight: bold;">input1</span>.<br> + + +As shown in the example network, the <span style="font-weight: bold;">SoView2DMarkerEditor</span> can be used together with the <span style="font-weight: bold;">MarkerToMask</span> module to produce the seed region image. Set the <span style="font-style: italic;">Current Type</span> value in <span style="font-weight: bold;">SoView2DMarkerEditor</span> to values between 1 and 63 to define different seed regions, and use the <span style="font-style: italic;">Marker Type</span> option in the <span style="font-weight: bold;">MarkerToMask</span> module. + + + +</blockquote> + + + + + + +<h3> +<a name="Details"></a>Details</h3> + + + + + + +<blockquote>This module implements the fuzzy connectedness algorithm published in:<br> + + + <br> + + +Xavier Tizon and Örjan Smedby<br> + + + <span style="font-style: italic;">Segmentation with gray-scale connectedness can separate arteries and veins in MRA </span><br> + + +J. Magn. Reson. Imaging 2002; 15:438-445<br> + + + <br> + + + + + +As described in this paper the fuzzy connectedness to given seed regions are calculated. <br> + + + + +A path <img style="width: 19px; height: 19px;" alt="rho" src="images/Rho.png"> between between two voxels u,v is defined as a sequence of distinct voxels,<br> + + + + + <img style="width: 149px; height: 16px;" alt="u=w_0, ... , w_n=v" src="images/Path.png"><br> + +where each voxel in the path is a neighbor to the previous voxel in a +8-neighborhood or 26-neighborhood in 2D and 3D respectively:<br> + + + + + <img style="width: 214px; height: 21px;" alt="w_(n+1) in N(w_i) for 0<= i < n" src="images/Nodes.png">.<br> + + + <br> + + + + +The strength of path <img style="width: 17px; height: 17px;" alt="rho" src="images/Rho.png">is the minimum of the intensity value of the traversed voxels:<br> + + + + + <img style="width: 199px; height: 48px;" alt="S(rho)=min_(w in rho) (g(w))" src="images/PathStrength.png"><br> + + + + + where <span style="font-style: italic;">g</span>(..) represent the voxel intensity. The fuzzy connectedness between a seed region and a +voxel is the maximum strength among all paths to from the region to the voxel:<br> + + + + + <img style="width: 241px; height: 58px;" alt="" src="images/FuzzyConnectednessSeeds.png">.<br> +A connectivity map is calculated for each seed region, and the output +connectivity map is the maximum connectivity over all seed regions. The +label map +indicates to which seed region each voxel belongs.<br> + + + + + +Due to the definition of the connectedness and due to the concurrent +approach, seed points with higher intensity will overweight those +with lower intensities.<br> + + + + + + <br> + + + + + +</blockquote> + + + + + + +<h3> +<a name="Inputs"></a>Inputs</h3> + + + + + + +<blockquote> + <span style="font-weight: bold;">Input0 + </span><span style="font-size: 12pt; font-weight: normal;" lang="EN-US">must +be a scalar volume.<span style="font-weight: bold;"><br> + + +Input1</span> +is a mask of the different seed regions. The seed regions can be +represented by integer values from 1 to 63. Values > 63 in the +mask will be treated as barriers and the propagation will stop from +each side.</span> +</blockquote> + + + + + + +<h3> +<a name="Outputs"></a>Outputs</h3> + + + + + + +<blockquote><span style="font-weight: bold;">Output0</span> +is the concurrent connectivity map. <span style="font-weight: bold;">Output1</span> +is the label map.</blockquote> + + + + + + +<h3> +<a name="Parameters"></a>Parameters</h3> + + + + + + +<blockquote>None<br> + + + + + + +</blockquote> + + + + + + +<h3> +<a name="EventInteract"></a>Events & +Interaction</h3> + + + + + + None + +<h3> +<a name="Example"></a>Example</h3> + + + + + + +<blockquote> + + + + + + <h3><span style="font-size: 12pt; font-weight: normal;" lang="EN-US">See example network.</span></h3> + + + + + + +</blockquote> + + + + + + +<h3> +<a name="Tips&Tricks"></a>Tips & Tricks</h3> + + + + + + +<blockquote>- This module does not support paging. Therefore the complete image has to be stored.<br> + + + + + +- Seed voxels with high intensities will outweight seed voxels with low intensities.</blockquote> + + + + + + +<h3> +<a name="KnownBugs"></a>Known Bugs</h3> + + + + + + +<blockquote>None<br> + + + + + + +</blockquote> + + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/MLFuzzyConnectedness.html ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/FuzzyConnectednessSeeds.png =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/FuzzyConnectednessSeeds.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/FuzzyConnectednessVoxel.png =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/FuzzyConnectednessVoxel.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Neighbor.png =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Neighbor.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Nodes.png =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Nodes.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Path.png =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Path.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/PathStrength.png =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/PathStrength.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Rho.png =================================================================== (Binary files differ) Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/html/images/Rho.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/networks/MLFuzzyConnectednessExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLFuzzyConnectedness/networks/MLFuzzyConnectednessExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLFuzzyConnectedness/networks/MLFuzzyConnectednessExample.mlab 2009-12-14 13:55:27 UTC (rev 221) @@ -0,0 +1,487 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module StylePalette { + internal { + frame = "105 425 96 56" + moduleGroupName = "Seed selection" + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 4 + markerSize2 = 4 + markerSize3 = 4 + markerSize4 = 4 + markerSize5 = 4 + markerSize6 = 4 + markerSize7 = 4 + markerSize8 = 4 + markerSize9 = 4 + markerSize10 = 4 + markerSize11 = 4 + markerSize12 = 4 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module MarkerToMask { + internal { + frame = "113 205 112 56" + moduleGroupName = "Seed selection" + windows { + window _default { + geometry = "542 464 235 141" + sizeHint = "235 141" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MarkerToMask + maskValue = 1 + backgroundValue = 0 + autoUpdate = TRUE + writeMode = MarkerType + outputType = int16 + } +} +module SoView2DMarkerEditor { + internal { + frame = "81 353 160 56" + moduleGroupName = "Seed selection" + windows { + window _default { + geometry = "847 145 435 831" + sizeHint = "435 831" + wasOpen = yes + wasActive = no + } + } + } + fields { + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 0 0" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + depthVisibility = 1 + snapToVoxel = TRUE + snapToSlice = TRUE + currentType = 3 + deleteOnClick = TRUE + addOnClick = TRUE + alphaFactor = 1 + iconFile = $(MLAB_MeVisLab_Standard)/Modules/Resources/Images/markerIcons.tif + internalIconFile = "C:/Program Files (x86)/MeVisLab2.1aVC9-64/Packages/MeVisLab/Standard/Modules/Resources/Images/markerIcons.tif" + useIconFile = FALSE + iconIdx = 0 + selectingOn = TRUE + actOnReleaseOnly = FALSE + editorMode = EDIT_MARKER + colorMode = COLOR_BY_TYPE + textColorMode = COLOR_TEXT + textMode = TEXT_OFF + textPosition = TEXT_POSITION_RIGHT_BELOW + textColor = "1 1 1" + textShadow = TRUE + textFontSize = 12 + showTextOnlyForSelectedMarker = FALSE + cutText = FALSE + maxNumberOfLines = 1 + vectorArrow = VECTOR_END_ARROW + useAntiAlias = FALSE + currentStyleIndex = 4 + depthVectorDrawMode = DRAW_NONE + drawMode = DRAW_MARKER + selectiveDrawing = FALSE + selectionBoxesForCurrentOnly = FALSE + cooperative = FALSE + busy = FALSE + instanceName = SoView2DMarkerEditor + listString = "[(16.5 18.5 0.5) 1 #1, (43.5 27.5 0.5) 2 #2, (54.5 13.5 0.5) 3 #5]" + numItems = 3 + index = 2 + persistent = TRUE + listStringEnable = FALSE + ownsList = TRUE + applySelect = FALSE + id = 5 + name = "" + newName = "" + actionClass = Modify + actionIndex = 2 + actionId = 5 + currentIndex = 2 + overflowMode = None + maxSize = 0 + useInsertTemplate = FALSE + upToDate = TRUE + posXYZ = "54.5 13.5 0.5" + posC = 0 + posT = 0 + posU = 0 + vecXYZ = "0 0 0" + type = 3 + newPosXYZ = "0 0 0" + newPosC = 0 + newPosT = 0 + newPosU = 0 + newVecXYZ = "0 0 0" + newType = 0 + } +} +module View2D { + internal { + frame = "17 265 128 64" + moduleGroupName = "Seed selection" + windows { + window _default { + geometry = "4 30 294 265" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SeedpointViewer + inventorInputOn = TRUE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 1423.000122 + lutWidth = 2365.000244 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = TRUE + maxPrecision = 4 + plane = "0 0 1 0.5" + } + internalFields = "" +} +module FuzzyConnectedness { + internal { + frame = "-123 61 152 56" + moduleGroupName = "" + windows { + window _default { + geometry = "596 466 212 37" + sizeHint = "212 37" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FuzzyConnectedness + autoUpdate = TRUE + } +} +module View2D { + internal { + frame = "-163 -39 120 64" + moduleGroupName = "" + windows { + window _default { + geometry = "6 330 292 283" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = ConnectivityMap + inventorInputOn = FALSE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 1084.000122 + lutWidth = 859.1000366 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + maxPrecision = 4 + plane = "0 0 1 0.5" + } + internalFields = "" +} +module View2D { + internal { + frame = "-43 -39 88 64" + moduleGroupName = "" + windows { + window _default { + geometry = "5 646 293 302" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = LabelMap + inventorInputOn = FALSE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 2.232000113 + lutWidth = 1.169999599 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + maxPrecision = 4 + plane = "0 0 1 0.5" + } + internalFields = "" +} +module LocalImage { + internal { + frame = "-167 517 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "414 413 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files (x86)/MeVisLab2.1aVC9-64/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +connections { + MarkerToMask.input0 = LocalImage.outImage + MarkerToMask.inputXMarkerList = SoView2DMarkerEditor.outXMarkerList + SoView2DMarkerEditor.stylePalette = StylePalette.outStylePalette + SeedpointViewer.inImage = LocalImage.outImage + SeedpointViewer.inInvPreLUT = SoView2DMarkerEditor.self + FuzzyConnectedness.input0 = LocalImage.outImage + FuzzyConnectedness.input1 = MarkerToMask.output0 + ConnectivityMap.inImage = FuzzyConnectedness.output0 + LabelMap.inImage = FuzzyConnectedness.output1 +} +networkModel { + parentItems { + 0 { + MLABNetworkModelItem MLABNetworkModelItemGroup { + uniqueId = 24 + objectName = "Seed selection" + parentUniqueId = 0 + frame = "-8 130 274 376" + color { + r = 45 + g = 226 + b = 226 + a = 40 + } + } + MLABNetworkModelItem MLABNoteItem { + uniqueId = 27 + objectName = "" + parentUniqueId = 0 + frame = "59 -160 254 223" + backgroundColor { + r = 252 + g = 242 + b = 2 + a = 255 + } + text = "Seed points can be set in the SeedpointViewer. Each object may be marked with several seedpoints with the same seed label. The seed label is in this network equal to the CurrentType parameters in the SoView2DMarkerEditor. The numbers 1 to 64 can be used. +The algorithm will start immediately. +The connectivity map and the label map can be seen in the corresponding View2Ds." + titleText = "Fuzzy connectedness example" + isCollapsed = False + } + } + } +} Property changes on: trunk/Community/General/Modules/ML/MLFuzzyConnectedness/networks/MLFuzzyConnectednessExample.mlab ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLFuzzyConnectedness/CMIVFuzzyConnectedness.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLFuzzyConnectedness/CMIVFuzzyConnectedness.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLFuzzyConnectedness/CMIVFuzzyConnectedness.cpp 2009-12-14 13:55:27 UTC (rev 221) @@ -0,0 +1,1244 @@ +/*========================================================================= +Author: Chunliang Wang (chu...@im...) + +Copyright (c) 2007-2009 +Center for Medical Image Science and Visualization (CMIV), +Linköping University, Sweden, http://www.cmiv.liu.se/ +ALL RIGHTS RESERVED + +This image processing plugin from CMIV is free software; +you can redistribute it and/or modify it under the terms of the +GNU Lesser General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) +any later version. + +This image processing plugin is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +=========================================================================*/ + +#include "CMIVFuzzyConnectedness.h" +#include <string.h> // For memset() + +CMIVFuzzyConnectedness::CMIVFuzzyConnectedness() +{ + imageWidth=0; + imageHeight=0; + imageAmount=0; + imageSize=0; + minmumValue=0.0; + inputData=0L; + outputData=0L; + directionOfData=0L; + colorOfData=0L; +} +void CMIVFuzzyConnectedness::setProperty(long width, long height, long amount, float minval) +{ + + imageWidth=width; + imageHeight=height; + imageAmount=amount; + imageSize=width*height; + minmumValue=minval; + +} + +void CMIVFuzzyConnectedness::startShortestPathSearchAsFloat(float* pIn, float* pOut, unsigned char* pMarker, unsigned char* pPointers) +{ + + long i,j,k; + int changed; + float maxvalue; + unsigned char maxcolorindex; + + + long itemp; + long ilong,iwidth,iheight; + long position_i1,position_i2,position_j1,position_j2,position_j3; + + if(!pMarker || !pIn || !pOut || !pPointers) + return; + + + ilong=imageWidth; + iwidth=imageHeight; + iheight=imageAmount; + + + inputData=pIn; + outputData=pOut; + directionOfData=pPointers; + + unsigned char* marker=pMarker; + long long* longmarker=(long long*)marker; + + //initialize + long tsize=imageSize*imageAmount; + + for(i=0;i<tsize;i++) + { + if(*(marker+i)) + { + if(*(marker+i)<0x40) + { + *(directionOfData+i)=*(marker+i)|0x80; + *(outputData+i) = *(inputData+i); + } + else + { + *(directionOfData+i)=0x80; + *(outputData+i) = minmumValue; + } + } + else + { + *(directionOfData+i)=0x00; + *(outputData+i) = minmumValue; + } + + } + + + runFirstRoundFasterWith26Neigbhorhood(); + + //marker will be borrowed for recording which point has been changed + memset(marker,0xff,imageSize*imageAmount/8+1); + + do + { + changed=0; + +//**********************positive direction***************************** + for(i=1;i<iheight-1;i++) + { + position_i1 = (i-1)*imageSize; + position_i2 = i*imageSize; + + for(j=1;j<iwidth-1;j++) + { + position_j1 = (j-1)*ilong; + position_j2 = j*ilong; + position_j3 = (j+1)*ilong; + + for(k=1;k<ilong-1;k++) + { + itemp= position_i2+position_j2+k; + if(!(*(longmarker+(itemp>>6)))) + { + itemp=itemp>>6; + do + { + itemp++; + }while(!(*(longmarker+itemp))); + itemp=itemp<<6; + k=itemp-position_i2-position_j2; + + if(k>=ilong-1) + continue; + + } + + if(!(*(marker+(itemp>>3)))) + { + itemp=itemp>>3; + do + { + itemp++; + }while(!(*(marker+itemp))); + itemp=itemp<<3; + k=itemp-position_i2-position_j2; + + if(k>=ilong-1) + continue; + + } + + if((*(marker+(itemp>>3)))&(0x01<<(itemp&0x07)))//if this point need to be check again + { + if(*(directionOfData + itemp)&0xc0)//if this is a seed point or saturated point + *(marker+(itemp>>3)) = *(marker+(itemp>>3))&(~(0x01<<(itemp&0x07))); + else + { + //1 + itemp=position_i1+position_j1+k-1; + maxvalue=*(outputData+itemp); + maxcolorindex=1; + //2 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=2; + } + //3 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=3; + } + //4 + itemp=position_i1+position_j2+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=4; + } + //5 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=5; + } + + //6 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=6; + } + //7 + itemp=position_i1+position_j3+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=7; + } + //8 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=8; + } + + //9 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=9; + } + //10 + itemp=position_i2+position_j1+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=10; + } + //11 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=11; + } + //12 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=12; + } + //13 + itemp=position_i2+position_j2+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=13; + } + //update g + + itemp=position_i2+position_j2+k; + if(maxvalue>*(outputData+itemp)) + { + if(*(inputData+itemp)>*(outputData+itemp)) + { + //*(outputData+itemp)=min(maxvalue,*(inputData+itemp)); + if(maxvalue>*(inputData+itemp)) + { + *(outputData+itemp)=*(inputData+itemp); + *(directionOfData+itemp)=maxcolorindex|0x40; + } + else + { + *(outputData+itemp)=maxvalue; + *(directionOfData+itemp)=maxcolorindex; + } + + int ii,jj,kk; + itemp=position_i1+position_j1+k-1; + for(ii=0;ii<3;ii++) + { + for(jj=0;jj<3;jj++) + { + for(kk=0;kk<3;kk++) + { + + *(marker+(itemp>>3))|=(0x01<<(itemp&0x07)); + itemp++; + } + itemp=itemp-3+ilong; + + } + itemp=itemp-ilong-ilong-ilong+imageSize; + } + + changed++; + } + + else + *(marker+(itemp>>3))&=(~(0x01<<(itemp&0x07))); + + } + else + *(marker+(itemp>>3))&=(~(0x01<<(itemp&0x07))); + + } + } + } + } + } + +//*******************************negitive direction************************* + for(i=iheight-2;i>0;i--) + { + position_i1 = (i+1)*imageSize; + position_i2 = i*imageSize; + + for(j=iwidth-2;j>0;j--) + { + position_j1 = (j-1)*ilong; + position_j2 = j*ilong; + position_j3 = (j+1)*ilong; + + for(k=ilong-2;k>0;k--) + { + itemp= position_i2+position_j2+k; + + + if(!(*(longmarker+(itemp>>6)))) + { + itemp=itemp>>6; + do + { + itemp--; + }while(!(*(longmarker+itemp))); + + itemp=(itemp<<6)+63; + k=itemp-position_i2-position_j2; + + if(k<1) + continue; + + } + + if(!(*(marker+(itemp>>3)))) + { + itemp=itemp>>3; + do + { + itemp--; + }while(!(*(marker+itemp))); + itemp=(itemp<<3)+7; + k=itemp-position_i2-position_j2; + + if(k<1) + continue; + + } + if((*(marker+(itemp>>3)))&(0x01<<(itemp&0x07)))//if this point need to be check again + { + if(*(directionOfData + itemp)&0xc0)//if this is a seed point or saturated point + *(marker+(itemp>>3))=*(marker+(itemp>>3))&(~(0x01<<(itemp&0x07))); + else + { + //1 + itemp=position_i1+position_j3+k+1; + maxvalue=*(outputData+itemp); + maxcolorindex=27; + //2 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=26; + } + //3 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=25; + } + //4 + itemp=position_i1+position_j2+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=24; + } + //5 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=23; + } + + //6 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=22; + } + //7 + itemp=position_i1+position_j1+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=21; + } + //8 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=20; + } + //9 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=19; + } + //10 + itemp=position_i2+position_j3+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=18; + } + //11 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=17; + } + //12 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=16; + } + //13 + itemp=position_i2+position_j2+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=15; + } + //update g + + itemp=position_i2+position_j2+k; + if(maxvalue>*(outputData+itemp)) + { + if(*(inputData+itemp)>*(outputData+itemp)) + { + //*(outputData+itemp)=min(maxvalue,*(inputData+itemp)); + if(maxvalue>*(inputData+itemp)) + { + *(outputData+itemp)=*(inputData+itemp); + *(directionOfData+itemp)=maxcolorindex|0x40; + } + else + { + *(outputData+itemp)=maxvalue; + *(directionOfData+itemp)=maxcolorindex; + } + + int ii,jj,kk; + itemp=position_i2-imageSize+position_j1+k-1; + for(ii=0;ii<3;ii++) + { + for(jj=0;jj<3;jj++) + { + for(kk=0;kk<3;kk++) + { + + *(marker+(itemp>>3))|=(0x01<<(itemp&0x07)); + itemp++; + } + itemp=itemp-3+ilong; + + } + itemp=itemp-ilong-ilong-ilong+imageSize; + } + + changed++; + } + else + *(marker+(itemp>>3))&=(~(0x01<<(itemp&0x07))); + + + } + else + *(marker+(itemp>>3))&=(~(0x01<<(itemp&0x07))); + + } + } + } + } + } + + }while(changed); + + checkSaturatedPoints(); + memset(pMarker,0x00,imageSize*imageAmount); + caculateColorMapFromPointerMap(pMarker, pPointers); +} +void CMIVFuzzyConnectedness::runFirstRoundFasterWith26Neigbhorhood() +{ + + long i,j,k; + float maxvalue; + unsigned char maxcolorindex; + long itemp; + long ilong,iwidth,iheight; + long position_i1,position_i2,position_j1,position_j2,position_j3; + int countNum=0; + + + ilong=imageWidth; + iwidth=imageHeight; + iheight=imageAmount; + + + + + //**********************positive direction***************************** + + + for(i=1;i<iheight-1;i++) + { + position_i1 = (i-1)*imageSize; + position_i2 = i*imageSize; + + for(j=1;j<iwidth-1;j++) + { + position_j1 = (j-1)*ilong; + position_j2 = j*ilong; + position_j3 = (j+1)*ilong; + for(k=1;k<ilong-1;k++) + if(!(*(directionOfData + position_i2+position_j2+k)&0xc0)) + { + countNum++; + //1 + itemp=position_i1+position_j1+k-1; + maxvalue=*(outputData+itemp); + maxcolorindex=1; + //2 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=2; + } + //3 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=3; + } + //4 + itemp=position_i1+position_j2+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=4; + } + //5 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=5; + } + + //6 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=6; + } + //7 + itemp=position_i1+position_j3+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=7; + } + //8 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=8; + } + + //9 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=9; + } + //10 + itemp=position_i2+position_j1+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=10; + } + //11 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=11; + } + //12 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=12; + } + //13 + itemp=position_i2+position_j2+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=13; + } + //update g + itemp=position_i2+position_j2+k; + if(maxvalue>*(outputData+itemp)) + { + if(*(inputData+itemp)>*(outputData+itemp)) + { + //*(outputData+itemp)=min(maxvalue,*(inputData+itemp)); + if(maxvalue>*(inputData+itemp)) + { + *(outputData+itemp)=*(inputData+itemp); + *(directionOfData+itemp)=maxcolorindex|0x40; + } + else + { + *(outputData+itemp)=maxvalue; + *(directionOfData+itemp)=maxcolorindex; + } + + + } + + } + + } + } + } + countNum=0; + + //*******************************negitive direction************************* + for(i=iheight-2;i>0;i--) + { + position_i1 = (i+1)*imageSize; + position_i2 = i*imageSize; + + for(j=iwidth-2;j>0;j--) + { + position_j1 = (j-1)*ilong; + position_j2 = j*ilong; + position_j3 = (j+1)*ilong; + + for(k=ilong-2;k>0;k--) + if(!(*(directionOfData + position_i2+position_j2+k)&0xc0)) + { + countNum++; + //1 + itemp=position_i1+position_j3+k+1; + maxvalue=*(outputData+itemp); + maxcolorindex=27; + //2 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=26; + } + //3 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=25; + } + //4 + itemp=position_i1+position_j2+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=24; + } + //5 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=23; + } + + //6 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=22; + } + //7 + itemp=position_i1+position_j1+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=21; + } + //8 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=20; + } + //9 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=19; + } + //10 + itemp=position_i2+position_j3+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=18; + } + //11 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=17; + } + //12 + itemp--; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=16; + } + //13 + itemp=position_i2+position_j2+k+1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=15; + } + //update g + + itemp=position_i2+position_j2+k; + if(maxvalue>*(outputData+itemp)) + { + //*(outputData+itemp)=min(maxvalue,*(inputData+itemp)); + if(maxvalue>*(inputData+itemp)) + { + *(outputData+itemp)=*(inputData+itemp); + *(directionOfData+itemp)=maxcolorindex|0x40; + } + else + { + *(outputData+itemp)=maxvalue; + *(directionOfData+itemp)=maxcolorindex; + } + + + } + + + } + } + } + countNum++; + + +} +void CMIVFuzzyConnectedness::checkSaturatedPoints() +{ + long i,j,k; + float maxvalue, oldmaxvalue; + unsigned char maxcolorindex,oldcolorindex; + long itemp; + long ilong,iwidth,iheight; + long position_i1,position_i2,position_i3,position_j1,position_j2,position_j3; + ilong=imageWidth; + iwidth=imageHeight; + iheight=imageAmount; + + + for(i=1;i<iheight-1;i++) + { + position_i1 = (i-1)*imageSize; + position_i2 = i*imageSize; + position_i3 = (i+1)*imageSize; + for(j=1;j<iwidth-1;j++) + { + position_j1 = (j-1)*ilong; + position_j2 = j*ilong; + position_j3 = (j+1)*ilong; + for(k=1;k<ilong-1;k++) + if((!(*(directionOfData + position_i2+position_j2+k)&0x80))&&(*(directionOfData + position_i2+position_j2+k)&0x40)) + { + oldcolorindex=*(directionOfData + position_i2+position_j2+k)&0x3f; + + //1 + itemp=position_i1+position_j1+k-1; + maxvalue=*(outputData+itemp); + maxcolorindex=1; + oldmaxvalue=maxvalue; + //2 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=2; + } + if(oldcolorindex==2) + oldmaxvalue=*(outputData+itemp); + //3 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=3; + } + if(oldcolorindex==3) + oldmaxvalue=*(outputData+itemp); + //4 + itemp=position_i1+position_j2+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=4; + } + if(oldcolorindex==4) + oldmaxvalue=*(outputData+itemp); + //5 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=5; + } + if(oldcolorindex==5) + oldmaxvalue=*(outputData+itemp); + //6 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=6; + } + if(oldcolorindex==6) + oldmaxvalue=*(outputData+itemp); + //7 + itemp=position_i1+position_j3+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=7; + } + if(oldcolorindex==7) + oldmaxvalue=*(outputData+itemp); + //8 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=8; + } + if(oldcolorindex==8) + oldmaxvalue=*(outputData+itemp); + //9 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=9; + } + if(oldcolorindex==9) + oldmaxvalue=*(outputData+itemp); + //10 + itemp=position_i2+position_j1+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=10; + } + if(oldcolorindex==10) + oldmaxvalue=*(outputData+itemp); + //11 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=11; + } + if(oldcolorindex==11) + oldmaxvalue=*(outputData+itemp); + //12 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=12; + } + if(oldcolorindex==12) + oldmaxvalue=*(outputData+itemp); + //13 + itemp=position_i2+position_j2+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=13; + } + if(oldcolorindex==13) + oldmaxvalue=*(outputData+itemp); + //15 + itemp+=2; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=15; + } + if(oldcolorindex==15) + oldmaxvalue=*(outputData+itemp); + //16 + itemp=position_i2+position_j3+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=16; + } + if(oldcolorindex==16) + oldmaxvalue=*(outputData+itemp); + //17 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=17; + } + if(oldcolorindex==17) + oldmaxvalue=*(outputData+itemp); + //18 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=18; + } + if(oldcolorindex==18) + oldmaxvalue=*(outputData+itemp); + //19 + itemp=position_i3+position_j1+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=19; + } + if(oldcolorindex==19) + oldmaxvalue=*(outputData+itemp); + //20 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=20; + } + if(oldcolorindex==20) + oldmaxvalue=*(outputData+itemp); + //21 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=21; + } + if(oldcolorindex==21) + oldmaxvalue=*(outputData+itemp); + //22 + itemp=position_i3+position_j2+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=22; + } + if(oldcolorindex==22) + oldmaxvalue=*(outputData+itemp); + //23 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=23; + } + if(oldcolorindex==23) + oldmaxvalue=*(outputData+itemp); + //24 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=24; + } + if(oldcolorindex==24) + oldmaxvalue=*(outputData+itemp); + //25 + itemp=position_i3+position_j3+k-1; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=25; + } + if(oldcolorindex==25) + oldmaxvalue=*(outputData+itemp); + //26 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=26; + } + if(oldcolorindex==26) + oldmaxvalue=*(outputData+itemp); + //27 + itemp++; + if(*(outputData+itemp)>maxvalue) + { + maxvalue=*(outputData+itemp); + maxcolorindex=27; + } + if(oldcolorindex==27) + oldmaxvalue=*(outputData+itemp); + //update direction + itemp=position_i2+position_j2+k; + if(maxvalue>oldmaxvalue) + *(directionOfData+itemp)=maxcolorindex; + else + *(directionOfData+itemp)=oldcolorindex; + + + + } + } + } + + +} + +void CMIVFuzzyConnectedness::caculateColorMapFromPointerMap(unsigned char* pColor, unsigned char* pPointers) +{ + colorOfData=pColor; + directionOfData=pPointers; + int totalvoxel=imageSize*(imageAmount-1); + int i; + for(i=imageSize;i<totalvoxel;i++) + { + + if(*(colorOfData+i)==0) + { + if(!((*(directionOfData+i))&0x80)) + { + int direction=*(directionOfData+i)&0x3f; + if(direction) + { + int itemp=0; + switch(direction) + { + case 1: itemp = (-imageSize-imageWidth-1); + break; + case 2: itemp = (-imageSize-imageWidth); + break; + case 3: itemp = (-imageSize-imageWidth+1); + break; + case 4: itemp = (-imageSize-1); + break; + case 5: itemp = (-imageSize); + break; + case 6: itemp = (-imageSize+1); + break; + case 7: itemp = (-imageSize+imageWidth-1); + break; + case 8: itemp = (-imageSize+imageWidth); + break; + case 9: itemp = (-imageSize+imageWidth+1); + break; + case 10: itemp = (-imageWidth-1); + break; + case 11: itemp = (-imageWidth); + break; + case 12: itemp = (-imageWidth+1); + break; + case 13: itemp = (-1); + break; + case 14: itemp = 0; + break; + case 15: itemp = 1; + break; + case 16: itemp = imageWidth-1; + break; + case 17: itemp = imageWidth; + break; + case 18: itemp = imageWidth+1; + break; + case 19: itemp = imageSize-imageWidth-1; + break; + case 20: itemp = imageSize-imageWidth; + break; + case 21: itemp = imageSize-imageWidth+1; + break; + case 22: itemp = imageSize-1; + break; + case 23: itemp = imageSize; + break; + case 24: itemp = imageSize+1; + break; + case 25: itemp = imageSize+imageWidth-1; + break;... [truncated message content] |
From: <rha...@us...> - 2010-03-05 11:21:31
|
Revision: 228 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=228&view=rev Author: rhameeteman Date: 2010-03-05 11:21:23 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added three modules: CSOSetProperties CSOImageStatistics CSOPointsToXMarkers Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def trunk/Community/General/Sources/ML/MLCSOCommunityModules/MLCSOCommunityModules.pro trunk/Community/General/Sources/ML/MLCSOCommunityModules/MLCSOCommunityModulesInit.cpp Added Paths: ----------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatisticsExample.mlab trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkers.html trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkersExample.mlab trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.py trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetPropertiesExample.mlab trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/MainAxisPCA.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/MainAxisPCA.h trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/MainAxisPCAMatrixRoutines.h trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.h trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatisticsExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatisticsExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatisticsExample.mlab 2010-03-05 11:21:23 UTC (rev 228) @@ -0,0 +1,693 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoRenderArea { + internal { + frame = "433 93 112 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "363 122 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoRenderArea + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + } +} +module SoExaminerViewer { + internal { + frame = "589 93 136 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "773 122 420 399" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + stereoViewing = FALSE + stereoOffset = 3 + height = 0.7853981853 + position = "-55.24962615966797 91.613037109375 -1.084884643554688" + orientation = "0.712742030620575 0.4398597776889801 -0.5463717579841614 3.836323738098145" + nearDistance = 86.19510651 + farDistance = 189.1821899 + focalDistance = 137.6403809 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module So3DXMarker { + internal { + frame = "653 173 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "641 167 292 745" + sizeHint = "292 745" + wasOpen = no + wasActive = no + } + } + } + fields { + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + scaleSize = 1 + scaleLength = 1 + color = "0.3333333432674408 0.6666666865348816 1" + validStylePalette = TRUE + enableVector = FALSE + drawingOn = TRUE + editingOn = TRUE + selectingOn = TRUE + deleteOnClick = FALSE + addOnClick = TRUE + edit3DOn = FALSE + edit3DVector = FALSE + colorMode = COLOR_BY_TYPE + markerType = 0 + textColorMode = COLOR_TEXT + textMode = TEXT_OFF + textColor = "1 1 1" + textShadow = TRUE + vectorArrow = VECTOR_NO_ARROWS + lineStyle = Solid + drawMode = DrawModeCorrect + instanceName = So3DXMarker + listString = "" + numItems = 2845 + index = 0 + persistent = FALSE + listStringEnable = FALSE + ownsList = FALSE + applySelect = FALSE + id = 0 + name = "" + newName = "" + actionClass = New + actionIndex = -1 + actionId = -1 + currentIndex = -1 + overflowMode = None + maxSize = 0 + useInsertTemplate = FALSE + upToDate = TRUE + posXYZ = "39.89910507202148 62.53080749511719 45.50000381469727" + posC = 0 + posT = 0 + posU = 0 + vecXYZ = "0 0 0" + type = 0 + newPosXYZ = "0 0 0" + newPosC = 0 + newPosT = 0 + newPosU = 0 + newVecXYZ = "0 0 0" + newType = 0 + } +} +module SoCSO3DVis { + internal { + frame = "549 173 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "168 318 258 298" + sizeHint = "258 298" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoCSO3DVis + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + autoApply = TRUE + lineWidthOffset = 0 + markerSizeScaling = 1 + highlightSelectedGroups = TRUE + useRenderTimeDelay = FALSE + timerDelayMilliSeconds = 100 + useStylePalette = TRUE + stylePaletteUseIndexAs = USE_INDEX_FOR_CSO + listenToRepaintNotifications = FALSE + listenToFinishingNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + } +} +module LocalImage { + internal { + frame = "241 533 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "717 524 492 211" + sizeHint = "492 211" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/PIDunknown.134x124x46.roi.ul.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/PIDunknown.134x124x46.roi.ul.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module StylePalette { + internal { + frame = "561 341 96 56" + moduleGroupName = "" + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 4 + markerSize2 = 4 + markerSize3 = 4 + markerSize4 = 4 + markerSize5 = 4 + markerSize6 = 4 + markerSize7 = 4 + markerSize8 = 4 + markerSize9 = 4 + markerSize10 = 4 + markerSize11 = 4 + markerSize12 = 4 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module Diagram2D { + internal { + frame = "441 173 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "590 388 444 576" + sizeHint = "444 576" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 8 + autoRangeX = TRUE + minY = 1042.484619 + maxY = 1170.706299 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = FALSE + diagramTitleString = "" + borderH = 39 + autoBorderH = TRUE + borderV = 25 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 1 1" + lineStyle = Solid + markerType = None + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = -0.9811320305 + mousePosY = 1179.600342 + mousePosValid = TRUE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = TRUE + } +} +module CSOFreehandProcessor { + internal { + frame = "453 429 168 56" + moduleGroupName = "" + } + fields { + instanceName = CSOFreehandProcessor + addCSOToGroupWithLabel = "" + id = 0 + pathPointLineStyle = LineStyleSolid + pathPointLineWidth = 1 + pathPointColor = "1 1 0" + pathPointAlpha = 1 + markerMode = MarkerModeNone + markerSize = 2 + markerColor = "0 1 0" + markerAlpha = 1 + voxelWriteMode = VoxelWriteModeModule + voxelWriteValue = 1024 + creationMode = CreationModeClosedFreehand + interpolationMode = InterpolationModeSplineApproximation + seedPlacementPolicy = PlaceSeedPointWhileDragging + finishingMode = FinishOnRelease + minNumSeedPoints = 0 + minSeedPointDistance = 8 + shouldCloseOnFinish = TRUE + useFinishingDistance = TRUE + finishingDistance = 24 + numInterpolationSteps = 1 + } +} +module SoView2DCSOEditor { + internal { + frame = "301 229 152 56" + moduleGroupName = "" + windows { + window _default { + geometry = "364 302 558 465" + sizeHint = "558 465" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DCSOEditor + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 24 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = TRUE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + shouldListenToRepaintEvents = TRUE + shouldListenToSelectionChangedEvents = TRUE + shouldListenToFinishedEvents = TRUE + generalInteractionMode = INTERACTION_MODE_EDIT + generalInteractionModeToggleKey = TOGGLE_MODE_ALT + useAntiAliasing = TRUE + useInterpolationTargetColor = TRUE + interpolationTargetColor = "1 0 0" + showBoundingBox = FALSE + boundingBoxAlpha = 0.5 + boundingBoxColor = "1 1 1" + showOnlyParallelCSOs = FALSE + showParallelDotProductLimitRadian = 0.9998999834 + shouldLevelCSO = FALSE + useStylePalette = TRUE + stylePaletteUseIndexAs = USE_INDEX_FOR_CSO + labelShowMode = LABEL_SHOW_CSO_DESCRIPTION + labelAlignmentMode = LABEL_ALIGN_TOP + labelUnitScale = LABEL_UNIT_SCALE_MM + showLabelUnits = TRUE + labelFontSize = 12 + labelUseTextShadow = TRUE + labelMarginX = 2 + labelMarginY = 2 + ghostMode = GHOST_BOTH_SIDES + ghostUnitMode = GHOST_UNIT_SLICE + ghostStyleAlpha = TRUE + ghostStyleStipple = TRUE + ghostStyleLineWidth = FALSE + ghostStyleBrighten = FALSE + ghostDepth = 5 + generalLabelColor = "1 1 1" + generalLabelAlpha = 1 + labelColorMode = COLOR_GENERAL + useTesselation = FALSE + tesselationColorMode = COLOR_AS_CSO + tesselationColor = "0.8999999761581421 0.5 0.8999999761581421" + tesselationAlpha = 0.200000003 + tesselationWindingRule = WR_ODD + selectGroupsParsProToto = TRUE + highlightSelectedGroups = FALSE + enableMouseOverHighlighting = TRUE + mouseOverColorMode = HIGHLIGHT_COLOR_MODE_FIXED + mouseOverColorBrightenValue = 0.8000000119 + mouseOverColorColor = "1 1 1" + mouseOverLineWidthMode = HIGHLIGHT_LINE_WIDEN + mouseOverLineWidthWidenValue = 0 + mouseOverLineWidthLineWidth = 1 + useIconFile = FALSE + iconFile = $(MLAB_MeVisLab_Standard)/Modules/Resources/Images/markerIcons.tif + internalIconFile = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Standard/Modules/Resources/Images/markerIcons.tif" + cutCopyKeyModifier = EDIT_OP_KEY_MOD_CONTROL + copyKeyModifier = EDIT_OP_KEY_MOD_CONTROL + pasteKeyModifier = EDIT_OP_KEY_MOD_CONTROL + undoKeyModifier = EDIT_OP_KEY_MOD_CONTROL + redoKeyModifier = EDIT_OP_KEY_MOD_CONTROL + deleteSeedPointKeyModifier = EDIT_OP_KEY_MOD_NONE + deleteCSOKeyModifier = EDIT_OP_KEY_MOD_SHIFT + multiSelectionKeyModifier = EDIT_OP_KEY_MOD_CONTROL + enableMultiSelection = TRUE + cutCopyKey = EDIT_OP_KEY_X + copyKey = EDIT_OP_KEY_C + pasteKey = EDIT_OP_KEY_V + undoKey = EDIT_OP_KEY_Z + redoKey = EDIT_OP_KEY_Y + deleteSeedPointKey = EDIT_OP_KEY_DELETE + deleteCSOKey = EDIT_OP_KEY_DELETE + nextInteractionStatus = INTERACTIVE_MODE_START_CSO + forceStartNewCSOKeyModifier = EDIT_OP_KEY_MOD_NONE + forceStartNewCSOKey = EDIT_OP_KEY_F + } +} +module View2D { + internal { + frame = "261 93 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "6 120 346 402" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = TRUE + view2DExtensionsOn = TRUE + startSlice = 38 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 2047.5 + lutWidth = 4095 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 38.5" + } + internalFields = "" +} +module LocalCSOLoad { + internal { + frame = "469 533 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "-22 629 1088 256" + sizeHint = "455 256" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalCSOLoad + name = $(MLAB_MeVisLab_Standard)/Modules/ML/MLCSOModules/CSOMerge/kidney.cso + autoApply = TRUE + status = "File loaded." + loadSuccess = TRUE + } + internalFields = "" +} +module CSOImageStatistics { + internal { + frame = "305 429 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "313 623 322 356" + sizeHint = "322 356" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = CSOImageStatistics + inputCSOString = -1 + addDescription = TRUE + descriptionString = "Sum:%sum / Average:%average" + outputCurve = TRUE + workDirectlyOnInputList = FALSE + listenToFinishingNotifications = TRUE + listenToSelectionNotifications = TRUE + updateMode = Off + useAllPointsInsideCSO = TRUE + averageOutput = TRUE + sumOutput = FALSE + resolution = -1 + useVoxelSize = TRUE + statistics = "Id;Voxels;Sum;Average +1;442;473393;1138.11 +2;421;451051;1119.61 +3;483;521660;1124.51 +4;101;104311;1097.15 +5;102;107386;1170.71 +6;465;493490;1092.91 +7;316;337427;1069.04 +8;408;433232;1138.93 +9;107;110105;1042.48 +" + interpolation = Trilinear + memoryAccess = Global + } +} +connections { + SoRenderArea.children = Diagram2D.outNode + SoExaminerViewer.children = "SoCSO3DVis.self So3DXMarker.self" + So3DXMarker.stylePalette = StylePalette.outStylePalette + So3DXMarker.inXMarkerList = CSOImageStatistics.outCoordinateList + SoCSO3DVis.inCSOList = CSOImageStatistics.outCSOList + SoCSO3DVis.inStylePalette = StylePalette.outStylePalette + Diagram2D.inCurveList = CSOImageStatistics.outCurveList + SoView2DCSOEditor.inCSOList = CSOImageStatistics.outCSOList + SoView2DCSOEditor.inProcessor = CSOFreehandProcessor.outProcessorData + SoView2DCSOEditor.inStylePalette = StylePalette.outStylePalette + View2D.inImage = LocalImage.outImage + View2D.inInvPostLUT = SoView2DCSOEditor.self + CSOImageStatistics.input0 = LocalImage.outImage + CSOImageStatistics.inCSOList = LocalCSOLoad.outCSOList +} +networkModel = "" Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkers.html =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkers.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkers.html 2010-03-05 11:21:23 UTC (rev 228) @@ -0,0 +1,77 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>CSOPointsToXMarkers</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>Output the points of a CSO in an XMarkerList. CSO normals can be computes as well and are then outputted in the vector element of the markers. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect CSOList, enter index of CSO to output and change settings. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Normals are computed by computing the outer product of the plane normal in which the CSO lies and the vectors between the CSO points. +</blockquote> + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>inputCSOList</b> + Input CSOList + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outputXMarkerList</b> + Output XMarkerList + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>listIndexFld</b> + Index of CSO in CSOList to convert (-1 = all) + </li> + <li> + <b>convertPathPoints</b> + Enable/disable conversion of pathpoints + </li> + <li> + <b>outputCSONormals</b> + Enable/disable computation and output of CSO normals in vector elements of XMarkerList + </li> + </ul> + +</blockquote> + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>See example network. +</blockquote> + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkersExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkersExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOPointsToXMarkers/CSOPointsToXMarkersExample.mlab 2010-03-05 11:21:23 UTC (rev 228) @@ -0,0 +1,476 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoGroup { + internal { + frame = "753 125 96 56" + moduleGroupName = "" + } + fields { + instanceName = SoGroup + } +} +module SoView2DMarkerEditor { + internal { + frame = "673 205 160 56" + moduleGroupName = "" + windows { + window _default { + geometry = "528 116 435 831" + sizeHint = "435 831" + wasOpen = no + wasActive = no + } + } + } + fields { + drawingOn = TRUE + editingOn = FALSE + maskValid = FALSE + fixZOn = TRUE + color = "1 0 0" + selectionTolerance = 3 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + depthVisibility = 1 + snapToVoxel = FALSE + snapToSlice = FALSE + currentType = 0 + deleteOnClick = FALSE + addOnClick = FALSE + alphaFactor = 1 + iconFile = $(MLAB_MeVisLab_Standard)/Modules/Resources/Images/markerIcons.tif + internalIconFile = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Standard/Modules/Resources/Images/markerIcons.tif" + useIconFile = FALSE + iconIdx = 0 + selectingOn = FALSE + actOnReleaseOnly = FALSE + editorMode = EDIT_MARKER + colorMode = COLOR_BY_TYPE + textColorMode = COLOR_TEXT + textMode = TEXT_OFF + textColor = "1 1 1" + textShadow = TRUE + textFontSize = 12 + showTextOnlyForSelectedMarker = FALSE + cutText = FALSE + maxNumberOfLines = 1 + vectorArrow = VECTOR_NO_ARROWS + useAntiAlias = FALSE + currentStyleIndex = -1 + depthVectorDrawMode = DRAW_NONE + drawMode = DRAW_MARKER + selectiveDrawing = FALSE + selectionBoxesForCurrentOnly = FALSE + cooperative = FALSE + busy = FALSE + instanceName = SoView2DMarkerEditor + listString = "" + numItems = 130 + index = 0 + persistent = FALSE + listStringEnable = FALSE + ownsList = FALSE + applySelect = FALSE + id = 1447 + name = "" + newName = "" + actionClass = Insert + actionIndex = 129 + actionId = 1576 + currentIndex = 129 + overflowMode = None + maxSize = 0 + useInsertTemplate = FALSE + upToDate = TRUE + posXYZ = "77.58567810058594 105.0843963623047 0.5" + posC = 0 + posT = 0 + posU = 0 + vecXYZ = "-0.7592560670601622 -0.6507919979781056 2.503193737840202e-18" + type = 0 + newPosXYZ = "0 0 0" + newPosC = 0 + newPosT = 0 + newPosU = 0 + newVecXYZ = "0 0 0" + newType = 0 + } +} +module CSOFreehandProcessor { + internal { + frame = "701 461 168 56" + moduleGroupName = "" + } + fields { + instanceName = CSOFreehandProcessor + addCSOToGroupWithLabel = "" + id = 0 + pathPointLineStyle = LineStyleSolid + pathPointLineWidth = 1 + pathPointColor = "1 1 0" + pathPointAlpha = 1 + markerMode = MarkerModeNone + markerSize = 2 + markerColor = "0 1 0" + markerAlpha = 1 + voxelWriteMode = VoxelWriteModeModule + voxelWriteValue = 1024 + creationMode = CreationModeClosedFreehand + interpolationMode = InterpolationModeSplineApproximation + seedPlacementPolicy = PlaceSeedPointWhileDragging + finishingMode = FinishOnRelease + minNumSeedPoints = 0 + minSeedPointDistance = 8 + shouldCloseOnFinish = TRUE + useFinishingDistance = TRUE + finishingDistance = 24 + numInterpolationSteps = 1 + } +} +module SoView2DCSOEditor { + internal { + frame = "741 317 152 56" + moduleGroupName = "" + } + fields { + instanceName = SoView2DCSOEditor + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 24 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = TRUE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + shouldListenToRepaintEvents = TRUE + shouldListenToSelectionChangedEvents = TRUE + shouldListenToFinishedEvents = TRUE + generalInteractionMode = INTERACTION_MODE_EDIT + generalInteractionModeToggleKey = TOGGLE_MODE_ALT + useAntiAliasing = TRUE + useInterpolationTargetColor = TRUE + interpolationTargetColor = "1 0 0" + showBoundingBox = FALSE + boundingBoxAlpha = 0.5 + boundingBoxColor = "1 1 1" + showOnlyParallelCSOs = FALSE + showParallelDotProductLimitRadian = 0.9998999834 + shouldLevelCSO = FALSE + useStylePalette = FALSE + stylePaletteUseIndexAs = USE_INDEX_FOR_CSO + labelShowMode = LABEL_SHOW_NONE + labelAlignmentMode = LABEL_ALIGN_CENTER + labelUnitScale = LABEL_UNIT_SCALE_MM + showLabelUnits = TRUE + labelFontSize = 12 + labelUseTextShadow = TRUE + labelMarginX = 2 + labelMarginY = 2 + ghostMode = GHOST_BOTH_SIDES + ghostUnitMode = GHOST_UNIT_SLICE + ghostStyleAlpha = TRUE + ghostStyleStipple = TRUE + ghostStyleLineWidth = FALSE + ghostStyleBrighten = FALSE + ghostDepth = 5 + generalLabelColor = "1 1 1" + generalLabelAlpha = 1 + labelColorMode = COLOR_GENERAL + useTesselation = FALSE + tesselationColorMode = COLOR_AS_CSO + tesselationColor = "0.8999999761581421 0.5 0.8999999761581421" + tesselationAlpha = 0.200000003 + tesselationWindingRule = WR_ODD + selectGroupsParsProToto = TRUE + highlightSelectedGroups = FALSE + enableMouseOverHighlighting = TRUE + mouseOverColorMode = HIGHLIGHT_COLOR_MODE_FIXED + mouseOverColorBrightenValue = 0.8000000119 + mouseOverColorColor = "1 1 1" + mouseOverLineWidthMode = HIGHLIGHT_LINE_WIDEN + mouseOverLineWidthWidenValue = 0 + mouseOverLineWidthLineWidth = 1 + useIconFile = FALSE + iconFile = $(MLAB_MeVisLab_Standard)/Modules/Resources/Images/markerIcons.tif + internalIconFile = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Standard/Modules/Resources/Images/markerIcons.tif" + cutCopyKeyModifier = EDIT_OP_KEY_MOD_CONTROL + copyKeyModifier = EDIT_OP_KEY_MOD_CONTROL + pasteKeyModifier = EDIT_OP_KEY_MOD_CONTROL + undoKeyModifier = EDIT_OP_KEY_MOD_CONTROL + redoKeyModifier = EDIT_OP_KEY_MOD_CONTROL + deleteSeedPointKeyModifier = EDIT_OP_KEY_MOD_NONE + deleteCSOKeyModifier = EDIT_OP_KEY_MOD_SHIFT + multiSelectionKeyModifier = EDIT_OP_KEY_MOD_CONTROL + enableMultiSelection = TRUE + cutCopyKey = EDIT_OP_KEY_X + copyKey = EDIT_OP_KEY_C + pasteKey = EDIT_OP_KEY_V + undoKey = EDIT_OP_KEY_Z + redoKey = EDIT_OP_KEY_Y + deleteSeedPointKey = EDIT_OP_KEY_DELETE + deleteCSOKey = EDIT_OP_KEY_DELETE + nextInteractionStatus = INTERACTIVE_MODE_START_CSO + forceStartNewCSOKeyModifier = EDIT_OP_KEY_MOD_NONE + forceStartNewCSOKey = EDIT_OP_KEY_F + } +} +module View2D { + internal { + frame = "725 29 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "835 149 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = TRUE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 0.5 + lutWidth = 1 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 0.5" + } + internalFields = "" +} +module ConstantImage { + internal { + frame = "605 125 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "534 411 219 246" + sizeHint = "219 246" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ConstantImage + sizeX = 256 + sizeY = 256 + sizeZ = 1 + sizeC = 1 + sizeT = 1 + sizeU = 1 + dataType = float + fillValue = 0 + autoApply = TRUE + } +} +module CSOManager { + internal { + frame = "585 461 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "60 437 695 457" + sizeHint = "695 457" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = CSOManager + workDirectlyOnInputCSOList = FALSE + selectLastCreatedGroup = TRUE + selectionColoringMode = SelectionColorModeFixed + selectionLineWidthMode = SelectionLineWidthWiden + selectionBrightenColor = 0.200000003 + selectionFixedColor = "1 1 0.6000000238418579" + selectionWidenLineWidth = 1 + selectionFixedLineWidth = 2 + csoDefaultLabel = "" + csoDefaultDescription = "" + csoDefaultShowState = TRUE + csoDefaultVoxelizeState = TRUE + csoDefaultEditableState = TRUE + groupSingleDeleteGroupCSOHandling = RemoveIfInNoGroup + groupDefaultLabel = "" + groupDefaultDescription = "" + groupDefaultLineStyle = LineStyleSolid + groupDefaultColor = "1 1 1" + groupDefaultAlpha = 1 + groupDefaultLineWidth = 1 + groupDefaultShowState = TRUE + groupDefaultVoxelizeState = TRUE + groupDefaultEditableState = TRUE + groupDefaultTimePointIndex = 0 + groupDefaultUseVisuals = FALSE + groupDefaultUseShowState = FALSE + groupDefaultUseVoxelizeState = FALSE + groupDefaultUseEditableState = FALSE + groupDefaultUseTimePointIndex = FALSE + groupDefaultUseVoxelWrite = FALSE + groupDefaultVoxelWriteMode = VoxelWriteModeModule + groupDefaultVoxelWriteValue = 1024 + groupDefaultUseMarkerSettings = FALSE + groupDefaultMarkerMode = MarkerModeRect + groupDefaultMarkerColor = "0 1 0" + groupDefaultMarkerAlpha = 1 + groupDefaultMarkerSize = 3 + groupDefaultNumMaximumCSOs = 0 + groupDefaultOverflowHandling = RemoveFirst + groupDefaultRemoveFromGroupHandling = RemoveIfInNoGroup + listSingleRemoveEmptyGroupHandling = RemoveAlways + listDefaultRemoveEmptyGroupHandling = RemoveAlways + numUndos = 13 + numRedos = 0 + undoStackLimit = 16 + useSelectionCSONotification = FALSE + useSelectionGroupNotification = FALSE + useFinishedCSONotification = FALSE + useFinishedGroupNotification = FALSE + useCSOMovedNotification = FALSE + useRepaintNotification = FALSE + useInteractionInitNotification = FALSE + useStartNewCSONotification = FALSE + enableSelectionNotification = TRUE + enableFinishedNotification = TRUE + enableCSOMovedNotification = TRUE + enableRepaintNotification = TRUE + csoTreeView = "" + groupTreeView = "" + numCSOs = 6 + numGroups = 0 + numSelectedCSOs = 1 + numSelectedGroups = 0 + selectedCSOsGroupIds = "" + csoTabSelected = FALSE + groupTabSelected = FALSE + selectionTabSelected = FALSE + notificationTabSelected = TRUE + defaultTabSelected = FALSE + csoCommonTabSelected = TRUE + csoVisualsTabSelected = FALSE + groupCommonTabSelected = FALSE + groupVisualsTabSelected = FALSE + groupMiscTabSelected = FALSE + notificationControlTabSelected = TRUE + notificationOutputCSOTabSelected = FALSE + notificationOutputGroupTabSelected = FALSE + defaultCSOCommonTabSelected = FALSE + defaultGroupCommonTabSelected = FALSE + defaultGroupVisualsTabSelected = FALSE + defaultGroupMiscTabSelected = FALSE + } +} +module CSOPointsToXMarkers { + internal { + frame = "561 317 160 56" + moduleGroupName = "" + windows { + window _default { + geometry = "858 592 165 91" + sizeHint = "165 91" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = CSOPointsToXMarkers + listIndexFld = -1 + convertPathPoints = FALSE + outputCSONormals = TRUE + } +} +connections { + SoGroup.children = "SoView2DMarkerEditor.self SoView2DCSOEditor.self" + SoView2DMarkerEditor.inXMarkerList = CSOPointsToXMarkers.outputXMarkerList + SoView2DCSOEditor.inCSOList = CSOManager.outCSOList + SoView2DCSOEditor.inProcessor = CSOFreehandProcessor.outProcessorData + View2D.inImage = ConstantImage.output0 + View2D.inInvPreLUT = SoGroup.self + CSOPointsToXMarkers.inputCSOList = CSOManager.outCSOList +} +networkModel { + parentItems { + 0 { + MLABNetworkModelItem MLABNoteItem { + uniqueId = 23 + objectName = "" + parentUniqueId = 0 + frame = "339 24 200 200" + backgroundColor { + r = 252 + g = 242 + b = 2 + a = 255 + } + text = "Draw a CSO and it will be converted to an XMarkerList" + titleText = Comment + isCollapsed = False + } + } + } +} Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.py =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.py (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.py 2010-03-05 11:21:23 UTC (rev 228) @@ -0,0 +1,54 @@ +#----------------------------------------------------------------------- +# +# Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +# Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of BIGR nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +#---------------------------------------------------------------------------------- +# CSOSetProperties GUI definitions. +# +# \file CSOSetProperties.script +# \author Reinhard Hameeteman +# \date 2010-03-02 +# +#---------------------------------------------------------------------------------- + +from mevis import * + +def SetEnableState(event = None): + excludedFields = ['CSOClearSelectionFld','GroupClearSelectionFld'] + filter = ctx.control("filter") + name = filter.eventControl().getName() + if name not in excludedFields : + setName = 'set'+ name[:-3] + ctx.field( setName ).value = not ctx.field( setName ).boolValue() + return + + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +#//# owner: EMC +#//# date: 2010-03-02T15:15:35 +#//# hash: GPCQuNrO38gzKP73viu5TNs71mKHjFdYR5Yxtd2/oHtAUxoL10k8HhEYhjT672GKYYWsOl/rb+Lyqly69S5aLg== +#//# MeVis end Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2010-03-05 11:21:23 UTC (rev 228) @@ -0,0 +1,214 @@ +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! CSOSetProperties GUI definitions. +/*! +// \file CSOSetProperties.script +// \author Reinhard Hameeteman +// \date 2010-03-02 +*/ +//---------------------------------------------------------------------------------- + +Interface { + Parameters { + Field settingsTabOn { type = bool value = false } + } +} + +Description { + Field CSOAlpha { min = 0 max = 1 } + Field CSOLineWidth { min = 1 max = 16 } + Field CSOMarkerAlpha { min = 0 max = 1 } + Field GroupAlpha { min = 0 max = 1 } + Field GroupLineWidth { min = 1 max = 16 } + Field GroupMarkerAlpha { min = 0 max = 1 } + +} // description + +Commands { + source = $(LOCAL)/CSOSetProperties.py +} +Window { + maxw = 600 + name = mainWindow + EventFilter { + command = SetEnableState + filter = MouseButtonDblClick + control = CSOTab + control = GroupTab + children = Yes + eatEvent = Yes + name = filter + } + TabView { + style { + Prototype Vertical {expandY = yes} + Prototype Horizontal {expandY = yes} + Prototype TabViewItem {expandY = yes} + Prototype Box {expandY = yes} + } + TabViewItem "Main" { + Box "Input" { + ButtonBar inputMode { show = Radio } + tooltip = "Use -1 for all Ids" + Field inputCSOString { title = "CSO Ids:" expandX = YES visibleOn = "*inputMode == "CSO" *" } + Field inputGroupString { title = "Group Ids:" expandX = YES visibleOn = "*inputMode == "Group" *" } + } + + Box "Handle Notifications" { + CheckBox listenToFinishingNotifications { title = "Finishing" } + CheckBox listenToSelectionNotifications { title = "Selection" } + } + + Box "Operation Mode" { + Horizontal { + alignX = Left + CheckBox autoUpdate {} + Button update {} + } // horizontal + CheckBox workDirectlyOnInputList { title = "Work On Input List"} + } + Box { + Label { + title = "The properties of the CSO's that need to be set, can be enabled in the CSO and Group tab by double clicking on the field." + textWrap = WordBreak + } + } + + } // Vertical main + TabViewItem CSO { + name = CSOTab + expandY = Yes + Horizontal { + Vertical { + tooltip = "Double click on a field to enable it" + expandX = No + Box "Common" { + Field CSOLabel { name = CSOLabelFld dependsOn = setCSOLabel title = "Label:" alignGroupX = csog1 } + Field CSODescription { name = CSODescriptionFld dependsOn = setCSODescription title = "Description:" alignGroupX = csog1 } + Field CSOTimePointIndex { name = CSOTimePointIndexFld dependsOn = setCSOTimePointIndex title = "Time Point:" alignGroupX = csog1 step = 1 } + Horizontal { + CheckBox CSOIsSelected { name = CSOIsSelectedFld dependsOn = setCSOIsSelected title = "Is selected" alignGroupX = csog1 } + CheckBox CSOClearSelection { name = CSOClearSelectionFld dependsOn = setCSOIsSelected title = "Clear first" alignGroupX = csog2 } + } + Horizontal { + CheckBox CSOShowState { name = CSOShowStateFld dependsOn = setCSOShowState title = "Show" alignGroupX = csog1 } + CheckBox CSOEditableState { name = CSOEditableStateFld dependsOn = setCSOEditableState title = "Editable" alignGroupX = csog2 } + } + Horizontal { + CheckBox CSOVoxelizeState { name = CSOVoxelizeStateFld dependsOn = setCSOVoxelizeState title = "Voxelize" alignGroupX = csog1 } + CheckBox CSOComputeNormal { name = CSOComputeNormalFld dependsOn = setCSOComputeNormal title = recomputeNormal alignGroupX = csog2 } + } + } + Box "Voxelize" { + Field CSOVoxelWriteMode { name = CSOVoxelWriteModeFld dependsOn = setCSOVoxelWriteMode title = "Voxel Write Mode:" } + Field CSOVoxelWriteValue { name = CSOVoxelWriteValueFld dependsOn = setCSOVoxelWriteValue title = "Voxel Write Value:" } + } + } + Vertical { + Box "Path Points" { + Field CSOLineStyle { name = CSOLineStyleFld dependsOn = setCSOLineStyle title = "Style:"} + Field CSOLineWidth { name = CSOLineWidthFld dependsOn = setCSOLineWidth title = "Width:" step = 1 } + Field CSOColor { name = CSOColorFld dependsOn = setCSOColor title = "Color: "} + Field CSOAlpha { name = CSOAlphaFld dependsOn = setCSOAlpha title = "Alpha: " slider = YES step = 0.1 editField = NO } + } + Box "Markers" { + Field CSOMarkerMode { name = CSOMarkerModeFld dependsOn = setCSOMarkerMode title = "Mode:" } + Field CSOMarkerSize { name = CSOMarkerSizeFld dependsOn = setCSOMarkerSize title = "Size:" step = 0.5 } + Field CSOMarkerColor { name = CSOMarkerColorFld dependsOn = setCSOMarkerColor title = "Color: " } + Field CSOMarkerAlpha { name = CSOMarkerAlphaFld dependsOn = setCSOMarkerAlpha title = "Alpha: " slider = YES step = 0.1 editField = NO } + } + } + } // Horizontal + Horizontal {} + } // CSO + TabViewItem Group { + expandY = Yes + name = GroupTab + tooltip = "Double click on a field to enable it" + Horizontal { + Vertical { + Box "Common" { + Field GroupLabel { name = GroupLabelFld dependsOn = setGroupLabel title = "Label:" } + Field GroupDescription { name = GroupDescriptionFld dependsOn = setGroupDescription title = "Description:"} + Field GroupUseTimePointIndex { name = GroupUseTimePointIndexFld dependsOn = setGroupUseTimePointIndex title = "Use Time Point Index" } + Field GroupTimePointIndex { name = GroupTimePointIndexFld dependsOn = setGroupTimePointIndex title = "Time Point Index:" step = 1 } + Horizontal { + CheckBox GroupIsSelected { name = GroupIsSelectedFld dependsOn = setGroupIsSelected title = "Is selected" alignGroupX = gc1 } + CheckBox GroupClearSelection { name = GroupClearSelectionFld dependsOn = setGroupIsSelected title = "Clear first" alignGroupX = gc2 } + } + Horizontal { + CheckBox GroupUseShowState { name = GroupUseShowStateFld dependsOn = setGroupUseShowState title = "Use Show State" alignGroupX = gc1 } + CheckBox GroupShowState { name = GroupShowStateFld dependsOn = setGroupShowState title = "Show State" alignGroupX = gc2 } + } + Horizontal { + CheckBox GroupUseVoxelizeState { name = GroupUseVoxelizeStateFld dependsOn = setGroupUseVoxelizeState title = "Use Voxelize State" alignGroupX = gc1 } + CheckBox GroupVoxelizeState { name = GroupVoxelizeStateFld dependsOn = setGroupVoxelizeState title = "Voxelize State" alignGroupX = gc2 } + } + Horizontal { + CheckBox GroupUseEditableState { name = GroupUseEditableStateFld dependsOn = setGroupUseEditableState title = "Use Editable State" alignGroupX = gc1 } + CheckBox GroupEditableState { name = GroupEditableStateFld dependsOn = setGroupEditableState title = "Editable State" alignGroupX = gc2 } + } + } + Box "Rules" { + Field GroupMaximumNumCSOs { name = GroupMaximumNumCSOsFld dependsOn = setGroupMaximumNumCSOs title = "Maximum CSOs:" } + Field GroupOverflowHandling { name = GroupOverflowHandlingFld dependsOn = setGroupOverflowHandling title = "Overflow Handling:" } + Field GroupRemoveFromGroupHandling { name = GroupRemoveFromGroupHandlingFld dependsOn = setGroupRemoveFromGroupHandling title = "Remove CSO Handling:" } + Field GroupDeleteGroupCSOHandling { name = GroupDeleteGroupCSOHandlingFld dependsOn = setGroupDeleteGroupCSOHandling title = "Delete Group CSO Handling:" } + } + } + Vertical { + Box "Path Points" { + CheckBox GroupUseVisuals { name = GroupUseVisualsFld dependsOn = setGroupUseVisuals title = "Use Group Visuals" } + Field GroupLineStyle { name = GroupLineStyleFld dependsOn = setGroupLineStyle title = "Style:" } + Field GroupLineWidth { name = GroupLineWidthFld dependsOn = setGroupLineWidth title = "Width:" step = 1 } + Field GroupColor { name = GroupColorFld dependsOn = setGroupColor title = "Color:" } + Field GroupAlpha { name = GroupAlphaFld dependsOn = setGroupAlpha title = "Alpha:" slider = YES step = 0.1 editField = NO } + } + Box "Markers" { + CheckBox GroupUseMarkerSettings { name = GroupUseMarkerSettingsFld dependsOn = setGroupUseMarkerSettings title = "Use Marker Settings" } + Field GroupMarkerMode { name = GroupMarkerModeFld dependsOn = setGroupMarkerMode title = "Mode:" } + Field GroupMarkerSize { name = GroupMarkerSizeFld dependsOn = setGroupMarkerSize title = "Size:" step = 0.5 } + Field GroupMarkerColor { name = GroupMarkerColorFld dependsOn = setGroupMarkerColor title = "Color:" } + Field GroupMarkerAlpha { name = GroupMarkerAlphaFld dependsOn = setGroupMarkerAlpha title = "Alpha:" slider = YES step = 0.1 editField = NO } + } + Box "Voxelize" { + CheckBox GroupUseVoxelWrite { name = GroupUseVoxelWriteFld dependsOn = setGroupUseVoxelWrite title = "Use Voxel Write" } + Field GroupVoxelWriteMode { name = GroupVoxelWriteModeFld dependsOn = setGroupVoxelWriteMode title = "Voxel Write Mode: " } + Field GroupVoxelWriteValue { name = GroupVoxelWriteValueFld dependsOn = setGroupVoxelWriteValue title = "Voxel Write Value: " } + } + } + } + } + + } // TabView +} // window + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:17:20 +//# hash: aFxR8EoZL6PrO7+efbM4PBaaqDjgJauJpXeDjviQ9PkNpyjnzWs5X8fep3v35fXFSqX9sSHw5aePJhCyVYLbpw== +//# MeVis end Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetPropertiesExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetPropertiesExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetPropertiesExample.mlab 2010-03-05 11:21:23 UTC (rev 228) @@ -0,0 +1,678 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module CSOInfo { + internal { + frame = "-195 29 88 56" + moduleGroupName = "Set Group properties" + windows { + window _default { + geometry = "584 174 522 581" + sizeHint = "347 581" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = CSOInfo1 + csoShowPrivateValues = TRUE + groupId = 1 + groupUseShowState = FALSE + groupShowState = TRUE + groupUseVoxelizeState = FALSE + groupVoxelizeState = TRUE + groupUseEditableState = FALSE + groupEditableState = TRUE + shouldGenerateCSOStringOutput = TRUE + shouldGenerateCSOGroupStringOutput = FALSE + showCSOType = TRUE + showCSOSubType = TRUE + showCSOCreatorId = TRUE + showCSONumSeedPoints = TRUE + showCSONumPathPoints = TRUE + showCSOLength = FALSE + showCSOGrouping = TRUE + showCSOClosedState = TRUE + showCSOInPlane = TRUE + showGroupNumCSO = TRUE + showGroupCSOIds = TRUE + listenToRepaintNotifications = FALSE + listenToFinishingNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + } +} +module LocalImage { + internal { + frame = "-295 405 96 56" + moduleGroupName = "" + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module View2D { + internal { + frame = "-379 29 120 56" + moduleGroupName = "Set Group properties" + windows { + window _default { + geometry = "188 481 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = TRUE + view2DExtensionsOn = TRUE + startSlice = 42 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 2047.5 + lutWidth = 4095 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 42.5" + } + internalFields = "" +} +module SoView2DCSOEditor { + internal { + frame = "-283 181 152 56" + moduleGroupName = "Set Group properties" + windows { + window _default { + geometry = "-44 19 558 465" + sizeHint = "558 465" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DCSOEditor + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 24 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = TRUE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + shouldListenToRepaintEvents = TRUE + shouldListenToSelectionChangedEvents = TRUE + shouldListenToFinishedEvents = TRUE + generalInteractionMode = INTERACTION_MODE_EDIT + generalInteractionModeToggleKey = TOGGLE_MODE_ALT + useAntiAliasing = TRUE + useInterpolationTargetColor = TRUE + interpolationTargetColor = "1 0 0" + showBoundingBox = FALSE + boundingBoxAlpha = 0.5 + boundingBoxColor = "1 1 1" + showOnlyParallelCSOs = FALSE + showParallelDotProductLimitRadian = 0.9998999834 + shouldLevelCSO = FALSE + useStylePalette = FALSE + stylePaletteUseIndexAs = USE_INDEX_FOR_CSO + labelShowMode = LABEL_SHOW_GROUP_DESCRIPTION + labelAlignmentMode = LABEL_ALIGN_CENTER + labelUnitScale = LABEL_UNIT_SCALE_MM + showLabelUnits = TRUE + labelFontSize = 12 + labelUseTextShadow = TRUE + labelMarginX = 2 + labelMarginY = 2 + ghostMode = GHOST_BOTH_SIDES + ghostUnitMode = GHOST_UNIT_SLICE + ghostStyleAlpha = TRUE + ghostStyleStipple = TRUE + ghostStyleLineWidth = FALSE + ghostStyleBrighten = FALSE + ghostDepth = 5 + generalLabelColor = "1 1 1" + generalLabelAlpha = 1 + labelColorMode = COLOR_GENERAL + useTesselation = FALSE + tesselationColorMode = COLOR_AS_CSO + tesselationColor = "0.8999999761581421 0.5 0.8999999761581421"... [truncated message content] |
From: <rha...@us...> - 2010-03-05 12:04:48
|
Revision: 232 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=232&view=rev Author: rhameeteman Date: 2010-03-05 12:04:36 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added a new MLCMCurveList project with two new modules: CurveFilter StringToCurve Added Paths: ----------- trunk/Community/General/Modules/ML/MLCMCurveList/ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/ trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab trunk/Community/General/Sources/ML/MLCMCurveList/ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h Added: trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,101 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>CurveFilter</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module filters out curves from a curvlist based on the given min and max index. Additionally it can crop all curves between two indices. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect the input curve list,specify the first and last index and press Update or select "Auto update". +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>The min and max of the Set specify the first and last CurveData object from a CurveList object. If one of the CurveData objects from the CurveList has more than one series defined, you can choose the first and last index of the Series of all CurveData objects in the list. If all CurveData objects only have one series defined, you cannot choose the Series.<br/> +The output curves can also be croped to a specified start and end index.<br/> +If "Auto update" is selected, the module reacts on all input and parameter changes +</blockquote> + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>inCurveList</b> + Input CurveData or CurveList object + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outCurveList</b> + Filtered CurveList + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>update</b> + Update the output + </li> + <li> + <b>autoUpdate</b> + Auto update on input or parameter changes + </li> + <li> + <b>minCurveSet</b> + First curve set to be copied to the output + </li> + <li> + <b>maxCurveSet</b> + Last curve set to be copied to the output + </li> + <li> + <b>minCurve</b> + First curve to be copied to the output + </li> + <li> + <b>maxCurve</b> + Last curve to be copied to the output + </li> + <li> + <b>cropCurve</b> + Crop all autoput curves + </li> + <li> + <b>start</b> + First index of the croped curve + </li> + <li> + <b>end</b> + Last index of the croped curve + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,470 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoView2DMarkerEditor { + internal { + frame = "-119 -123 160 56" + moduleGroupName = "" + windows { + window _default { + geometry = "635 95 435 831" + sizeHint = "435 831" + wasOpen = no + wasActive = no + } + } + } + fields { + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + depthVisibility = 1 + snapToVoxel = TRUE + snapToSlice = TRUE + currentType = 0 + deleteOnClick = FALSE + addOnClick = TRUE + alphaFactor = 1 + iconFile = $(MLAB_MeVisLab_Standard)/Modules/Resources/Images/markerIcons.tif + internalIconFile = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Standard/Modules/Resources/Images/markerIcons.tif" + useIconFile = FALSE + iconIdx = 0 + selectingOn = TRUE + actOnReleaseOnly = FALSE + editorMode = EDIT_MARKER + colorMode = COLOR_BY_INDEX + textColorMode = COLOR_TEXT + textMode = TEXT_OFF + textColor = "1 1 1" + textShadow = TRUE + textFontSize = 12 + showTextOnlyForSelectedMarker = FALSE + cutText = FALSE + maxNumberOfLines = 1 + vectorArrow = VECTOR_END_ARROW + useAntiAlias = FALSE + currentStyleIndex = 1 + depthVectorDrawMode = DRAW_NONE + drawMode = DRAW_MARKER + selectiveDrawing = FALSE + selectionBoxesForCurrentOnly = FALSE + cooperative = FALSE + busy = FALSE + instanceName = SoView2DMarkerEditor + listString = "" + numItems = 10 + index = 9 + persistent = FALSE + listStringEnable = FALSE + ownsList = TRUE + applySelect = FALSE + id = 10 + name = "" + newName = "" + actionClass = Modify + actionIndex = 9 + actionId = 10 + currentIndex = 9 + overflowMode = None + maxSize = 0 + useInsertTemplate = FALSE + upToDate = TRUE + posXYZ = "-78.75 -69.94419860839844 7.032798767089844" + posC = 0 + posT = 0 + posU = 0 + vecXYZ = "0 0 0" + type = 0 + newPosXYZ = "0 0 0" + newPosC = 0 + newPosT = 0 + newPosU = 0 + newVecXYZ = "0 0 0" + newType = 0 + } +} +module View2D { + internal { + frame = "-211 -227 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "75 239 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + window Settings { + geometry = "29 51 265 290" + sizeHint = "265 290" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = TRUE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 5 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 242.2030945 + lutWidth = 453.5469055 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 1 0 -69.94419860839844" + } + internalFields = "" +} +module Diagram2D { + internal { + frame = "89 -299 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "246 265 458 405" + sizeHint = "458 405" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 5 + autoRangeX = TRUE + minY = -23 + maxY = 41 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = FALSE + diagramTitleString = "" + borderH = 30 + autoBorderH = TRUE + borderV = 25 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 0.709764 0.369494" + lineStyle = Solid + markerType = Square + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = 1.265059948 + mousePosY = 17.40570068 + mousePosValid = TRUE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = TRUE + } +} +module SoRenderArea { + internal { + frame = "81 -363 112 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "796 119 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoRenderArea + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = DELAYED_BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 15 + frameRateAvi = 7 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + } +} +module DynaCurve { + internal { + frame = "125 -123 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "224 243 334 326" + sizeHint = "334 326" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = DynaCurve + displayPoints = TRUE + displayROIs = TRUE + ROIMode = All + ROIData = Mean + ROIStyle = ErrorBar + refTime = 0 + refTimeEnable = TRUE + refTimeMode = Difference + timeUnit = Seconds + timeData = NonConstant + timeDataValid = FALSE + dataUnit = "" + dataSymbol = E + ImageLabel = "" + } +} +module StylePalette { + internal { + frame = "-55 -19 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "26 59 632 433" + sizeHint = "632 433" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 2 + markerSize2 = 2 + markerSize3 = 2 + markerSize4 = 2 + markerSize5 = 2 + markerSize6 = 2 + markerSize7 = 2 + markerSize8 = 2 + markerSize9 = 2 + markerSize10 = 2 + markerSize11 = 2 + markerSize12 = 2 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module LocalImage { + internal { + frame = "-63 125 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "180 199 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/dmribreast.dcm + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.dcm" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module CurveFilter { + internal { + frame = "137 -195 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "202 515 304 264" + sizeHint = "304 264" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = CurveFilter + autoUpdate = TRUE + numberOfCurveSets = 9 + minCurve = 0 + maxCurve = 0 + numberOfCurves = 0 + cropCurve = FALSE + start = 0 + end = 0 + } +} +connections { + SoView2DMarkerEditor.stylePalette = StylePalette.outStylePalette + View2D.inImage = LocalImage.outImage + View2D.inInvPreLUT = SoView2DMarkerEditor.self + Diagram2D.inStylePalette = StylePalette.outStylePalette + Diagram2D.inCurveList = CurveFilter.outCurveList + SoRenderArea.children = Diagram2D.outNode + DynaCurve.input0 = LocalImage.outImage + DynaCurve.inPointList = SoView2DMarkerEditor.outXMarkerList + CurveFilter.inCurveList = DynaCurve.outCurveList +} +networkModel = "" Added: trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,117 @@ +//---------------------------------------------------------------------------------- +//! MLCMCurveList module definitions. +/*! +// \file MLCMCurveList.def +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule CurveFilter +//---------------------------------------------------------------------------------- +MLModule CurveFilter { + DLL = "MLCMCurveList" + group = "BIGR" + genre = "Diagram" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Select a curve from the curveList or curveSet" + keywords = "curveList curveData curve filter" + seeAlso = "CurveArithmetic CatCurves" + documentation = "$(LOCAL)/CurveFilter/CurveFilter.html" + exampleNetwork = "$(LOCAL)/CurveFilter/CurveFilterExample.mlab" + + Description { + Field minCurveSet { + min = 0 + max = numberOfCurveSets + deprecatedName = curveSet + persistent = No + } + Field maxCurveSet { + min = 0 + max = numberOfCurveSets + persistent = No + } + Field minCurve { + min = 0 + max = numberOfCurves + deprecatedName = curve + } + Field maxCurve { + min = 0 + max = numberOfCurves + } + } + Window { + Vertical { + Box Select { + Horizontal { + Label {title = Set labelAlignGroup = g0} + Field minCurveSet { title = "" } + IntervalSlider { + expandX = true + step = 1 + snap = 0 + lowerField = minCurveSet + upperField = maxCurveSet + } + Field maxCurveSet { title = "" } + } + Horizontal { + Label {title = Series labelAlignGroup = g0 } + Field minCurve { title = "" } + IntervalSlider { + expandX = true + step = 1 + snap = 0 + lowerField = minCurve + upperField = maxCurve + } + Field maxCurve { title = "" } + } + } + Box Crop { + CheckBox cropCurve {} + Field start { dependsOn = cropCurve } + Field end { dependsOn = cropCurve } + } + Box Update{ + layout = Horizontal + Button update {} + CheckBox autoUpdate {} + } + } + } +} // MLModule CurveFilter + + +//---------------------------------------------------------------------------------- +// MLModule StringToCurve +//---------------------------------------------------------------------------------- +MLModule StringToCurve { + DLL = "MLCMCurveList" + group = "BIGR" + genre = Diagram + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Convert a string into a curve" + keywords = "string curve convert curvelist curvedata" + seeAlso = "PrintCurves" + documentation = "$(LOCAL)/StringToCurve/StringToCurve.html" + exampleNetwork = "$(LOCAL)/StringToCurve/StringToCurveExample.mlab" + +Window { + Box { + Horizontal { + Field curveSeparator { title = curveSeparators } + Field valueSeparator { title = valueSeparators } + } + Field curveString {} + Field indexString {} + } +} + +} // MLModule StringToCurve Added: trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,69 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>StringToCurve</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module can be used to generate a curve or multiple curves by splitting a string based on seperation characters for curves and values +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Simply supply the string and specify the splitting characters +</blockquote> + + + + + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outCurveList</b> + CurveList containing the generated curves + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>curveString</b> + String containing all the curve data + </li> + <li> + <b>indexString</b> + Optional string with the indices of all the curve points + </li> + <li> + <b>valueSeparator</b> + Characters that split the curve into values + </li> + <li> + <b>curveSeparator</b> + Characters that split the string into curves + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,228 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoRenderArea { + internal { + frame = "65 -267 112 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "524 189 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoRenderArea + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + } +} +module StylePalette { + internal { + frame = "-31 -59 96 56" + moduleGroupName = "" + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 4 + markerSize2 = 4 + markerSize3 = 4 + markerSize4 = 4 + markerSize5 = 4 + markerSize6 = 4 + markerSize7 = 4 + markerSize8 = 4 + markerSize9 = 4 + markerSize10 = 4 + markerSize11 = 4 + markerSize12 = 4 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module Diagram2D { + internal { + frame = "73 -179 96 56" + moduleGroupName = "" + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 4 + autoRangeX = TRUE + minY = -1 + maxY = 11 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = FALSE + diagramTitleString = "" + borderH = 26 + autoBorderH = TRUE + borderV = 25 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 1 1" + lineStyle = Solid + markerType = None + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = -0.3023256063 + mousePosY = 11.83236885 + mousePosValid = TRUE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = TRUE + } +} +module StringToCurve { + internal { + frame = "73 -59 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "145 569 327 97" + sizeHint = "327 97" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StringToCurve + curveString = "1 2 3 4 5;0 2 4 6 8@-1.2.5.8.11" + indexString = "" + valueSeparator = " ." + curveSeparator = ";@" + } +} +connections { + SoRenderArea.children = Diagram2D.outNode + Diagram2D.inStylePalette = StylePalette.outStylePalette + Diagram2D.inCurveList = StringToCurve.outCurveList +} +networkModel = "" Added: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,237 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CurveFilter. +/*! +// \file mlCurveFilter.cpp +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "mlCurveFilter.h" +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(CurveFilter, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +CurveFilter::CurveFilter (void) + : BaseOp(0, 0), m_InCurveList(0) +{ + ML_TRACE_IN("CurveFilter::CurveFilter()"); + + handleNotificationOff(); + + FieldContainer *fields = getFieldContainer(); + + m_InCurveList = NULL; + f_InCurveList = fields->addBase( "inCurveList" ); + f_InCurveList->setBaseValue( m_InCurveList ); + + m_OutCurveList = new CurveList; + f_OutCurveList = fields->addBase( "outCurveList" ); + f_OutCurveList->setBaseValue( m_OutCurveList ); + + f_Update = fields->addNotify( "update" ); + f_AutoUpdate = fields->addBool( "autoUpdate" ); + f_AutoUpdate->setBoolValue( false ); + + f_MinCurveSet = fields->addInt( "minCurveSet" ); + f_MinCurveSet->setIntValue( 0 ); + + f_MaxCurveSet = fields->addInt( "maxCurveSet" ); + f_MaxCurveSet->setIntValue( 0 ); + + f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); + f_NumberOfCurveSets->setIntValue( 0 ); + + f_MinCurve = fields->addInt("minCurve"); + f_MinCurve->setIntValue( 0 ); + + f_MaxCurve = fields->addInt("maxCurve"); + f_MaxCurve->setIntValue( 0 ); + + f_NumberOfCurves = fields->addInt( "numberOfCurves" ); + f_NumberOfCurves->setIntValue( 0 ); + + f_CropCurve = fields->addBool( "cropCurve" ); + f_CropCurve->setBoolValue( false ); + + f_XStart = fields->addFloat( "start" ); + f_XStart->setFloatValue( 0.0f ); + + f_XEnd = fields->addFloat( "end" ); + f_XEnd->setFloatValue( 0.0f ); + + handleNotificationOn(); +} + + +CurveFilter::~CurveFilter(void) +{ + ResetOutput(); + delete m_OutCurveList; +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void CurveFilter::handleNotification (Field *field) +{ + ML_TRACE_IN("CurveFilter::handleNotification()"); + + if ( field == f_InCurveList ) { + m_SingleCurveList.clear(); + if ( f_InCurveList->getBaseValue() ) { + Base* inList = f_InCurveList->getBaseValue(); + m_InCurveList = NULL; + if ( BASE_IS_A(inList, CurveData) ) { + // Input is a single curve + m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( inList ) ); + m_InCurveList = &m_SingleCurveList; + } + else if ( BASE_IS_A( inList, CurveList) ) { + // Input is not a CurveData object or a CurveList + m_InCurveList = static_cast<CurveList*>( f_InCurveList->getBaseValue() ); + } + } + SetMaxValues(); + + if ( m_InCurveList != NULL ) { + if ( f_AutoUpdate->getBoolValue() ){ + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } else { + ResetOutput(); + f_OutCurveList->notifyAttachments(); + } + + } else + if ( field == f_Update || + (f_AutoUpdate->getBoolValue() && + (field == f_AutoUpdate || + field == f_MinCurveSet || + field == f_MaxCurveSet || + field == f_MinCurve || + field == f_MaxCurve || + field == f_CropCurve || + (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) + ))){ + if ( m_InCurveList != NULL ){ + if ( m_InCurveList->getNumCurves() > 0 ){ + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } + } +} + + +void CurveFilter::ResetOutput() +{ + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } +} + + +void CurveFilter::SetMaxValues() +{ + int nCurveSets = 0; + int nCurves = 0; + if ( m_InCurveList != NULL ){ + nCurveSets = m_InCurveList->getNumCurves(); + for (int iSet = 0; iSet < nCurveSets; ++iSet ) { + nCurves = max( nCurves, m_InCurveList->getCurveData( iSet )->getNumSeries() ); + } + } + f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); + f_NumberOfCurves->setIntValue( nCurves-1 ); +} + + +void CurveFilter::SetOutputCurve(){ + + ResetOutput(); + + // Check for valid field values + // Curves are numbered from 0 + int nCurveSets = m_InCurveList->getNumCurves(); + if ( nCurveSets == 0 ) {return;} + int minSet = max( 0, f_MinCurveSet->getIntValue() ); + int maxSet = max( minSet, f_MaxCurveSet->getIntValue() ); + maxSet = min( maxSet, nCurveSets-1 ); + for (int iSet = minSet; iSet <= maxSet; ++iSet ) { + + int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); + if (nCurves == 0 ) {continue;} + int minCurve = max(0,f_MinCurve->getIntValue() ); + int maxCurve = max(minCurve, f_MaxCurve->getIntValue() ); + maxCurve = min(maxCurve, nCurves-1 ); + for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { + + CurveData *curveSet = m_InCurveList->getCurveData( iSet ); + CurveData *outputCurve = new CurveData( *curveSet ); + outputCurve->clearData(); + std::vector< float > xSeries; + std::vector< float > ySeries; + + // Copy/Crop curve values + bool crop = f_CropCurve->getBoolValue(); + float minX = f_XStart->getFloatValue(); + float maxX = f_XEnd->getFloatValue(); + minX = min(minX,maxX); + for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ + float xValue = curveSet->getXValue( iX ); + if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { + ySeries.push_back( curveSet->getYValue( minCurve, iX) ); + xSeries.push_back( xValue ); + } + } + outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); + outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); + + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } +} + + +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,123 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CurveFilter. +/*! +// \file mlCurveFilter.h +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlCurveFilter_H +#define __mlCurveFilter_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Select a curve from the curveList or curveSet +class MLCMCURVELIST_EXPORT CurveFilter : public BaseOp +{ +public: + + //! Constructor. + CurveFilter (void); + + //! Destructor + ~CurveFilter(void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + void SetOutputCurve(); + + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(CurveFilter); + + //! Remove any existing output curves + void ResetOutput(); + + //! Set the maximum values allowed for curves and series. + void SetMaxValues(); + + //! Input curve data + CurveList *m_InCurveList; + BaseField *f_InCurveList; + CurveList m_SingleCurveList; + + //! Output curve data + CurveList *m_OutCurveList; + BaseField *f_OutCurveList; + + //! Update modes + NotifyField *f_Update; + BoolField *f_AutoUpdate; + + //! Curve set range + IntField *f_MinCurveSet; + IntField *f_MaxCurveSet; + + //! Curve series range + IntField *f_MinCurve; + IntField *f_MaxCurve; + + //! Number of curves present in input + IntField *f_NumberOfCurveSets; + + //! Number of series present in input + IntField *f_NumberOfCurves; + + //! Crop the curve? + BoolField *f_CropCurve; + FloatField *f_XStart; + FloatField *f_XEnd; + +}; + + +ML_END_NAMESPACE + +#endif // __mlCurveFilter_H + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" MLCMCurveList Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,50 @@ +# ----------------------------------------------------------------------------- +# MLCMCurveList project profile +# +# \file MLCMCurveList.pro +# \author Reinhard Hameeteman +# \date 2010-03-05 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = MLCMCurveList + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# add dependencies of this project here + +CONFIG += dll ML MLBase newmat nr EMCUtilities inventor MLOpenGL boost + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + + +MLAB_PACKAGES += MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += MLCMCURVELIST_EXPORTS + +HEADERS += \ + MLCMCurveListInit.h \ + MLCMCurveListSystem.h \ + CurveFilter/mlCurveFilter.h \ + StringToCurve/mlStringToCurve.h \ + +SOURCES += \ + MLCMCurveListInit.cpp \ + CurveFilter/mlCurveFilter.cpp \ + StringToCurve/mlStringToCurve.cpp \ + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/MLCMCurveList/MLCMCurveList.def + + + + + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Run this script to create a Makefile for your project +# + +# Check for Mac OS X +if [ "`uname -s`" = "Darwin" ]; then + +echo "Please use 'open -b de.mevis.MeVisLab.MacProfileTranslator MLCMCurveList.pro' or 'open MLCMCurveList.pro'" + +# Linux case +else + +# Print usage-info +function usage () { + echo "MLCMCurveList [-d|-r]" + echo "Creates Makefile.MLCMCurveList - run \"make -f Makefile.MLCMCurveList\" to build your module" + echo " -r : create Makefile for release-version (libMLCMCurveList.so)" + echo " -d : create Makefile for debug-version (libMLCMCurveList_d.so)" + exit 1 +} + +# Check arguments +if test "(" "$#" -gt "1" ")" -o "(" "(" "$#" = "1" ")" -a "(" "$1" != "-r" ")" -a "(" "$1" != "-d" ")" ")" +then + usage +fi + +# Switch debug/release/default +if [ "$1" = "-d" ];then + DEBUG=1 +elif [ "$1" = "-r" ];then + DEBUG=0 +else + DEBUG=$(cat /proc/$PPID/cmdline|grep -c MeVisLab_d) +fi + +if [ "$DEBUG" = "1" ];then + VERSION="Debug-Version" + FLAG="debug" + EXT="_d" +else + VERSION="Release-Version" + FLAG="release" + EXT="" +fi + +echo "Creating Makefile.MLCMCurveList for $VERSION (libMLCMCurveList$EXT.so)" +qmake -t lib -o Makefile.MLCMCurveList "CONFIG+=$FLAG" "CONFIG+=MeVisLab" MLCMCurveList.pro + +fi + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMCurveListInit.cpp +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "MLCMCurveListSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... + + +#include "CurveFilter/mlCurveFilter.h" +#include "StringToCurve/mlStringToCurve.h" + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int MLCMCurveListInit (void) +{ + ML_TRACE_IN("MLCMCurveListInit ()") + + // Add initClass calls from all other modules here... + + CurveFilter::initClass(); + StringToCurve::initClass(); + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(MLCMCurveListInit) + + + + + + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMCurveListInit.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMCurveListInit_H +#define __MLCMCurveListInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int MLCMCurveListInit (void); + +ML_END_NAMESPACE + +#endif // __MLCMCurveListInit_H + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLCMCurveListSystem.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMCurveListSystem_H +#define __MLCMCurveListSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef MLCMCURVELIST_EXPORTS +// Use the MLCMCURVELIST_EXPORT macro to export classes and functions +#define MLCMCURVELIST_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define MLCMCURVELIST_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define MLCMCURVELIST_EXPORT +#endif + + +#endif // __MLCMCurveListSystem_H + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,171 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class StringToCurve. +/*! +// \file mlStringToCurve.cpp +// \author Reinhard Hameeteman +// \date 2009-03-18 +// +// Convert a string into a curve +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlStringToCurve.h" + +#include <boost/algorithm/string.hpp> +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(StringToCurve, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +StringToCurve::StringToCurve () : BaseOp(0, 0) +{ + ML_TRACE_IN("StringToCurve::StringToCurve ()") + + handleNotificationOff(); + + FieldContainer *fieldC = getFieldContainer(); + + m_OutCurveList = new CurveList; + f_OutCurveList = fieldC->addBase( "outCurveList" ); + f_OutCurveList->setBaseValue( m_OutCurveList ); + + f_CurveString = fieldC->addString("curveString"); + f_CurveString->setStringValue(""); + + f_IndexString = fieldC->addString("indexString"); + f_IndexString->setStringValue(""); + + f_ValueSeparator = fieldC->addString("valueSeparator"); + f_ValueSeparator->setStringValue(" "); + + f_CurveSeparator = fieldC->addString( "curveSeparator" ); + f_CurveSeparator->setStringValue(";"); + + handleNotificationOn(); +} + + +StringToCurve::~StringToCurve() +{ + // Remove any existing curves + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } + delete m_OutCurveList; +} + + +void StringToCurve::activateAttachments() +{ + UpdateCurve(); + f_OutCurveList->notifyAttachments(); + BaseOp::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void StringToCurve::handleNotification (Field *field) +{ + ML_TRACE_IN("StringToCurve::handleNotification ()"); + + UpdateCurve(); + f_OutCurveList->notifyAttachments(); +} + + +void StringToCurve::UpdateCurve() +{ + // Remove any existing curves + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } + + std::string dataString = f_CurveString->getStringValue(); + dataString.append( f_CurveSeparator->getStringValue() ); + + std::string indexString = f_IndexString->getStringValue(); + std::vector< float > indexValues; + if (indexString.length() != 0 ){ + StringToVector(indexString, indexValues ); + } + + if ( dataString.length() > 0 ){ + // Split string into curves + std::vector<std::string> curves; + boost::split(curves, dataString, boost::is_any_of(f_CurveSeparator->getStringValue() )); + + // Iterate over curves + std::vector<std::string>::iterator stringIt = curves.begin(); + for (;stringIt < curves.end(); ++stringIt ){ + std::string curCurve = *stringIt; + if (curCurve.length() == 0) {continue;} + // Remove leading and trailing spaces + boost::trim( curCurve ); + std::vector< MLfloat > curveValues; + StringToVector( curCurve, curveValues ); + CurveData *outputCurve = new CurveData; + outputCurve->setY( curveValues.size(),&curveValues[0], 1 ); + if ( f_IndexString->getStringValue().length() != 0 ){ + outputCurve->setX( indexValues.size(),&indexValues[0], 1 ); + } + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } +} + + +void StringToCurve::StringToVector(std::string valueString, std::vector< MLfloat > &valueVector ) +{ + if (valueString.length() > 0){ + // Split string into values + std::vector<std::string> values; + boost::split(values, valueString, boost::is_any_of(f_ValueSeparator->getStringValue() )); + + // Iterate over the values + std::vector<std::string>::iterator valueIt = values.begin(); + for (;valueIt < values.end(); ++valueIt ){ + MLfloat curValue; + std::stringstream strm(*valueIt); + strm >> curValue; + valueVector.push_back( curValue ); + } + } +} +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,104 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class StringToCurve. +/*! +// \file mlStringToCurve.h +// \author Reinhard Hameeteman +// \date 2009-03-18 +// +// Convert a string into a curve +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlStringToCurve_H +#define __mlStringToCurve_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Convert a string into a curve +class MLCMCURVELIST_EXPORT StringToCurve : public BaseOp +{ +public: + + //! Constructor. + StringToCurve (); + + ~StringToCurve(); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + + //! Ensure the output is up to date on copying the module + virtual void activateAttachments(); + + //! Curve data + BaseField *f_OutCurveList; + + //! String containing all curves + StringField *f_CurveString; + + //! String with index values that are used for all curves + StringField *f_IndexString; + + //! Characters that separate the curves in the curvesString + StringField *f_ValueSeparator; + + //! Characters that separate the values in the curvesString + StringField *f_CurveSeparator; + +private: + + //! CurveList containing the output curves + CurveList *m_OutCurveList; + + //! Actual conversion method + void UpdateCurve(); + + //! Convert a string to a vector of floats + void StringToVector(std::string valueString, std::vector< MLfloat > &valueVector ); + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(StringToCurve) +}; + + +ML_END_NAMESPACE + +#endif // __mlStringToCurve_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-05 13:44:21
|
Revision: 233 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=233&view=rev Author: rhameeteman Date: 2010-03-05 13:44:11 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added project MLCMCoordinate containing two modules: WorldInfo BoxArithmetic Added Paths: ----------- trunk/Community/General/Modules/ML/MLCMCoordinate/ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab trunk/Community/General/Sources/ML/MLCMCoordinate/ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinate.bat trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinate.pro trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinate.sh trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateInit.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateInit.h trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateSystem.h trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/ trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.h Added: trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,61 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> + +<hr WIDTH="100%"></center> +<h2>BoxArithmetic</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module can be used to perform several operations on boxes. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Select the OperationMode and the appropriate Input for Box0 and Box1. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Box0 and Box1 can be obtained form input0 and input1 respectively or from the scalar, vector or box fileds. If you select input0 or input1, UseVoxelCenter can be used to use (0.5,0.5,0.5) as origin of the image (seems to be needed when connecting the output box to a SubImage module).<br/> +The following operations are available: +<table> +<tr><td>ExpandScalar:</td><td>Box.v1 = Box0.v1-Constant (applied to all components)</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+Constant (applied to all components)</td></tr> + +<tr><td>AddScalar:</td><td>Box.v1 = Box0.v1+Constant (applied to all components)</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+Constant (applied to all components)</td></tr> + +<tr><td>ExpandVector:</td><td>Box.v1 = Box0.v1-v1</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+v1</td></tr> + +<tr><td>AddVector:</td><td>Box.v1 = Box0.v1+v1</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+v1</td></tr> + +<tr><td>InterSect:</td><td>Box = Box0 ∩ Box1</td></tr> + +<tr><td>Union:</td><td>Box = Box0 ∪ Box1</td></tr> +</table> +</blockquote> + + + + + + + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,170 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module View2D { + internal { + frame = "-87 -331 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "13 122 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = FALSE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 2047.5 + lutWidth = 4095 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 0.5" + } + internalFields = "" +} +module SubImage { + internal { + frame = "-155 -131 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "177 107 559 353" + sizeHint = "559 353" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SubImage + boxInput = "-10 -20 0 0 0 0 63.5 63.5 63.5 0 0 0" + autoApplyBox = TRUE + x = -10 + sx = 63.5 + modifyX = TRUE + y = -20 + sy = 63.5 + modifyY = TRUE + z = 0 + sz = 63.5 + modifyZ = TRUE + c = 0 + sc = 0 + modifyC = FALSE + t = 0 + st = 0 + modifyT = FALSE + u = 0 + su = 0 + modifyU = FALSE + fillValue = 0 + mode = WorldStartEnd + autoApply = TRUE + } +} +module BoxArithmetic { + internal { + frame = "-39 -131 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "635 123 424 636" + sizeHint = "530 636" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = BoxArithmetic + inputBox0 = "0 0 0 0 0 0 -1 -1 -1 -1 -1 -1" + inputBox1 = "0 0 0 0 0 0 -1 -1 -1 -1 -1 -1" + correctInput0 = FALSE + correctInput1 = TRUE + useVoxelCenter = TRUE + correctBox = FALSE + constant = 0 + v1 = "40 40 40 0 0 0" + v2 = "-10 -20 0 0 0 0" + x1 = 0 + y1 = 0 + z1 = 0 + c1 = 0 + t1 = 0 + u1 = 0 + x2 = -1 + y2 = -1 + z2 = -1 + c2 = -1 + t2 = -1 + u2 = -1 + operationMode = Unify + inputMode0 = Input0 + inputMode1 = Vectors + } +} +module LocalImage { + internal { + frame = "-119 -3 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "573 556 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +connections { + View2D.inImage = SubImage.output0 + SubImage.input0 = LocalImage.outImage + SubImage.boxInput = BoxArithmetic.outputBox + BoxArithmetic.input0 = LocalImage.outImage +} +networkModel = "" Added: trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,130 @@ +//---------------------------------------------------------------------------------- +//! MLCMCoordinate module definitions. +/*! +// \file MLCMCoordinate.def +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule WorldInfo +//---------------------------------------------------------------------------------- +MLModule WorldInfo { + DLL = "MLCMCoordinate" + group = "BIGR" + genre = "Info" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Adds World dimensions image information to the Info module" + keywords = "Info size world matrix voxel dimension extent" + seeAlso = "Info" + documentation = "$(LOCAL)/WorldInfo/WorldInfo.html" + exampleNetwork = "$(LOCAL)/WorldInfo/WorldInfoExample.mlab" + externalDefinition = "$(LOCAL)/WorldInfo/WorldInfo.script" +} // MLModule WorldInfo + + +//---------------------------------------------------------------------------------- +// MLModule BoxArithmetic +//---------------------------------------------------------------------------------- +MLModule BoxArithmetic { + DLL = "MLCMCoordinate" + group = "BIGR" + genre = "Geometry" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Perform simple calculations on a (image) box" + keywords = "box expand augment" + seeAlso = "VecBoxConvert" + documentation = "$(LOCAL)/BoxArithmetic/BoxArithmetic.html" + exampleNetwork = "$(LOCAL)/BoxArithmetic/BoxArithmeticExample.mlab" + + Description { + Field outputBox { persistent = No } + Field outputBox0 { persistent = No } + Field outputBox1 { persistent = No } + Field outputExtent { persistent = No } + Field outV1 { persistent = No } + Field outV2 { persistent = No } + } + Window { + Vertical { + Box Mode { + Horizontal { + Field operationMode {} + CheckBox useVoxelCenter { dependsOn = "* inputMode0 == "Input0" || inputMode1 == "Input1" *" } + } + } + Box "Input Selection" { + Horizontal { + alignX = Left + Label { title = "Box0:" alignGroupX = c1 } + ButtonBar inputMode0 { show = Radio } + CheckBox correctInput0 { title = Correct } + } + Horizontal { + alignX = Left + Label { title = "Box1:" alignGroupX = c1 } + ButtonBar inputMode1 { show = Radio } + CheckBox correctInput1 { title = Correct } + } + } + Box "Scalar Input" { + style { Prototype Field {parent = Field expandX = Yes} } + Vertical { + dependsOn = "* inputMode0 == "Scalars" || + inputMode1 == "Scalars" *" + Horizontal { + Field x1 {} + Field y1 {} + Field z1 {} + Field c1 {} + Field t1 {} + Field u1 {} + } + Horizontal { + Field x2 {} + Field y2 {} + Field z2 {} + Field c2 {} + Field t2 {} + Field u2 {} + } + } + Field constant { + expandX = No + dependsOn = "* operationMode == "ExpandScalar" || + operationMode == "AddScalar" *" + } + } + Box "Vector Input" { + dependsOn = "* operationMode == "AddVector" || + operationMode == "ExpandVector" || + inputMode0 == "Vectors" || + inputMode1 == "Vectors" *" + Field v1 { alignGroupX = c1 } + Field v2 { alignGroupX = c1 dependsOn = "* inputMode0 == "Vectors" || inputMode1 == "Vectors"*"} + } + Box "Box Input" { + Field inputBox0 { title = "Box0:" alignGroupX = c1 dependsOn = "* inputMode0 == "Box"*" } + Field inputBox1 { title = "Box1:" alignGroupX = c1 dependsOn = "* inputMode1 == "Box"*" } + } + Box "Output" { + style { Prototype Field { parent = Field edit = No alignGroupX = oc1 } } + Field outputBox0 { title = Box0 } + Field outputBox1 { title = Box1 } + Horizontal { + Field outputBox { title = Box: } + CheckBox correctBox { title = correct } + } + Field outputExtent { title = Size: } + Field outV1 { title = v1: } + Field outV2 { title = v2: } + } + } + } + +} // MLModule BoxArithmetic + Added: trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,44 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Details">Details</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2></h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module is an extension of the Info module. It has an extra tab with information about the world dimensions of the input image and has some extra fields with sizes as vectors. This help file only explains the World tab, for the other tabs please take a look at the help of the Info module. +</blockquote> + + + +<h3><a NAME=Details></a>Details</h3> +<blockquote>The different world coordinate parameters of the image can be determined as an axis aligned box or as a image aligned box. These two modes only differ if the VoxelToWorld matrix of the image has a rotation. If "UseVoxelCenter" is checked (0.5,0.5,0.5) is taken as origin otherwise (0,0,0) is used. Similarly for the extent (sizeX-0.5,sizeY-0.5,sizeZ-0.5) and (sizeX-1,sizeY-1,sizeZ-1) are used respectively. UseVoxelCenter may be of use for modules that use the voxel center as the origin of the image (ITK standard). If "IncludeAllVoxels" is checked the origin and extent are (0,0,0) and (sizeX,sizeY,sizeZ) respectively. This last option may be helpfull for visulasation of the image boundaries.<br/> + +Size = Extent-Origin<br/> +Center = 0.5*(box.v1+box.v2)<br/> +Box.v1 = Origin<br/> +Box.v2 = Extent<br/> +Rotation = rotation present in the VoxelToWorld matrix<br/> +</blockquote> + + +<h3><a NAME=Example></a>Example</h3> +<blockquote> + The example network show a visualisation of the different world parameters. + Toggle IncludeAllVoxels and UseVoxelCenter to see their effect. +</blockquote> + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,396 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! WorldInfo module definitions. +/*! +// \file WorldInfo.script +// \author Reinhard Hameeteman +// \date 2008-10-03 +*/ +//---------------------------------------------------------------------------------- + +Description { + Field sizeX { persistent = NO deprecatedName = "X" } + Field sizeY { persistent = NO deprecatedName = "Y" } + Field sizeZ { persistent = NO deprecatedName = "Z" } + Field sizeC { persistent = NO deprecatedName = "C" } + Field sizeT { persistent = NO deprecatedName = "T" } + Field sizeU { persistent = NO deprecatedName = "U" } + Field size { persistent = NO } + + Field pageSizeX { persistent = NO deprecatedName = "PX" } + Field pageSizeY { persistent = NO deprecatedName = "PY" } + Field pageSizeZ { persistent = NO deprecatedName = "PZ" } + Field pageSizeC { persistent = NO deprecatedName = "PC" } + Field pageSizeT { persistent = NO deprecatedName = "PT" } + Field pageSizeU { persistent = NO deprecatedName = "PU" } + Field pageSize { persistent = NO } + + Field minValue { persistent = NO deprecatedName = "Min" } + Field maxValue { persistent = NO deprecatedName = "Max" } + + Field voxelSizeX { persistent = NO deprecatedName = "VX" } + Field voxelSizeY { persistent = NO deprecatedName = "VY" } + Field voxelSizeZ { persistent = NO deprecatedName = "VZ" } + Field voxelSize { persistent = NO } + + Field originX { persistent = NO } + Field originY { persistent = NO } + Field originZ { persistent = NO } + Field origin { persistent = NO } + + Field extentX { persistent = NO } + Field extentY { persistent = NO } + Field extentZ { persistent = NO } + Field extent { persistent = NO } + + Field worldSizeX { persistent = NO } + Field worldSizeY { persistent = NO } + Field worldSizeZ { persistent = NO } + Field worldSize { persistent = NO } + + Field centerX { persistent = NO } + Field centerY { persistent = NO } + Field centerZ { persistent = NO } + Field center { persistent = NO } + + Field box { persistent = No } + Field voxelVolume { persistent = NO deprecatedName = "VoxelVol" } + Field totalVolume { persistent = NO deprecatedName = "TotalVol" } + Field megaVoxels { persistent = NO deprecatedName = "MegaVoxel" } + Field dataType { persistent = NO deprecatedName = "DataType" } + Field typeInfo { persistent = NO deprecatedName = "TypeInfo" persistent = NO } + + Field a00 { persistent = NO deprecatedName = "x0" } + Field a01 { persistent = NO deprecatedName = "y0" } + Field a02 { persistent = NO deprecatedName = "z0" } + Field a03 { persistent = NO deprecatedName = "a0" } + Field a10 { persistent = NO deprecatedName = "x1" } + Field a11 { persistent = NO deprecatedName = "y1" } + Field a12 { persistent = NO deprecatedName = "z1" } + Field a13 { persistent = NO deprecatedName = "a1" } + Field a20 { persistent = NO deprecatedName = "x2" } + Field a21 { persistent = NO deprecatedName = "y2" } + Field a22 { persistent = NO deprecatedName = "z2" } + Field a23 { persistent = NO deprecatedName = "a2" } + Field a30 { persistent = NO deprecatedName = "x3" } + Field a31 { persistent = NO deprecatedName = "y3" } + Field a32 { persistent = NO deprecatedName = "z3" } + Field a33 { persistent = NO deprecatedName = "a3" } + Field worldMatrix { persistent = NO } + + Field cDimInfo { persistent = NO deprecatedName = "CDimInfo" } + Field tDimInfo { persistent = NO deprecatedName = "TDimInfo" } + Field uDimInfo { persistent = NO deprecatedName = "UDimInfo" } + Field tDimTable { persistent = NO deprecatedName = "TDimTable" } + + Field update { deprecatedName = "Update" } + Field memoryImage { deprecatedName = "MemoryImage" } + Field memoryImage2 { deprecatedName = "MemoryImage2" } + Field moduleName { deprecatedName = "OperatorName" } + Field connectionValid { deprecatedName = "InputConnection" } + Field dataValid { deprecatedName = "InputData" } +} + +Window { + + Category Main { + panelName = "Main" + expandY = Yes + + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + Prototype DimFld { + parent = Field + edit = no + expandX = yes + } + Prototype Box { + expandY = Yes + } + } + + Box "Image Size" { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + DimFld sizeX { title = "X:" } + DimFld sizeY { title = "Y:" } + DimFld sizeZ { title = "Z:" } + DimFld sizeC { title = "C:" } + DimFld sizeT { title = "T:" } + DimFld sizeU { title = "U:" } + } + Field size { edit = No } + } + Box "Page Size" { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + DimFld pageSizeX { title = "X:" } + DimFld pageSizeY { title = "Y:" } + DimFld pageSizeZ { title = "Z:" } + DimFld pageSizeC { title = "C:" } + DimFld pageSizeT { title = "T:" } + DimFld pageSizeU { title = "U:" } + } + Field pageSize { edit = No } + } + Box "Image Data" { layout = Horizontal + InfoFld dataType { title = "Type:" } + InfoFld minValue { title = "Min:" format = %.3f } + InfoFld maxValue { title = "Max:" format = %.3f } + } + Box "Voxel Size" { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld voxelSizeX { title = "X:" } + InfoFld voxelSizeY { title = "Y:" } + InfoFld voxelSizeZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + Field voxelSize { edit = no expandX = Yes } + } + Box "Volume Info" { layout = Horizontal + InfoFld voxelVolume { format = "%.5f ml" minLength = 10 } + Empty { expandX = yes } + InfoFld totalVolume { format = "%.1f ml" minLength = 10 } + InfoFld megaVoxels { title = "=" format = "%.2f Mega Voxels" minLength = 18 } + } + Box "Image State" { layout = Horizontal + Field pagedImgInfo { title = "State:" minLength = 20 edit = no } + } + } // Category Main + + Category Advanced { + panelName = "Advanced" + + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + Prototype MatFld { + parent = Field + edit = no + expandX = yes + } + } + + Box "World Matrix" { layout = Vertical + Table { + Row { + MatFld a00 { title="a00:" } + MatFld a01 { title="a01:" } + MatFld a02 { title="a02:" } + MatFld a03 { title="a03:" } + } + + Row { + MatFld a10 { title="a10:" } + MatFld a11 { title="a11:" } + MatFld a12 { title="a12:" } + MatFld a13 { title="a13:" } + } + + Row { + MatFld a20 { title="a20:" } + MatFld a21 { title="a21:" } + MatFld a22 { title="a22:" } + MatFld a23 { title="a23:" } + } + + Row { + MatFld a30 { title="a30:" } + MatFld a31 { title="a31:" } + MatFld a32 { title="a32:" } + MatFld a33 { title="a33:" } + } + } // Table + TextView worldMatrix { + fh = 100 + edit = NO + } + } // Box "World Matrix" + Box "C/T/U-Dim Info" { + Vertical { + InfoFld cDimInfo { title = "C:" trim = right } + InfoFld tDimInfo { title = "T:" trim = right } + InfoFld uDimInfo { title = "U:" trim = right } + } + } + } // Category Advanced + + Category World { + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + Prototype DimFld { + parent = Field + edit = no + expandX = yes + } + Prototype VecField { + parent = Field + edit = no + expandX = yes + } + } + Box Mode { + layout = Horizontal + CheckBox alignToAxis {} + CheckBox useVoxelCenter { dependsOn = !includeAllVoxels} + CheckBox includeAllVoxels {} + } + Box Origin { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld originX { title = "X:" } + InfoFld originY { title = "Y:" } + InfoFld originZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField origin {} + } + Box Extent { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld extentX { title = "X:" } + InfoFld extentY { title = "Y:" } + InfoFld extentZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField extent {} + } + Box Size { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld worldSizeX { title = "X:" } + InfoFld worldSizeY { title = "Y:" } + InfoFld worldSizeZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField worldSize {} + } + Box Center { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld centerX { title = "X:" } + InfoFld centerY { title = "Y:" } + InfoFld centerZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField center {} + } + Box Box { + Horizontal { + Field box { edit = No } + } + } + Box Rotation { + Field rotation {} + } + + } + Category "Time" { + panelName = "TimePoints" //Vorsicht! Alter Name: Time Points + expandY = YES + ListView tDimTable { + header = YES + } + } + + Category "Type" { + panelName = "TypeInformation" //Vorsicht! Alter Name: Type Information + expandY = YES + ListView typeInfo { + tooltip = "Shows current type information" + style = fixed + Header = No + } + } + + // Maybe we want to activate this in future. + /*Category "Extended" { + panelName = "ExtendedImageProperties" + expandY = YES + ListView imgPropExt { + tooltip = "Shows information about extended image properties" + style = fixed + Header = No + } + }*/ + + Category "Internal" { + panelName = "Internal" + + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + } + + Box "Input Connection" { layout = Vertical + Horizontal { expandX = no + CheckBox connectionValid { + title = "Connection valid" + edit = no + } + CheckBox dataValid { + title = "Data valid" + edit = no + } + } + InfoFld moduleName {} + } + Box "Memory Image Status" { layout = Vertical + InfoFld memoryImage { title = "" } + InfoFld memoryImage2 { title = "" } + } + Box "Other" { layout = Vertical + Field bypassIndex { edit = no tooltip = "From which data is bypassed or -1 if disabled" } + Field inPlaceIndex { edit = no tooltip = "From which data is used inplace or -1 if disabled" } + } + Button update {} + } // Category Internal +} // Window + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:19:50 +//# hash: VrEG1qzVvwdIhLN9pobpPugikWR+mmhuZRBWGa76viyvjNF0e7OneYraYGSxo4DiDCYLZ/wPTdelJA8UKCgsZQ== +//# MeVis end Added: trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,767 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoRLAxis { + internal { + frame = "-355 269 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "150 542 370 294" + sizeHint = "370 294" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoRLAxis + autoAdjustSettings = FALSE + axisVolumeSize = "114 114 20" + axisOn = TRUE + axisFontNum = 0 + axis1Visibility = TRUE + axis2Visibility = TRUE + axis3Visibility = TRUE + axisNumberingOn = TRUE + axisSubTickingOn = TRUE + multiAxisXY = FALSE + multiAxisXZ = FALSE + multiAxisYX = FALSE + multiAxisYZ = FALSE + multiAxisZX = FALSE + multiAxisZY = FALSE + axis1Text = X + axis2Text = Y + axis3Text = Z + axisNumBias = "0 0 0" + axisNumScale = "1 1 1" + axisStepSizes = "15 15 15" + axisOrigin = "0 0 0" + axisMinEnds = "0 0 0" + axisMaxEnds = "150 150 150" + axisMarkerLength = "7.5 7.5 7.5" + axisTicksMin = "0 0 0" + axisTicksMax = "150 150 150" + axis1Color = "1 1 0" + axis1Transparency = 1 + axis2Color = "0.3333333432674408 1 0" + axis2Transparency = 1 + axis3Color = "0.3333333432674408 0.6666666865348816 1" + axis3Transparency = 1 + axisWingLength = "5 5 5" + axisOverScale = "1.100000023841858 1.100000023841858 1.100000023841858" + axisSubTickSteps = "0.2000000029802322 0.2000000029802322 0.2000000029802322" + axisSubTickScales = "0.25 0.25 0.25" + boxOn = FALSE + boxColor = "1 1 1" + boxTransparency = 1 + } +} +module Negation { + internal { + frame = "193 437 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "185 104 468 190" + sizeHint = "468 190" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Negation + inToggle = TRUE + outToggle = FALSE + outToggleInt = 0 + inInta = 0 + outInta = 1 + inIntb = -1 + outIntb = 1 + inIntc = -1 + outIntc = 0 + inIntd = 1 + outIntd = -1 + inFloat = 1 + outFloat = -1 + } + internalFields = "" +} +module SoToggle { + internal { + frame = "349 333 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "462 733 104 25" + sizeHint = "64 25" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoToggle + whichChild = -1 + on = FALSE + } +} +module SoRotation { + internal { + frame = "345 397 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "396 292 390 39" + sizeHint = "390 39" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoRotation + rotation = "-1 0 0 0.2094391137361526" + } +} +module SoText3 { + internal { + frame = "-123 325 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "395 710 256 219" + sizeHint = "256 219" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoText31 + string = "*"Extend"*" + spacing = 1 + justification = LEFT + parts = FRONT + } +} +module SoText3 { + internal { + frame = "121 325 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "395 710 256 219" + sizeHint = "256 219" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoText3 + string = "*"Origin"*" + spacing = 1 + justification = LEFT + parts = FRONT + } +} +module SoSphere { + internal { + frame = "-127 269 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "543 484 119 35" + sizeHint = "119 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoSphere1 + radius = 6 + } +} +module SoSeparator { + internal { + frame = "-203 185 152 64" + moduleGroupName = "" + windows { + window _viewer { + geometry = "747 297 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = extend + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoTranslation { + internal { + frame = "-247 325 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "381 497 270 35" + sizeHint = "270 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoTranslation2 + translation = "109.201530456543 136.6565093994141 94.54345703125" + } +} +module SoMaterial { + internal { + frame = "-231 269 96 56" + moduleGroupName = "" + windows { + window _materialeditor { + geometry = "301 572 195 164" + sizeHint = "195 164" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMaterial2 + ambientColor = "0.2 0.2 0.2" + diffuseColor = "0.333333 1 1" + specularColor = "0 0 0" + emissiveColor = "0 0 0" + shininess = 0.2 + transparency = 0 + } +} +module SoMaterial { + internal { + frame = "9 269 96 56" + moduleGroupName = "" + windows { + window _materialeditor { + geometry = "301 572 195 164" + sizeHint = "195 164" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMaterial1 + ambientColor = "0.2 0.2 0.2" + diffuseColor = "0 1 0" + specularColor = "0 0 0" + emissiveColor = "0 0 0" + shininess = 0.2 + transparency = 0 + } +} +module SoTranslation { + internal { + frame = "-7 325 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "700 478 270 35" + sizeHint = "270 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoTranslation1 + translation = "-119.8205871582031 -114.3894500732422 -80.23210144042969" + } +} +module SoSeparator { + internal { + frame = "29 185 152 64" + moduleGroupName = "" + windows { + window _viewer { + geometry = "747 297 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Origin + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoSphere { + internal { + frame = "109 269 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "543 484 119 35" + sizeHint = "119 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoSphere + radius = 6 + } +} +module SoExaminerViewer { + internal { + frame = "53 -35 184 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "9 125 587 552" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + stereoViewing = FALSE + stereoOffset = 3 + height = 0.7853981853 + position = "413.67431640625 296.9138793945312 282.0001220703125" + orientation = "-0.2527531385421753 -0.4799727499485016 -0.8400845527648926 3.890670299530029" + nearDistance = 299.2450562 + farDistance = 775.7368164 + focalDistance = 572.6383667 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module SoGVRVolumeRenderer { + internal { + frame = "133 125 168 56" + moduleGroupName = "" + windows { + window _default { + geometry = "95 350 346 584" + sizeHint = "346 584" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoGVRVolumeRenderer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + on = TRUE + autoLoad = TRUE + interactiveQuality = 0.1000000015 + staticQuality = 1 + interactiveSamplingRate = 1 + staticSamplingRate = 1 + blendMode = Blend + octreeNodeSize = NODE_SIZE_32 + octreeParentComputationMethod = Rank + octreeParentComputationRank = 4 + currentTimePoint = 0 + maxTimePoint = 1 + force8bit = FALSE + filterVolumeData = FilterLinear + filterLut = TRUE + subVolumeStartX = 0 + subVolumeStartY = 0 + subVolumeStartZ = 0 + subVolumeEndX = 114 + subVolumeEndY = 114 + subVolumeEndZ = 20 + zbuffer = TRUE + permitClipping = TRUE + drawOnPlanes = TRUE + sizeOutputX = 114 + sizeOutputY = 114 + sizeOutputZ = 20 + incrementalUpdate = TRUE + highQualityStaticUpdate = FALSE + staticRenderingAfterInteractionOnly = FALSE + adaptQualityToWindowSize = TRUE + renderMode = Direct + useImageCacheFile = FALSE + imageCacheFilename = "" + greyCenter = 0 + greyWidth = 0.4110000134 + greyInvert = FALSE + alphaCenter = 0.2469999939 + alphaWidth = 1 + alphaInvert = FALSE + colorFactor = "1 0 0" + alphaFactor = 1 + enhancementAlphaMix = 0.25 + boundaryEnhancement = FALSE + boundaryEnhancementFactor = 1 + boundaryEnhancementExponent = 1 + boundaryEnhancementGradientBias = 0 + silhouetteEnhancement = FALSE + silhouetteEnhancementExponent = 1 + silhouetteEnhancementFactor = 1 + toneShading = FALSE + toneShadingWarmColor = "0.6745098233222961 0.5333333611488342 0.1411764770746231" + toneShadingColdColor = "0 0 0.4000000059604645" + toneShadingWarmDiffuse = 0.6000000238 + toneShadingColdDiffuse = 0.200000003 + toneShadingAngle = 45 + materialAmbient = 0.6000000238 + materialDiffuse = 1 + materialSpecular = 1 + materialSpecularity = 32 + light1Enabled = TRUE + light1DiffuseIntensity = 1 + light1SpecularIntensity = 1 + light1Color = "1 0 0" + light1PolarPhi = 0 + light1PolarRho = 0 + light2Enabled = FALSE + light2DiffuseIntensity = 1 + light2SpecularIntensity = 1 + light2Color = "1 0 0" + light2PolarPhi = 45 + light2PolarRho = 45 + light3Enabled = FALSE + light3DiffuseIntensity = 1 + light3SpecularIntensity = 1 + light3Color = "1 0 0" + light3PolarPhi = -45 + light3PolarRho = 0 + gradientQuality = GradientQualityAutomatic + selectionAlphaThreshold = 0.200000003 + selectedPoint1 = "-1 -1 -1" + selectedWorldPoint1 = "-1 -1 -1" + selectionActive = FALSE + useWorldCoords = TRUE + } +} +module SoMaterial { + internal { + frame = "233 269 96 56" + moduleGroupName = "" + windows { + window _materialeditor { + geometry = "301 572 304 164" + sizeHint = "195 164" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMaterial + ambientColor = "0.2 0.2 0.2" + diffuseColor = "0.635294 0.635294 0.635294" + specularColor = "0 0 0" + emissiveColor = "0 0 0" + shininess = 0.11 + transparency = 0.753 + } +} +module SoSeparator { + internal { + frame = "261 185 152 64" + moduleGroupName = "" + windows { + window _viewer { + geometry = "747 297 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = BoundingBox + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoTranslation { + internal { + frame = "225 333 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "562 289 270 35" + sizeHint = "270 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoTranslation + translation = "-5.309526920318604 11.13352870941162 7.155678272247314" + } +} +module SoCube { + internal { + frame = "345 269 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "668 446 117 97" + sizeHint = "117 97" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoCube + width = 229.0221252 + height = 251.0459595 + depth = 174.7755585 + } +} +module SoView2DPosition { + internal { + frame = "549 333 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "52 182 470 665" + sizeHint = "470 665" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DPosition + drawingOn = TRUE + editingOn = FALSE + maskValid = FALSE + fixZOn = TRUE + color = "1 0 0" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = FALSE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + worldPosition = "-5.309526920318604 11.13352870941162 7.155678272247314" + firstSliceWorldPosition = "-1 -1 -1" + drawingModel = DRAWINGMODEL_CROSSHAIRS + drawingModelSize = 16 + blendOnto = 1 + blendOutside = 0 + lineWidth = 2 + colorAxes = FALSE + sagittalColor = "1 0 0" + coronalColor = "0.1725490242242813 0.886274516582489 0.0117647061124444" + axialColor = "0.007843137718737125 0.9529411792755127 0.9686274528503418" + updateOnPress = TRUE + updateOnMotion = TRUE + updateOnRelease = FALSE + cooperative = FALSE + colorBorder = FALSE + colorBorderWidth = 2 + } +} +module OrthoView2D { + internal { + frame = "517 -35 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "284 87 892 734" + sizeHint = "400 431" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = OrthoView2D + inventorInputOn = TRUE + layout = LAYOUT_CUBE_EQUAL + filterMode = FILTER_LINEAR + synchronizeZoom = TRUE + synchronizePanning = FALSE + synchronizePosition = TRUE + useGlobalInputImage = TRUE + snapToCenter = FALSE + alternCubeLayout = FALSE + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + greyWidth = 1277.099976 + greyCenter = 725.6749878 + annotationOn = TRUE + annotationSizeMode = ANNO_SHOW_DETAILED + annotationFontSize = ANNO_SIZE_AUTO + valueHighPrecision = FALSE + annoCoords = Voxel + showCurrentPos = FALSE + worldPosition = "-6.314009666442871 33.45923233032227 5.732810497283936" + coloredMode = FALSE + } + internalFields = "" +} +module WorldInfo { + internal { + frame = "-3 437 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "605 126 564 555" + sizeHint = "564 555" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = WorldInfo + pagedImgInfo = Ok + alignToAxis = TRUE + useVoxelCenter = FALSE + includeAllVoxels = TRUE + rotation = "-0.9999999999999992 0 0 0.2094395121631349" + memoryImage = "Invalid, (0,0,0,0,0,0)=0 Voxel at (0,0,0,0,0,0), " + memoryImage2 = "handled by host" + bypassIndex = -1 + inPlaceIndex = -1 + moduleName = ImgLoad + connectionValid = TRUE + dataValid = TRUE + } +} +module LocalImage { + internal { + frame = "57 549 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "331 58 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Head3_dualecho.small.dcm + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dualecho.small.dcm" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +connections { + SoRLAxis.inputImage = LocalImage.outImage + Negation.inToggle = WorldInfo.alignToAxis + SoToggle.on = Negation.outToggle + SoToggle.children = SoRotation.self + SoRotation.rotation = WorldInfo.rotation + extend.children = "SoMaterial2.self SoTranslation2.self SoText31.self SoSphere1.self" + SoTranslation2.translation = WorldInfo.extent + SoTranslation1.translation = WorldInfo.origin + Origin.children = "SoMaterial1.self SoTranslation1.self SoText3.self SoSphere.self" + SoExaminerViewer.children = "SoRLAxis.self extend.self Origin.self SoGVRVolumeRenderer.self BoundingBox.self" + SoGVRVolumeRenderer.image = LocalImage.outImage + BoundingBox.children = "SoMaterial.self SoTranslation.self SoToggle.self SoCube.self" + SoTranslation.translation = WorldInfo.center + SoCube.width = WorldInfo.worldSizeX + SoCube.height = WorldInfo.worldSizeY + SoCube.depth = WorldInfo.worldSizeZ + SoView2DPosition.worldPosition = WorldInfo.center + OrthoView2D.image = LocalImage.outImage + OrthoView2D.inInvPostLUT = SoView2DPosition.self + WorldInfo.input0 = LocalImage.outImage +} +networkModel = "" Added: trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,333 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//----------------------------------------------------------------------- +//! The ML module class BoxArithmetic. +/*! +// \file mlBoxArithmetic.cpp +// \author Reinhard Hameeteman +// \date 2008-10-28 +// +// Perform simple calculations on a (image) box +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlBoxArithmetic.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(BoxArithmetic, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +BoxArithmetic::BoxArithmetic () + : BaseOp(2, 0) +{ + ML_TRACE_IN("BoxArithmetic::BoxArithmetic ()"); + + handleNotificationOff(); + + FieldContainer *fieldC = getFieldContainer(); + + f_InBox0 = fieldC->addSubImgBoxf("inputBox0"); + f_InBox0->setSubImgBoxfValue( SubImgBoxf() ); + + f_InBox1 = fieldC->addSubImgBoxf("inputBox1"); + f_InBox1->setSubImgBoxfValue( SubImgBoxf() ); + + f_CorrectInput0 = fieldC->addBool( "correctInput0" ); + f_CorrectInput0->setBoolValue( false ); + + f_CorrectInput1 = fieldC->addBool( "correctInput1" ); + f_CorrectInput1->setBoolValue( false ); + + f_UseVoxelCenter = fieldC->addBool( "useVoxelCenter" ); + f_UseVoxelCenter->setBoolValue( false ); + + f_OutBox0 = fieldC->addSubImgBoxf("outputBox0"); + f_OutBox0->setSubImgBoxfValue( SubImgBoxf() ); + + f_OutBox1 = fieldC->addSubImgBoxf("outputBox1"); + f_OutBox1->setSubImgBoxfValue( SubImgBoxf() ); + + f_OutBox = fieldC->addSubImgBoxf("outputBox"); + f_OutBox->setSubImgBoxfValue( SubImgBoxf() ); + + f_Correct = fieldC->addBool("correctBox"); + f_Correct->setBoolValue( false ); + + f_OutExtent = fieldC->addVec6f("outputExtent"); + f_OutExtent->setVec6fValue( vec6() ); + + f_OutV1 = fieldC->addVec6f("outV1"); + f_OutV1->setVec6fValue( vec6() ); + + f_OutV2 = fieldC->addVec6f("outV2"); + f_OutV2->setVec6fValue( vec6(-1) ); + + f_Constant = fieldC->addFloat("constant"); + f_Constant->setFloatValue( 0.0f ); + + f_V1 = fieldC->addVec6f("v1"); + f_V1->setVec6fValue( vec6() ); + f_V2 = fieldC->addVec6f("v2"); + f_V2->setVec6fValue( vec6(-1) ); + + (f_BoxV0x = fieldC->addFloat("x1"))->setFloatValue( 0.0f ); + (f_BoxV0y = fieldC->addFloat("y1"))->setFloatValue( 0.0f ); + (f_BoxV0z = fieldC->addFloat("z1"))->setFloatValue( 0.0f ); + (f_BoxV0c = fieldC->addFloat("c1"))->setFloatValue( 0.0f ); + (f_BoxV0t = fieldC->addFloat("t1"))->setFloatValue( 0.0f ); + (f_BoxV0u = fieldC->addFloat("u1"))->setFloatValue( 0.0f ); + (f_BoxV1x = fieldC->addFloat("x2"))->setFloatValue( -1.0f ); + (f_BoxV1y = fieldC->addFloat("y2"))->setFloatValue( -1.0f ); + (f_BoxV1z = fieldC->addFloat("z2"))->setFloatValue( -1.0f ); + (f_BoxV1c = fieldC->addFloat("c2"))->setFloatValue( -1.0f ); + (f_BoxV1t = fieldC->addFloat("t2"))->setFloatValue( -1.0f ); + (f_BoxV1u = fieldC->addFloat("u2"))->setFloatValue( -1.0f ); + + const char* modes[LastMode] = {"ExpandScalar","ExpandVector", "AddScalar", "AddVector", "Intersect", "Unify" }; + f_OperationMode = fieldC->addEnum("operationMode", modes, LastMode); + f_OperationMode->setEnumValue( Intersect ); + + const char* inputModes0[4] = {"Box", "Input0", "Scalars", "Vectors"}; + f_InputMode0 = fieldC->addEnum("inputMode0", inputModes0, 4); + + const char* inputModes1[4] = {"Box", "Input1", "Scalars", "Vectors"}; + f_InputMode1 = fieldC->addEnum("inputMode1", inputModes1, 4); + + m_LockUpdate = false; + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void BoxArithmetic::handleNotification (Field *field) +{ + ML_TRACE_IN("BoxArithmetic::handleNotification ()"); + + if (m_LockUpdate) {return;} + m_LockUpdate = true; + + SubImgBoxf newBox = SubImgBoxf(); + SubImgBoxf box0 = SubImgBoxf(); + SubImgBoxf box1 = SubImgBoxf(); + + double center = 0.0; + if ( f_UseVoxelCenter->getBoolValue() ) {center = 0.5;} + + //Box0 + switch ( f_InputMode0->getEnumValue() ){ + case Box0: + { + box0 = f_InBox0->getSubImgBoxfValue(); + } + break; + case Input0: + { + PagedImg *inImage = getNonDummyUpdatedInImg( 0 ); + if ( inImage != NULL ) { + const Vector size = inImage->getImgExt(); + const vec3 firstVoxel(center,center,center); + const vec3 lastVoxel(size.x-1+center,size.y-1+center,size.z-1+center); + vec3 imageOrigin; + vec3 imageExtent; + inImage->transformToWorldCoord( firstVoxel,imageOrigin ); + inImage->transformToWorldCoord( lastVoxel, imageExtent ); + box0 = SubImgBoxf(vec6(imageOrigin,0.0,0.0,0.0), vec6(imageExtent,0.0,0.0,0.0)); + } else { + box0.makeEmpty(); + } + } + break; + case Scalars0: + { + vec6 v1 = vec6( f_BoxV0x->getFloatValue(),f_BoxV0y->getFloatValue(),f_BoxV0z->getFloatValue(), + f_BoxV0c->getFloatValue(),f_BoxV0t->getFloatValue(),f_BoxV0u->getFloatValue()); + vec6 v2 = vec6( f_BoxV1x->getFloatValue(),f_BoxV1y->getFloatValue(),f_BoxV1z->getFloatValue(), + f_BoxV1c->getFloatValue(),f_BoxV1t->getFloatValue(),f_BoxV1u->getFloatValue()); + box0 = SubImgBoxf( v1,v2 ); + } + break; + case Vectors0: + { + box0 = SubImgBoxf( f_V1->getVec6fValue(), f_V2->getVec6fValue() ); + } + break; + default: + break; + } + if ( f_CorrectInput0->getBoolValue() ){ + box0.correct(); + } + f_OutBox0->setSubImgBoxfValue( box0 ); + + //Box1 + switch ( f_InputMode1->getEnumValue() ){ + case Box1: + { + box1 = f_InBox1->getSubImgBoxfValue(); + } + break; + case Input1: + { + PagedImg *inImage = getNonDummyUpdatedInImg( 1 ); + if ( inImage != NULL ) { + const Vector size = inImage->getImgExt(); + const vec3 firstVoxel(center,center,center); + const vec3 lastVoxel(size.x-1+center,size.y-1+center,size.z-1+center); + vec3 imageOrigin; + vec3 imageExtent; + inImage->transformToWorldCoord( firstVoxel,imageOrigin ); + inImage->transformToWorldCoord( lastVoxel, imageExtent ); + box1 = SubImgBoxf(vec6(imageOrigin,0.0,0.0,0.0), vec6(imageExtent,0.0,0.0,0.0)); + } else { + box1.makeEmpty(); + } + if ( f_CorrectInput1->getBoolValue() ){ + box1.correct(); + } + } + break; + case Scalars1: + { + vec6 v1 = vec6( f_BoxV0x->getFloatValue(),f_BoxV0y->getFloatValue(),f_BoxV0z->getFloatValue(), + f_BoxV0c->getFloatValue(),f_BoxV0t->getFloatValue(),f_BoxV0u->getFloatValue()); + vec6 v2 = vec6( f_BoxV1x->getFloatValue(),f_BoxV1y->getFloatValue(),f_BoxV1z->getFloatValue(), + f_BoxV1c->getFloatValue(),f_BoxV1t->getFloatValue(),f_BoxV1u->getFloatValue()); + box1 = SubImgBoxf( v1,v2 ); + if ( f_CorrectInput1->getBoolValue() ){ + box1.correct(); + } + } + break; + case Vectors1: + { + box1 = SubImgBoxf( f_V1->getVec6fValue(), f_V2->getVec6fValue() ); + } + default: + break; + } + if ( f_CorrectInput1->getBoolValue() ){ + box1.correct(); + } + f_OutBox1->setSubImgBoxfValue( box1 ); + + switch ( f_OperationMode->getEnumValue() ) { + case ExpandScalar: + { + vec6 v1 = box0.v1; + vec6 v2 = box0.v2; + const double constant = (double)f_Constant->getFloatValue(); + v1[0] -= constant; + v1[1] -= constant; + v1[2] -= constant; + v2[0] += constant; + v2[1] += constant; + v2[2] += constant; + newBox.v1 = v1; + newBox.v2 = v2; + break; + } + case ExpandVector: + { + const vec6 constant = f_V1->getVec6fValue(); + newBox.v1 = box0.v1 - constant; + newBox.v2 = box0.v2 + constant; + break; + } + case AddScalar: + { + vec6 v1 = box0.v1; + vec6 v2 = box0.v2; + const double constant = (double)f_Constant->getFloatValue(); + v1[0] += constant; + v1[1] += constant; + v1[2] += constant; + v2[0] += constant; + v2[1] += constant; + v2[2] += constant; + newBox.v1 = v1; + newBox.v2 = v2; + break; + } + case AddVector: + { + const vec6 constant = f_V1->getVec6fValue(); + newBox.v1 = box0.v1 + constant; + newBox.v2 = box0.v2 + constant; + break; + } + ca... [truncated message content] |
From: <rha...@us...> - 2010-03-05 14:50:52
|
Revision: 235 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=235&view=rev Author: rhameeteman Date: 2010-03-05 14:50:27 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH * Added project MLCMFields with one module: SyncFields Added Paths: ----------- trunk/Community/General/Modules/ML/MLCMFields/ trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def trunk/Community/General/Modules/ML/MLCMFields/SyncFields/ trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab trunk/Community/General/Sources/ML/MLCMFields/ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h trunk/Community/General/Sources/ML/MLCMFields/SyncFields/ trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h Added: trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def (rev 0) +++ trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,73 @@ +//---------------------------------------------------------------------------------- +//! MLCMFields module definitions. +/*! +// \file MLCMFields.def +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule SyncFields +//---------------------------------------------------------------------------------- +MLModule SyncFields { + DLL = "MLCMFields" + group = BIGR + genre = Fields + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Sync float or vector depending on difference criterium" + keywords = "sync float vector loop break precision" + seeAlso = "SyncFloat SyncVector" + documentation = "$(LOCAL)/SyncFields/SyncFields.html" + exampleNetwork = "$(LOCAL)/SyncFields/SyncFieldsExample.mlab" + + Window { + expandY = No + Vertical { + name = MainWindow + expandY = No + style { + Prototype Field { expandX = yes alignGroup = g1 } + } + Box "Mode" { + expandY = No + Field on { alignX = Left } + Field mode { alignX = Left } + Field precision {} + } + Box Floats { + visibleOn = "*mode == "Float" || mode == "MultiFloat" *" + expandY = No + Field float0 {} + Field float1 {} + Field float2 { visibleOn = "* mode == "MultiFloat" *" } + Field float3 { visibleOn = "* mode == "MultiFloat" *" } + Field float4 { visibleOn = "* mode == "MultiFloat" *" } + Field float5 { visibleOn = "* mode == "MultiFloat" *" } + Field float6 { visibleOn = "* mode == "MultiFloat" *" } + Field float7 { visibleOn = "* mode == "MultiFloat" *" } + Field float8 { visibleOn = "* mode == "MultiFloat" *" } + Field float9 { visibleOn = "* mode == "MultiFloat" *" } + } + Box Vectors { + name = vectors + expandY = No + visibleOn = "*mode == "Vector" || mode == "MultiVector" *" + Field vector0 {} + Field vector1 {} + Field vector2 { visibleOn = "*mode == "MultiVector" *" } + Field vector3 { visibleOn = "*mode == "MultiVector" *" } + Field vector4 { visibleOn = "*mode == "MultiVector" *" } + Field vector5 { visibleOn = "*mode == "MultiVector" *" } + Field vector6 { visibleOn = "*mode == "MultiVector" *" } + Field vector7 { visibleOn = "*mode == "MultiVector" *" } + Field vector8 { visibleOn = "*mode == "MultiVector" *" } + Field vector9 { visibleOn = "*mode == "MultiVector" *" } + } + } + FieldListener mode { command = "*py:ctx.control('MainWindow').updateLayout();ctx.window().updateFrame()*" } + //FieldListener mode { command = "*py:ctx.window().updateFrame()*" } + } // Window +} // MLModule SyncFields Added: trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,37 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center> + +<hr WIDTH="100%"></center> +<h2>SyncFields</h2> + + + + + + + + + + + + + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,199 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module AffineTransformation3d { + internal { + frame = "441 285 160 56" + moduleGroupName = "" + windows { + window _default { + geometry = "513 422 427 286" + sizeHint = "260 224" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = AffineTransformation3d + optParameters = "0 0 0 0 0 0.4 1 1 1 0 0 0 " + translationX = 0 + translationY = 0 + translationZ = 0 + rotationX = 0 + rotationY = 0 + rotationZ = 0.4 + shearingX = 0 + shearingY = 0 + shearingZ = 0 + scalingX = 1 + scalingY = 1 + scalingZ = 1 + matrix = "0.9210609940028851 0.3894183423086505 0 0 +-0.3894183423086505 0.9210609940028851 0 0 +0 0 1 0 +0 0 0 1" + transformationMode = Affine + isWorldTransformation = FALSE + worldVoxelTransformation = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + } +} +module OrthoView2D { + internal { + frame = "465 109 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "608 39 400 431" + sizeHint = "400 431" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = OrthoView2D1 + inventorInputOn = FALSE + layout = LAYOUT_AXIAL + filterMode = FILTER_LINEAR + synchronizeZoom = TRUE + synchronizePanning = FALSE + synchronizePosition = TRUE + useGlobalInputImage = TRUE + snapToCenter = FALSE + alternCubeLayout = FALSE + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + greyWidth = 2095 + greyCenter = 923.2999878 + annotationOn = TRUE + annotationSizeMode = ANNO_SHOW_DETAILED + annotationFontSize = ANNO_SIZE_AUTO + valueHighPrecision = FALSE + annoCoords = Voxel + showCurrentPos = TRUE + worldPosition = "30.3631706237793 31.50894927978516 43.5" + coloredMode = FALSE + } + internalFields = "" +} +module OrthoView2D { + internal { + frame = "237 109 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "135 37 400 431" + sizeHint = "400 431" + wasOpen = yes + wasActive = no + } + window _automatic { + geometry = "513 422 260 224" + sizeHint = "260 224" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = OrthoView2D + inventorInputOn = FALSE + layout = LAYOUT_AXIAL + filterMode = FILTER_LINEAR + synchronizeZoom = TRUE + synchronizePanning = FALSE + synchronizePosition = TRUE + useGlobalInputImage = TRUE + snapToCenter = FALSE + alternCubeLayout = FALSE + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + greyWidth = 2095.000244 + greyCenter = 923.3000488 + annotationOn = TRUE + annotationSizeMode = ANNO_SHOW_DETAILED + annotationFontSize = ANNO_SIZE_AUTO + valueHighPrecision = FALSE + annoCoords = Voxel + showCurrentPos = TRUE + worldPosition = "30.3631706237793 31.50894927978516 43.5" + coloredMode = FALSE + } + internalFields = "" +} +module LocalImage { + internal { + frame = "241 285 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "142 613 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module SyncFields { + internal { + frame = "353 205 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "617 228 183 201" + sizeHint = "183 201" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SyncFields + mode = Vector + on = TRUE + precision = 0.001000000047497451 + float0 = 0 + float1 = 0 + float2 = 0 + float3 = 0 + float4 = 0 + float5 = 0 + float6 = 0 + float7 = 0 + float8 = 0 + float9 = 0 + vector0 = "30.3631706237793 31.5089492797852 43.5 0 0 0" + vector1 = "30.3631706237793 31.5089492797852 43.5 0 0 0" + vector2 = "0 0 0 0 0 0" + vector3 = "0 0 0 0 0 0" + vector4 = "0 0 0 0 0 0" + vector5 = "0 0 0 0 0 0" + vector6 = "0 0 0 0 0 0" + vector7 = "0 0 0 0 0 0" + vector8 = "0 0 0 0 0 0" + vector9 = "0 0 0 0 0 0" + } +} +connections { + AffineTransformation3d.input0 = LocalImage.outImage + OrthoView2D1.image = AffineTransformation3d.output0 + OrthoView2D1.worldPosition = OrthoView2D.worldPosition + OrthoView2D.image = LocalImage.outImage + OrthoView2D.worldPosition = SyncFields.vector1 + SyncFields.vector0 = OrthoView2D1.worldPosition +} +networkModel = "" Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" MLCMFields Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,44 @@ +# ----------------------------------------------------------------------------- +# MLCMFields project profile +# +# \file MLCMFields.pro +# \author Reinhard Hameeteman +# \date 2010-03-05 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = MLCMFields + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# add dependencies of this project here + +CONFIG += dll ML + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + + +MLAB_PACKAGES += MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += MLCMFIELDS_EXPORTS + +HEADERS += \ + MLCMFieldsInit.h \ + MLCMFieldsSystem.h \ + SyncFields/mlSyncFields.h \ + +SOURCES += \ + MLCMFieldsInit.cpp \ + SyncFields/mlSyncFields.cpp \ + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/MLCMFields/MLCMFields.def + + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Run this script to create a Makefile for your project +# + +# Check for Mac OS X +if [ "`uname -s`" = "Darwin" ]; then + +echo "Please use 'open -b de.mevis.MeVisLab.MacProfileTranslator MLCMFields.pro' or 'open MLCMFields.pro'" + +# Linux case +else + +# Print usage-info +function usage () { + echo "MLCMFields [-d|-r]" + echo "Creates Makefile.MLCMFields - run \"make -f Makefile.MLCMFields\" to build your module" + echo " -r : create Makefile for release-version (libMLCMFields.so)" + echo " -d : create Makefile for debug-version (libMLCMFields_d.so)" + exit 1 +} + +# Check arguments +if test "(" "$#" -gt "1" ")" -o "(" "(" "$#" = "1" ")" -a "(" "$1" != "-r" ")" -a "(" "$1" != "-d" ")" ")" +then + usage +fi + +# Switch debug/release/default +if [ "$1" = "-d" ];then + DEBUG=1 +elif [ "$1" = "-r" ];then + DEBUG=0 +else + DEBUG=$(cat /proc/$PPID/cmdline|grep -c MeVisLab_d) +fi + +if [ "$DEBUG" = "1" ];then + VERSION="Debug-Version" + MODE_FLAG="CONFIG-=release CONFIG+=debug" + EXT="_d" +else + VERSION="Release-Version" + MODE_FLAG="CONFIG-=debug CONFIG+=release" + EXT="" +fi + +echo "Creating Makefile.MLCMFields for $VERSION (libMLCMFields$EXT.so)" +qmake -t lib -o Makefile.MLCMFields $MODE_FLAG "CONFIG+=MeVisLab" MLCMFields.pro + +fi + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,40 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMFieldsInit.cpp +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "MLCMFieldsSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... +#include "SyncFields/mlSyncFields.h" + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int MLCMFieldsInit (void) +{ + ML_TRACE_IN("MLCMFieldsInit ()") + + SyncFields::initClass(); + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(MLCMFieldsInit) + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMFieldsInit.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMFieldsInit_H +#define __MLCMFieldsInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int MLCMFieldsInit (void); + +ML_END_NAMESPACE + +#endif // __MLCMFieldsInit_H + + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLCMFieldsSystem.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMFieldsSystem_H +#define __MLCMFieldsSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef MLCMFIELDS_EXPORTS +// Use the MLCMFIELDS_EXPORT macro to export classes and functions +#define MLCMFIELDS_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define MLCMFIELDS_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define MLCMFIELDS_EXPORT +#endif + + +#endif // __MLCMFieldsSystem_H + + Added: trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,211 @@ +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! The ML module class SyncFields. +/*! +// \file mlSyncFields.cpp +// \author Reinhard Hameeteman +// \date 2008-11-04 +// +// Sync float or vector depending on difference criterium +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlSyncFields.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(SyncFields, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +SyncFields::SyncFields () + : BaseOp(0, 0) +{ + ML_TRACE_IN("SyncFields::SyncFields ()"); + + handleNotificationOff(); + FieldContainer *fieldC = getFieldContainer(); + + const char* syncModes[] = {"Float","MultiFloat","Vector","MultiVector"}; + f_Mode = fieldC->addEnum("mode",syncModes,4); + f_Mode->setEnumValue( FLOAT ); + + f_On = fieldC->addBool("on"); + f_On->setBoolValue( true ); + + f_Precision = fieldC->addDouble("precision"); + f_Precision->setDoubleValue( 1e-3f ); + + for (unsigned int iFloat=0; iFloat < NFIELDS; ++iFloat ){ + std::stringstream ss; + ss << iFloat; + std::string currentName = "float" + ss.str(); + m_FloatsFields.push_back(fieldC->addDouble(currentName.c_str()) ); + m_FloatsFields[iFloat]->setDoubleValue( 0.0f ); + } + + for (unsigned int iVector =0; iVector < NFIELDS; ++iVector ){ + std::stringstream ss; + ss << iVector; + std::string currentName = "vector" + ss.str(); + m_Vec6Fields.push_back( fieldC->addVec6f(currentName.c_str()) ); + m_Vec6Fields[iVector]->setVec6fValue( vec6() ); + } + + m_Updating = false; + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void SyncFields::handleNotification (Field *field) +{ + ML_TRACE_IN("SyncFields::handleNotification ()"); + + if ( m_Updating ||!f_On->getBoolValue() ) { + return; + } + + if ( field == f_Mode || field == f_On || field == f_Precision ) { + switch ( f_Mode->getEnumValue() ){ + case FLOAT: + case MULTIFLOAT: + this->handleNotification( m_FloatsFields[0] ); + break; + case VECTOR: + case MULTIVECTOR: + this->handleNotification( m_Vec6Fields[0] ); + break; + default: + break; + } + } else { + + m_Updating = true; + + mlDebug( "Handling notification from: " << field->getName() ); + + unsigned int nFields = NFIELDS; + + switch ( f_Mode->getEnumValue() ){ + case FLOAT : + nFields = 2; + case MULTIFLOAT: + { + std::vector< bool > changed(nFields,false); + const double precision = f_Precision->getDoubleValue(); + double newValue = 0.0; + // determine the changed field + for (unsigned int iFloat = 0; iFloat < nFields; ++iFloat){ + if ( field == m_FloatsFields[iFloat] ){ + changed[iFloat]= true; + newValue = m_FloatsFields[iFloat]->getDoubleValue(); + } else { + changed[iFloat] = false; + } + } + + // Prevent notifications while updating all values + handleNotificationOff(); + // updated fields if necessary + for (unsigned int iFloat = 0; iFloat < nFields; ++iFloat){ + if ( !changed[iFloat] && DiffTest(newValue, m_FloatsFields[iFloat]->getDoubleValue(), precision ) ){ + m_FloatsFields[iFloat]->setDoubleValue( newValue ); + changed[iFloat] = true; + } + } + handleNotificationOn(); + + for (unsigned int iFloat = 0; iFloat < nFields; ++iFloat){ + if ( changed[iFloat] ){ + m_FloatsFields[iFloat]->notifyAttachments(); + } + } + break; + } + case VECTOR: + nFields = 2; + case MULTIVECTOR: + { + std::vector< bool > changed(nFields,false); + const double precision = f_Precision->getDoubleValue(); + vec6 newValue; + for (unsigned int iVector = 0; iVector < nFields; ++iVector){ + if ( field == m_Vec6Fields[iVector] ){ + changed[iVector]= true; + newValue = m_Vec6Fields[iVector]->getVec6fValue(); + } else { + changed[iVector] = false; + } + } + // Prevent notifications while updating all values + handleNotificationOff(); + // Update fields if necessary + for (unsigned int iVector = 0; iVector < nFields; ++iVector){ + if ( !changed[iVector] && DiffTest(newValue, m_Vec6Fields[iVector]->getVec6fValue(), precision ) ){ + m_Vec6Fields[iVector]->setVec6fValue( newValue ); + changed[ iVector ] = true; + } + } + handleNotificationOn(); + + for (unsigned int iVector = 0; iVector < nFields; ++iVector){ + if ( changed[iVector] ){ + m_Vec6Fields[iVector]->notifyAttachments(); + } + } + break; + } + default: + break; + } + } + m_Updating = false; +} + +template< typename T > +bool SyncFields::DiffTest( const T first, const T last, const double precision ) +{ + unsigned int numComp = sizeof(first)/sizeof(first[0]); + for (unsigned int iComp=0; iComp < numComp; ++iComp){ + if ( abs(first[iComp] - last[iComp]) > precision) { + return true; + } + } + return false; +} +bool SyncFields::DiffTest( const double first, const double last, const double precision ) +{ + + return (abs(first - last) > precision); +} +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,85 @@ +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! The ML module class SyncFields. +/*! +// \file mlSyncFields.h +// \author Reinhard Hameeteman +// \date 2008-11-04 +// +// Sync float or vector depending on difference criterium +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlSyncFields_H +#define __mlSyncFields_H + + +// Local includes +#include "../MLCMFieldsSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +ML_START_NAMESPACE + +#define NFIELDS 10 + +//! Sync float or vector depending on difference criterium +class MLCMFIELDS_EXPORT SyncFields : public BaseOp +{ +public: + + //! Constructor. + SyncFields (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + + DoubleField *f_Precision; + EnumField *f_Mode; + BoolField *f_On; + std::vector< DoubleField* > m_FloatsFields; + std::vector< Vec6fField* > m_Vec6Fields; + + +private: + + template< typename T > bool DiffTest( const T first, const T last, const double precision ); + bool DiffTest( const double first, const double last, const double precision ); + bool m_Updating; + + enum {FLOAT=0, MULTIFLOAT, VECTOR, MULTIVECTOR }; + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(SyncFields) +}; + + +ML_END_NAMESPACE + +#endif // __mlSyncFields_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bar...@us...> - 2010-06-17 06:46:03
|
Revision: 279 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=279&view=rev Author: bartdedobbelaer Date: 2010-06-17 06:45:57 +0000 (Thu, 17 Jun 2010) Log Message: ----------- - Added WEM in- and output Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2010-06-14 08:15:30 UTC (rev 278) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2010-06-17 06:45:57 UTC (rev 279) @@ -62,9 +62,19 @@ } } } - Box "XMarker names" { - Field inXMarkerName {title = "Input name:" expandX = yes} - Field outXMarkerName {title = "Output name:" expandX = yes} + Horizontal { + Vertical { + Box "XMarker names" { + Field inXMarkerName {title = "Input name:" expandX = yes} + Field outXMarkerName {title = "Output name:" expandX = yes} + } + } + Vertical { + Box "WEM names" { + Field inWEMName {title = "Input name:" expandX = yes} + Field outWEMName {title = "Output name:" expandX = yes} + } + } } } Horizontal { Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-06-14 08:15:30 UTC (rev 278) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-06-17 06:45:57 UTC (rev 279) @@ -14,7 +14,7 @@ DLLDESTDIR = ../../../lib # add dependencies of this project here -CONFIG += dll ML MLBase MLMacOSSupport +CONFIG += dll ML MLBase MLMacOSSupport MLWEM # set high warn level (warn 4 on MSCV) WARN = HIGH Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-14 08:15:30 UTC (rev 278) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-17 06:45:57 UTC (rev 279) @@ -75,6 +75,10 @@ (_inputXMarkerListFld = fields->addBase("inputXMarkerList"))->setBaseValue(NULL); _outputXMarkerListFld = fields->addBase("outputXMarkerList"); _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); + + ML_CHECK_NEW(_outWEM,WEM()); + (_inputWEMFld = fields->addBase("inputWEM"))->setBaseValue(NULL); + (_outputWEMFld = fields->addBase("outputWEM"))->setBaseValue(_outWEM); //! Use matlab commands in text field. (_matlabScriptFld = fields->addString("matlabScript"))->setStringValue("Output0=Input0 % Type your matlab script here."); @@ -95,6 +99,9 @@ //! Set input and output XMarker names used in matlab. (_inXMarkerNameFld = fields->addString("inXMarkerName"))->setStringValue("inXMarker"); (_outXMarkerNameFld = fields->addString("outXMarkerName"))->setStringValue("outXMarker"); + //! Set input and output WEM names used in matlab. + (_inWEMNameFld = fields->addString("inWEMName"))->setStringValue("inWEM"); + (_outWEMNameFld = fields->addString("outWEMName"))->setStringValue("outWEM"); //! Create image data randomly. (_autoCalculationFld = fields->addBool("autoUpdate"))->setBoolValue(false); @@ -234,6 +241,8 @@ if (m_pEngine != NULL) { engClose(m_pEngine); } + + ML_DELETE(_outWEM); } @@ -271,7 +280,7 @@ // Update output on an update or if autoapply is enabled. if( (field == _calculateFld) || (_autoCalculationFld->isOn() && ((field == getInField(0))||(field == getInField(1))||(field == getInField(2))|| - (field == _inXMarkerNameFld)) ) || + (field == _inputXMarkerListFld)) || (field== _inputWEMFld) ) || (_autoApplyFld->isOn() && ((field == _scalarFld[0])||(field == _scalarFld[1])||(field == _scalarFld[2])|| (field == _scalarFld[3])||(field == _scalarFld[4])||(field == _scalarFld[5])|| (field == _vectorFld[0])||(field == _vectorFld[1])||(field == _vectorFld[2])|| @@ -305,6 +314,13 @@ _copyInputXMarkerToMatlab(); } } + if (_inputWEMFld->getBaseValue() != NULL) { + // Check if a valid WEM is attached to the input + if (_inputWEMFld->isValidValue() && ML_BASE_IS_A(_inputWEMFld->getBaseValue(), WEM)) { + // Copy input WEM to Matlab. + _copyInputWEMToMatlab(); + } + } // Copy input image data to matlab. _copyInputImageDataToMatlab(); @@ -359,6 +375,10 @@ // Get XMarkerList from Matlab and copy results into output XMarkerList _getXMarkerBackFromMatlab(); + + // Get WEM from Matlab and copy results into output WEM + _getWEMBackFromMatlab(); + // Get scalars back from matlab. First store the current scalars so that // we can check if they change. A notification is only sent upon change. @@ -417,6 +437,16 @@ // Notify the XMarkerList output _outputXMarkerListFld->notifyAttachments(); + + // Notify the WEM output + std::vector<WEMEventContainer>ecList; + WEMEventContainer ec; + ec.notificationType = WEM_NOTIFICATION_FINISHED | + WEM_NOTIFICATION_SELECTION | + WEM_NOTIFICATION_REPAINT; + ecList.push_back(ec); + + _outWEM->notifyObservers(ecList); } } @@ -708,7 +738,13 @@ clearString << _inXMarkerNameFld->getStringValue() << " "; // Clear output XMarker data - clearString << _outXMarkerNameFld->getStringValue(); + clearString << _outXMarkerNameFld->getStringValue() << " "; + + // Clear input WEM data + clearString << _inWEMNameFld->getStringValue() << " "; + + // Clear output WEM data + clearString << _outWEMNameFld->getStringValue(); // Evaluate the string in Matlab engEvalString(m_pEngine, clearString.str().c_str()); @@ -948,6 +984,169 @@ } } +//! Copy input WEM to matlab. +void MatlabScriptWrapper::_copyInputWEMToMatlab() +{ + if (!_checkMatlabIsStarted()) + { + std::cerr << "_copyInputWEMToMatlab(): Cannot find Matlab engine!" << std::endl << std::flush; + return; + } + + // Get input list. + WEM *inputWEM = mlbase_cast<WEM*>(_inputWEMFld->getBaseValue()); + + // Internal loop. + unsigned int i = 0, j = 0, k = 0, m = 0; + unsigned int totalNumNodes = 0, numTriangulatedNodes = 0; + WEMNode *node = NULL; + WEMFace *face = NULL; + Vector3 position = NULL_VEC; + Vector3 normal = NULL_VEC; + unsigned int entryNumber = 0; + + // Get input WEM name from GUI. + std::string inWEMStr = _inWEMNameFld->getStringValue(); + + // Strings to evaluate. + std::ostringstream setNodes, setFaces, setNormals; + setNodes << inWEMStr.c_str() << ".nodes=["; + setFaces << inWEMStr.c_str() << ".faces=["; + setNormals << inWEMStr.c_str() << ".normals=["; + + // Loop over all patches -> flatten WEM + for (i = 0; i < inputWEM->getNumWEMPatches(); i ++) { + WEMPatch *wemPatch = inputWEM->getWEMPatchAt(i); + + // Loop over all nodes + const unsigned int numNodes = wemPatch->getNumNodes(); + for (j = 0; j < numNodes; j ++) { + node = wemPatch->getNodeAt(j); + position = node->getPosition(); + setNodes << std::dec << position[0] << "," << std::dec << position[1] << "," << std::dec << position[2] << ";"; + } + numTriangulatedNodes = 0; + + // Loop over all faces + const unsigned int numFaces = wemPatch->getNumFaces(); + for (j = 0; j < numFaces; j ++) { + face = wemPatch->getFaceAt(j); + const unsigned int numFaceNodes = face->getNumNodes(); + if (numFaceNodes == 3) { + for (k = 0; k < 3; k ++) { + entryNumber = totalNumNodes + face->getNodeAt(k)->getEntryNumber(); + setFaces << entryNumber << ","; + } + setFaces << ";"; + } else { + position = face->getCentroid(); + setNodes << std::dec << position[0] << "," << std::dec << position[1] << "," << std::dec << position[2] << ";"; + numTriangulatedNodes ++; + + for (k = 0; k < numFaceNodes; k ++) { + for (m = 0; m < 2; m ++) { + entryNumber = totalNumNodes + face->getNodeAt((m + k) % numFaceNodes)->getEntryNumber(); + setFaces << entryNumber << ","; + } + setFaces << totalNumNodes + node->getEntryNumber(); + setFaces << ";"; + } + + } + normal = face->getNormal(); + setNormals << std::dec << normal[0] << "," << std::dec << normal[1] << "," << std::dec << normal[2] << ";"; + } + + totalNumNodes += numNodes + numTriangulatedNodes; + } + + setNodes << "]"; + setFaces << "]"; + setNormals << "]"; + + // Put WEM into matlab structure. + engEvalString(m_pEngine, setNodes.str().c_str()); + engEvalString(m_pEngine, setFaces.str().c_str()); + engEvalString(m_pEngine, setNormals.str().c_str()); +} + +//! Gets WEM from Matlab and copies results into output WEM. +void MatlabScriptWrapper::_getWEMBackFromMatlab() +{ + // Clear _outWEM. + _outWEM->removeAll(); + + // Check if Matlab is started. + if (!_checkMatlabIsStarted()) + { + std::cerr << "_getWEMBackFromMatlab(): Cannot find Matlab engine!" << std::endl << std::flush; + return; + } + + // Get names from GUI. + std::string outWEMStr = _outWEMNameFld->getStringValue(); + + // Variables + WEMTrianglePatch *triPatch = NULL; + WEMNode *node = NULL; + WEMTriangle *triangle = NULL; + unsigned int i = 0; + + std::ostringstream executeStr; + + // Get nodes + executeStr << "tmpOutWEMNodes=" << outWEMStr << ".nodes"; + engEvalString(m_pEngine, executeStr.str().c_str()); + mxArray *m_nodes = engGetVariable(m_pEngine, "tmpOutWEMNodes"); + engEvalString(m_pEngine, "clear tmpOutWEMNodes"); + executeStr.str(""); + + // Get faces + executeStr << "tmpOutWEMFaces=" << outWEMStr << ".faces"; + engEvalString(m_pEngine, executeStr.str().c_str()); + mxArray *m_faces = engGetVariable(m_pEngine, "tmpOutWEMFaces"); + engEvalString(m_pEngine, "clear tmpOutWEMFaces"); + executeStr.str(""); + + // Get data from Matlab array. + if ((m_nodes && !mxIsEmpty(m_nodes) && mxGetClassID(m_nodes) == mxDOUBLE_CLASS) && + (m_faces && !mxIsEmpty(m_faces) && mxGetClassID(m_faces) == mxDOUBLE_CLASS)) + { + double *dataNodes = static_cast<double*>(mxGetPr(m_nodes)); + double *dataFaces = static_cast<double*>(mxGetPr(m_faces)); + + if (dataNodes != NULL) { + const size_t node_rows = mxGetM(m_nodes); + + ML_CHECK_NEW(triPatch, WEMTrianglePatch()); + + for (i = 0; i < node_rows; i ++) { + node = triPatch->addNode(); + node->setPosition(dataNodes[i], dataNodes[i + node_rows], dataNodes[i + 2 * node_rows]); + } + + const size_t face_rows = mxGetM(m_faces); + + for (i = 0; i < face_rows; i ++) { + triangle = triPatch->addTriangle(); + node = triPatch->getNodeAt(dataFaces[i]); triangle->setNode(0,node); node->addFace(triangle); + node = triPatch->getNodeAt(dataFaces[i + face_rows]); triangle->setNode(1,node); node->addFace(triangle); + node = triPatch->getNodeAt(dataFaces[i + 2 * face_rows]); triangle->setNode(2,node); node->addFace(triangle); + } + + triPatch->buildEdgeConnectivity(); + triPatch->computeNormals(); + + _outWEM->addWEMPatch(triPatch); + + } + + } + + mxDestroyArray(m_nodes); + mxDestroyArray(m_faces); +} + //! Copies scalar values to matlab. void MatlabScriptWrapper::_copyInputScalarsToMatlab() { Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-06-14 08:15:30 UTC (rev 278) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-06-17 06:45:57 UTC (rev 279) @@ -44,6 +44,7 @@ // SDK includes #include <mlXMarkerList.h> #include <mlVersion.h> +#include <WEMBase/WEM.h> // System includes #include <string> @@ -128,6 +129,10 @@ void _copyInputXMarkerToMatlab(); //! Copies XMarkerList from Matlab and copies results into output XMarkerList. void _getXMarkerBackFromMatlab(); + //! Copies WEM to matlab. + void _copyInputWEMToMatlab(); + //! Copies WEM from matlab. + void _getWEMBackFromMatlab(); //! Copies scalar values to matlab. void _copyInputScalarsToMatlab(); //! Copies scalar values from matlab. @@ -155,6 +160,13 @@ BaseField *_outputXMarkerListFld; //! The output list XMarkerList _outputXMarkerList; + + //! The WEM input field. + BaseField *_inputWEMFld; + //! The WEM output field. + BaseField *_outputWEMFld; + //! The output WEM. + WEM *_outWEM; //! Type a matlab script into this field. StringField* _matlabScriptFld; @@ -175,6 +187,10 @@ StringField *_inXMarkerNameFld; StringField *_outXMarkerNameFld; //@} + //{@ Set matlab names for input and output WEM. + StringField *_inWEMNameFld; + StringField *_outWEMNameFld; + //@} //! If pressed, the module updates. NotifyField* _calculateFld; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bar...@us...> - 2010-06-17 07:28:41
|
Revision: 280 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=280&view=rev Author: bartdedobbelaer Date: 2010-06-17 07:28:34 +0000 (Thu, 17 Jun 2010) Log Message: ----------- - Added WEM output generation to the example network - Relaxed requirement for presence of faces, this way point clouds also represent a valid output Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab 2010-06-17 06:45:57 UTC (rev 279) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab 2010-06-17 07:28:34 UTC (rev 280) @@ -4,12 +4,302 @@ } module Comment { internal { + frame = "1081 277 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "912 589 256 208" + sizeHint = "256 208" + wasOpen = no + wasActive = yes + } + } + } + fields { + instanceName = Comment4 + comment = "This example creates a cube in Matlab and outputs it to MeVisLab as a WEM. Press the Update button in the MatlabScriptWrapper and see the result in the SoExaminerViewer." + } + internalFields = "" +} +module SoExaminerViewer { + internal { + frame = "1205 213 152 56" + moduleGroupName = "" + windows { + window _default { + geometry = "26 59 489 362" + sizeHint = "489 362" + wasOpen = no + wasActive = no + } + window _viewer { + geometry = "1175 433 490 468" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer2 + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = DELAYED_BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + inputDevicesList = "" + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + stereoViewing = FALSE + stereoOffset = 3 + height = 0.78539801 + position = "-1.55051124095917 1.04046010971069 1.21177983283997" + orientation = "0.635775923728943 0.228879645466805 -0.737158834934235 4.71452140808105" + nearDistance = 1.370454 + farDistance = 3.0832441 + focalDistance = 2.2259948 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module SoWEMRenderer { + internal { + frame = "1213 285 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "420 451 347 443" + sizeHint = "347 443" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoWEMRenderer1 + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + useHighlightSelected = FALSE + usePolygonOffset = TRUE + useShapeHints = TRUE + allowHits = TRUE + parameterOverwriteMode = OVERWRITE_MODE_ALL + overwriteColorMode = FALSE + overwriteFaceParameters = FALSE + overwriteEdgeParameters = FALSE + overwriteNodeParameters = FALSE + overwriteBoundingBoxParameters = FALSE + colorMode = WEM_COLOR_LUT_VALUES + drawFaces = TRUE + faceDiffuseColor = "0.760784327983856 0.756862759590149 0.752941191196442" + useFaceAmbientColor = TRUE + faceAmbientColor = "0.803921580314636 0.796078443527222 0.800000011920929" + useFaceSpecularColor = TRUE + faceSpecularColor = "0 0 0" + drawEdges = FALSE + edgeColor = "0 0 0" + drawNodes = FALSE + nodeColor = "1 1 1" + drawBoundingBoxes = FALSE + boundingBoxColor = "1 1 1" + drawFaceNormals = FALSE + drawNodeNormals = FALSE + faceNormalColor = "1 1 1" + nodeNormalColor = "1 1 1" + faceNormalScaling = 1 + nodeNormalScaling = 1 + faceAlphaValue = 1 + faceShininessValue = 1 + lineWidth = 1 + pointSize = 1 + useEdgeColoringMode = FALSE + nodeRenderingMode = WEM_NODE_RENDERING_NORMAL + boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED + primitiveValueLists = LUT + selectedPrimitiveValueList = LUT + primitiveValueListValid = FALSE + selectedTab = 0 + } +} +module MatlabScriptWrapper { + internal { + frame = "1153 365 160 56" + moduleGroupName = "" + windows { + window _default { + geometry = "659 306 600 619" + sizeHint = "616 619" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MatlabScriptWrapper4 + matlabScript = "outWEM.nodes = [ + -.5 .5 .5; + .5 .5 .5; + .5 -.5 .5; + -.5 -.5 .5; + -.5 .5 -.5; + .5 .5 -.5; + .5 -.5 -.5; + -.5 -.5 -.5 + ] +outWEM.faces = [ + 1 5 4; + 1 4 0; + 2 6 5; + 2 5 1; + 3 7 6; + 3 6 2; + 4 7 3; + 4 3 0; + 3 2 1; + 3 1 0; + 5 6 7; + 5 7 4 + ]" + useExternalScript = FALSE + matlabScriptPath = "" + inDataName0 = Input0 + inDataName1 = Input1 + inDataName2 = Input2 + outDataName0 = Output0 + outDataName1 = Output1 + outDataName2 = Output2 + inXMarkerName = inXMarker + outXMarkerName = outXMarker + inWEMName = inWEM + outWEMName = outWEM + autoUpdate = FALSE + autoApply = FALSE + status = "Execution successful!" + scalarName0 = scalar0 + scalar0 = 0 + scalarName1 = scalar1 + scalar1 = 0 + scalarName2 = scalar2 + scalar2 = 0 + scalarName3 = scalar3 + scalar3 = 0 + scalarName4 = scalar4 + scalar4 = 0 + scalarName5 = scalar5 + scalar5 = 0 + stringName0 = string0 + string0 = "" + stringName1 = string1 + string1 = "" + stringName2 = string2 + string2 = "" + stringName3 = string3 + string3 = "" + stringName4 = string4 + string4 = "" + stringName5 = string5 + string5 = "" + vectorName0 = vector0 + vector0 = "0 0 0 0" + vectorName1 = vector1 + vector1 = "0 0 0 0" + vectorName2 = vector2 + vector2 = "0 0 0 0" + vectorName3 = vector3 + vector3 = "0 0 0 0" + vectorName4 = vector4 + vector4 = "0 0 0 0" + vectorName5 = vector5 + vector5 = "0 0 0 0" + matrixName0 = matrix0 + matrix0 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName1 = matrix1 + matrix1 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName2 = matrix2 + matrix2 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matlabOutput = "<PRE>>> +outWEM = + + nodes: [8x3 double] + +>> +outWEM = + + nodes: [8x3 double] + faces: [12x3 double] + +" + showSessionWindow = TRUE + } +} +module Comment { + internal { frame = "953 589 96 56" moduleGroupName = "" windows { window _default { - geometry = "625 584 256 209" - sizeHint = "256 209" + geometry = "625 584 256 208" + sizeHint = "256 208" wasOpen = no wasActive = no } @@ -46,6 +336,7 @@ useHighlightSelected = FALSE usePolygonOffset = TRUE useShapeHints = TRUE + allowHits = TRUE parameterOverwriteMode = OVERWRITE_MODE_ALL overwriteColorMode = FALSE overwriteFaceParameters = FALSE @@ -56,7 +347,7 @@ drawFaces = TRUE faceDiffuseColor = "1 1 0" useFaceAmbientColor = TRUE - faceAmbientColor = "1 0.3333333432674408 0" + faceAmbientColor = "1 0.333333343267441 0" useFaceSpecularColor = TRUE faceSpecularColor = "0 0 0" drawEdges = FALSE @@ -78,7 +369,7 @@ useEdgeColoringMode = FALSE nodeRenderingMode = WEM_NODE_RENDERING_NORMAL boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED - primitiveValueLists = LUT + primitiveValueLists = "" selectedPrimitiveValueList = LUT primitiveValueListValid = TRUE selectedTab = 0 @@ -86,7 +377,7 @@ } module SoExaminerViewer { internal { - frame = "793 445 144 56" + frame = "789 445 152 56" moduleGroupName = "" windows { window _default { @@ -127,6 +418,7 @@ autoUpdateML = FALSE showSnapshotWithShell = FALSE snapCount = 0 + inputDevicesList = "" headlight = TRUE decoration = TRUE popupMenuEnabled = FALSE @@ -146,12 +438,14 @@ cursor = TRUE isCameraStored = TRUE perspective = TRUE - height = 0.7853980064 - position = "48.92348480224609 94.9647216796875 145.5186157226562" - orientation = "0.3436312079429626 -0.2769282162189484 -0.8973450660705566 5.137053489685059" - nearDistance = 96.22691345 - farDistance = 141.0202637 - focalDistance = 118.6015244 + stereoViewing = FALSE + stereoOffset = 3 + height = 0.78539801 + position = "48.9234848022461 94.9647216796875 145.518615722656" + orientation = "0.343631237745285 -0.276928246021271 -0.897345185279846 5.13705348968506" + nearDistance = 96.226913 + farDistance = 141.02026 + focalDistance = 118.60152 forceRedrawOnInteraction = FALSE button1events = TO_VIEWER button2events = TO_VIEWER @@ -183,8 +477,6 @@ } fields { instanceName = WEMIsoSurface - isProcessing = FALSE - elapsedTime = 0.123999998 id = 0 autoApply = TRUE autoUpdate = TRUE @@ -197,7 +489,7 @@ colorMode = "General " drawFaces = TRUE useFaceAmbientColor = TRUE - faceAmbientColor = "1 0 0.4980392156862745" + faceAmbientColor = "1 0 0.498039215686275" useFaceDiffuseColor = TRUE faceDiffuseColor = "1 0 0" useFaceSpecularColor = TRUE @@ -233,7 +525,6 @@ useFaceValueList = FALSE useValenceThreeRemoval = TRUE useZeroLengthEdgeRemoval = TRUE - progress = 1 selectedTab = 2 } } @@ -258,7 +549,7 @@ } module View2D { internal { - frame = "1097 541 80 56" + frame = "1093 541 88 56" moduleGroupName = "" windows { window _default { @@ -286,7 +577,7 @@ cineMode = CINE_Z cineDirection = CINE_PINGPONG cineRepeat = CINE_ONCE - cineSpeed = 0.1000000015 + cineSpeed = 0.1 snapToCenter = FALSE zoomMode = VIEW2D_AUTO_ZOOM unzoomOnImageChange = FALSE @@ -301,26 +592,26 @@ annotationOn = TRUE annotationMode = ANNO_MODE_AUTO annotationSizeMode = ANNO_SHOW_DETAILED - annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationCol = "0.899999976158142 0.899999976158142 0.899999976158142" annotationFontSize = ANNO_SIZE_AUTO annoCoords = Voxel annoCTValue = AsIs borderOn = TRUE - borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + borderColor = "0.899999976158142 0.899999976158142 0.899999976158142" valueHighPrecision = FALSE + maxPrecision = 4 plane = "0 0 1 5.5" } internalFields = "" } module LocalImage { internal { - frame = "1161 685 96 56" + frame = "1157 685 104 56" moduleGroupName = "" } fields { instanceName = LocalImage name = $(DemoDataPath)/Bone.tiff - trueName = "" autoLoad = TRUE status = "File open" } @@ -368,7 +659,7 @@ } module MatlabScriptWrapper { internal { - frame = "1189 533 152 56" + frame = "1185 533 160 56" moduleGroupName = "" windows { window _default { @@ -381,7 +672,7 @@ } fields { instanceName = MatlabScriptWrapper3 - MatlabScript = "% This script illustrates the difference in coordinate + matlabScript = "% This script illustrates the difference in coordinate % systems in MeVisLab and Matlab. MeVisLab uses a % (x,y) system while Matlab uses a (y,x) system. Image % will therefore appear flipped. The Matlab command @@ -407,7 +698,10 @@ outDataName2 = Output2 inXMarkerName = inXMarker outXMarkerName = outXMarker + inWEMName = inWEM + outWEMName = outWEM autoUpdate = FALSE + autoApply = FALSE status = "Execution successful!" scalarName0 = scalar0 scalar0 = 0 @@ -421,11 +715,52 @@ scalar4 = 0 scalarName5 = scalar5 scalar5 = 0 + stringName0 = string0 + string0 = "" + stringName1 = string1 + string1 = "" + stringName2 = string2 + string2 = "" + stringName3 = string3 + string3 = "" + stringName4 = string4 + string4 = "" + stringName5 = string5 + string5 = "" + vectorName0 = vector0 + vector0 = "0 0 0 0" + vectorName1 = vector1 + vector1 = "0 0 0 0" + vectorName2 = vector2 + vector2 = "0 0 0 0" + vectorName3 = vector3 + vector3 = "0 0 0 0" + vectorName4 = vector4 + vector4 = "0 0 0 0" + vectorName5 = vector5 + vector5 = "0 0 0 0" + matrixName0 = matrix0 + matrix0 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName1 = matrix1 + matrix1 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName2 = matrix2 + matrix2 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matlabOutput = "" + showSessionWindow = TRUE } } module StylePalette { internal { - frame = "49 621 96 56" + frame = "45 621 104 56" moduleGroupName = "" } fields { @@ -527,7 +862,7 @@ } module MatlabScriptWrapper { internal { - frame = "813 661 152 56" + frame = "809 661 160 56" moduleGroupName = "" windows { window _default { @@ -540,7 +875,7 @@ } fields { instanceName = MatlabScriptWrapper2 - MatlabScript = "% The script lines below sets the output image to an implicit % function representation of a torus. + matlabScript = "% The script lines below sets the output image to an implicit % function representation of a torus. [x,y,z] = meshgrid(-10:0.25:10,-10:0.25:10,-10:0.25:10); R = 6; Output0 = (R-sqrt(x.^2+y.^2)).^2 + z.^2;" @@ -554,7 +889,10 @@ outDataName2 = Output2 inXMarkerName = inXMarker outXMarkerName = outXMarker + inWEMName = inWEM + outWEMName = outWEM autoUpdate = FALSE + autoApply = FALSE status = "Execution successful!" scalarName0 = scalar0 scalar0 = 0 @@ -568,6 +906,47 @@ scalar4 = 0 scalarName5 = scalar5 scalar5 = 0 + stringName0 = string0 + string0 = "" + stringName1 = string1 + string1 = "" + stringName2 = string2 + string2 = "" + stringName3 = string3 + string3 = "" + stringName4 = string4 + string4 = "" + stringName5 = string5 + string5 = "" + vectorName0 = vector0 + vector0 = "0 0 0 0" + vectorName1 = vector1 + vector1 = "0 0 0 0" + vectorName2 = vector2 + vector2 = "0 0 0 0" + vectorName3 = vector3 + vector3 = "0 0 0 0" + vectorName4 = vector4 + vector4 = "0 0 0 0" + vectorName5 = vector5 + vector5 = "0 0 0 0" + matrixName0 = matrix0 + matrix0 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName1 = matrix1 + matrix1 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName2 = matrix2 + matrix2 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matlabOutput = "" + showSessionWindow = TRUE } } module Comment { @@ -632,7 +1011,7 @@ maxTimePoint = 0 filterMode = FILTER_LINEAR inheritFilterMode = TRUE - alphaFactor = 0.5619999766 + alphaFactor = 0.56199998 baseColor = "1 1 0" useWorldCoords = FALSE applyLut = TRUE @@ -671,7 +1050,7 @@ cineMode = CINE_Z cineDirection = CINE_PINGPONG cineRepeat = CINE_ONCE - cineSpeed = 0.1000000015 + cineSpeed = 0.1 snapToCenter = FALSE zoomMode = VIEW2D_AUTO_ZOOM unzoomOnImageChange = FALSE @@ -686,20 +1065,21 @@ annotationOn = TRUE annotationMode = ANNO_MODE_AUTO annotationSizeMode = ANNO_SHOW_DETAILED - annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationCol = "0.899999976158142 0.899999976158142 0.899999976158142" annotationFontSize = ANNO_SIZE_AUTO annoCoords = Voxel annoCTValue = AsIs borderOn = TRUE - borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + borderColor = "0.899999976158142 0.899999976158142 0.899999976158142" valueHighPrecision = FALSE + maxPrecision = 4 plane = "0 0 1 0.5" } internalFields = "" } module TestPattern { internal { - frame = "441 653 96 56" + frame = "437 653 104 56" moduleGroupName = "" windows { window _default { @@ -722,6 +1102,10 @@ fillValue = 1 autoApply = TRUE pattern = FilledMaxEllipsoid + voxelSize = "1 1 1" + gradient = "0 0 0" + eigenValues = "1 0 -1" + offDiagonalElements = "0 0 0" fillValue2 = 0 pageSizeX = 32 pageSizeY = 32 @@ -733,7 +1117,7 @@ } module MatlabScriptWrapper { internal { - frame = "533 549 152 56" + frame = "529 549 160 56" moduleGroupName = "" windows { window _default { @@ -746,7 +1130,7 @@ } fields { instanceName = MatlabScriptWrapper1 - MatlabScript = "% This script illustrates with a toy example how images can be + matlabScript = "% This script illustrates with a toy example how images can be % imported into Matlab, modified and exported back to MeVisLab. % In this particular example, the input image is divided with a % sinusoidal pattern. @@ -773,7 +1157,10 @@ outDataName2 = Output2 inXMarkerName = inXMarker outXMarkerName = outXMarker + inWEMName = inWEM + outWEMName = outWEM autoUpdate = FALSE + autoApply = FALSE status = "Execution successful!" scalarName0 = scalar0 scalar0 = 0 @@ -787,6 +1174,47 @@ scalar4 = 0 scalarName5 = scalar5 scalar5 = 0 + stringName0 = string0 + string0 = "" + stringName1 = string1 + string1 = "" + stringName2 = string2 + string2 = "" + stringName3 = string3 + string3 = "" + stringName4 = string4 + string4 = "" + stringName5 = string5 + string5 = "" + vectorName0 = vector0 + vector0 = "0 0 0 0" + vectorName1 = vector1 + vector1 = "0 0 0 0" + vectorName2 = vector2 + vector2 = "0 0 0 0" + vectorName3 = vector3 + vector3 = "0 0 0 0" + vectorName4 = vector4 + vector4 = "0 0 0 0" + vectorName5 = vector5 + vector5 = "0 0 0 0" + matrixName0 = matrix0 + matrix0 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName1 = matrix1 + matrix1 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName2 = matrix2 + matrix2 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matlabOutput = "" + showSessionWindow = TRUE } } module Comment { @@ -811,7 +1239,7 @@ } module SoExaminerViewer { internal { - frame = "85 429 136 56" + frame = "81 429 144 56" moduleGroupName = "" windows { window _viewer { @@ -846,6 +1274,7 @@ autoUpdateML = FALSE showSnapshotWithShell = FALSE snapCount = 0 + inputDevicesList = "" headlight = TRUE decoration = TRUE popupMenuEnabled = FALSE @@ -865,12 +1294,14 @@ cursor = TRUE isCameraStored = TRUE perspective = TRUE - height = 0.7853981853 - position = "1.466153740882874 -34.25235366821289 -22.5416316986084" - orientation = "-0.1885406076908112 0.8626965284347534 -0.4692621827125549 3.305067300796509" - nearDistance = 31.73994255 - farDistance = 50.33739471 - focalDistance = 41.04526138 + stereoViewing = FALSE + stereoOffset = 3 + height = 0.78539819 + position = "1.46615374088287 -34.2523536682129 -22.5416316986084" + orientation = "-0.188540622591972 0.862696647644043 -0.469262212514877 3.30506730079651" + nearDistance = 31.739943 + farDistance = 50.337395 + focalDistance = 41.045261 forceRedrawOnInteraction = FALSE button1events = TO_VIEWER button2events = TO_VIEWER @@ -906,8 +1337,8 @@ renderCulling = AUTO pickCulling = AUTO scaleSize = 3 - scaleLength = 0.1000000015 - color = "0.3333333432674408 1 0" + scaleLength = 0.1 + color = "0.333333343267441 1 0" validStylePalette = TRUE enableVector = FALSE drawingOn = TRUE @@ -934,7 +1365,7 @@ listStringEnable = FALSE ownsList = FALSE applySelect = FALSE - id = 0 + id = -1 name = "" newName = "" actionClass = New @@ -945,12 +1376,12 @@ maxSize = 0 useInsertTemplate = FALSE upToDate = TRUE - posXYZ = "10 0 0" + posXYZ = "0 0 0" posC = 0 posT = 0 posU = 0 - vecXYZ = "0 10 0" - type = 1 + vecXYZ = "0 0 0" + type = 0 newPosXYZ = "0 0 0" newPosC = 0 newPosT = 0 @@ -961,7 +1392,7 @@ } module MatlabScriptWrapper { internal { - frame = "145 621 144 56" + frame = "141 621 152 56" moduleGroupName = "" windows { window _default { @@ -974,7 +1405,7 @@ } fields { instanceName = MatlabScriptWrapper - MatlabScript = "% This script illustrates how an XMarkerList is generated + matlabScript = "% This script illustrates how an XMarkerList is generated % in Matlab and exported to MeVisLab. % Generate 30 angles between 0 and 2*pi @@ -996,7 +1427,10 @@ outDataName2 = Output2 inXMarkerName = inXMarker outXMarkerName = OutputXMarkerList + inWEMName = inWEM + outWEMName = outWEM autoUpdate = FALSE + autoApply = FALSE status = "Execution successful!" scalarName0 = scalar0 scalar0 = 0 @@ -1010,9 +1444,52 @@ scalar4 = 0 scalarName5 = scalar5 scalar5 = 0 + stringName0 = string0 + string0 = "" + stringName1 = string1 + string1 = "" + stringName2 = string2 + string2 = "" + stringName3 = string3 + string3 = "" + stringName4 = string4 + string4 = "" + stringName5 = string5 + string5 = "" + vectorName0 = vector0 + vector0 = "0 0 0 0" + vectorName1 = vector1 + vector1 = "0 0 0 0" + vectorName2 = vector2 + vector2 = "0 0 0 0" + vectorName3 = vector3 + vector3 = "0 0 0 0" + vectorName4 = vector4 + vector4 = "0 0 0 0" + vectorName5 = vector5 + vector5 = "0 0 0 0" + matrixName0 = matrix0 + matrix0 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName1 = matrix1 + matrix1 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName2 = matrix2 + matrix2 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matlabOutput = "" + showSessionWindow = TRUE } } connections { + SoExaminerViewer2.children = SoWEMRenderer1.self + SoWEMRenderer1.inWEM = MatlabScriptWrapper4.outputWEM TorusRenderer.inWEM = WEMIsoSurface.outWEM SoExaminerViewer1.children = TorusRenderer.self WEMIsoSurface.input0 = MatlabScriptWrapper2.output0 Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-17 06:45:57 UTC (rev 279) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-17 07:28:34 UTC (rev 280) @@ -1109,11 +1109,9 @@ executeStr.str(""); // Get data from Matlab array. - if ((m_nodes && !mxIsEmpty(m_nodes) && mxGetClassID(m_nodes) == mxDOUBLE_CLASS) && - (m_faces && !mxIsEmpty(m_faces) && mxGetClassID(m_faces) == mxDOUBLE_CLASS)) + if (m_nodes && !mxIsEmpty(m_nodes) && mxGetClassID(m_nodes) == mxDOUBLE_CLASS) { double *dataNodes = static_cast<double*>(mxGetPr(m_nodes)); - double *dataFaces = static_cast<double*>(mxGetPr(m_faces)); if (dataNodes != NULL) { const size_t node_rows = mxGetM(m_nodes); @@ -1125,22 +1123,27 @@ node->setPosition(dataNodes[i], dataNodes[i + node_rows], dataNodes[i + 2 * node_rows]); } - const size_t face_rows = mxGetM(m_faces); - - for (i = 0; i < face_rows; i ++) { - triangle = triPatch->addTriangle(); - node = triPatch->getNodeAt(dataFaces[i]); triangle->setNode(0,node); node->addFace(triangle); - node = triPatch->getNodeAt(dataFaces[i + face_rows]); triangle->setNode(1,node); node->addFace(triangle); - node = triPatch->getNodeAt(dataFaces[i + 2 * face_rows]); triangle->setNode(2,node); node->addFace(triangle); + if (m_faces && !mxIsEmpty(m_faces) && mxGetClassID(m_faces) == mxDOUBLE_CLASS) + { + double *dataFaces = static_cast<double*>(mxGetPr(m_faces)); + + if (dataFaces != NULL) { + const size_t face_rows = mxGetM(m_faces); + + for (i = 0; i < face_rows; i ++) { + triangle = triPatch->addTriangle(); + node = triPatch->getNodeAt(dataFaces[i]); triangle->setNode(0,node); node->addFace(triangle); + node = triPatch->getNodeAt(dataFaces[i + face_rows]); triangle->setNode(1,node); node->addFace(triangle); + node = triPatch->getNodeAt(dataFaces[i + 2 * face_rows]); triangle->setNode(2,node); node->addFace(triangle); + } + } } triPatch->buildEdgeConnectivity(); triPatch->computeNormals(); _outWEM->addWEMPatch(triPatch); - - } - + } } mxDestroyArray(m_nodes); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-07-23 13:20:18
|
Revision: 297 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=297&view=rev Author: rhameeteman Date: 2010-07-23 13:20:08 +0000 (Fri, 23 Jul 2010) Log Message: ----------- KH. * Added the option to convert the box vectors from world to voxel and vice versa. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h Modified: trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html 2010-07-23 10:18:48 UTC (rev 296) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html 2010-07-23 13:20:08 UTC (rev 297) @@ -22,7 +22,8 @@ </blockquote> <h3><a NAME=Details></a>Details</h3> -<blockquote>Box0 and Box1 can be obtained form input0 and input1 respectively or from the scalar, vector or box fileds. If you select input0 or input1, UseVoxelCenter can be used to use (0.5,0.5,0.5) as origin of the image (seems to be needed when connecting the output box to a SubImage module).<br/> +<blockquote>Box0 and Box1 can be obtained form input0 and input1 respectively or from the scalar, vector or box fileds. If you select input0 or input1, UseVoxelCenter can be used to use (0.5,0.5,0.5) as origin of the image (seems to be needed when connecting the output box to a SubImage module). After Box0 an Box1 are defined they can be converted from world to voxel or vice versa according to the matrix of the corresponding input image and they can be corrected, by checking the appropriate chekboxes.<br/> +<br/> The following operations are available: <table> <tr><td>ExpandScalar:</td><td>Box.v1 = Box0.v1-Constant (applied to all components)</td></tr> Modified: trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def 2010-07-23 10:18:48 UTC (rev 296) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def 2010-07-23 13:20:08 UTC (rev 297) @@ -63,12 +63,16 @@ Label { title = "Box0:" alignGroupX = c1 } ButtonBar inputMode0 { show = Radio } CheckBox correctInput0 { title = Correct } + CheckBox w2VInput0 { title = w2v } + CheckBox v2WInput0 { title = v2w } } Horizontal { alignX = Left Label { title = "Box1:" alignGroupX = c1 } ButtonBar inputMode1 { show = Radio } CheckBox correctInput1 { title = Correct } + CheckBox w2VInput1 { title = w2v } + CheckBox v2WInput1 { title = v2w } } } Box "Scalar Input" { @@ -116,8 +120,14 @@ Field outputBox0 { title = Box0 } Field outputBox1 { title = Box1 } Horizontal { - Field outputBox { title = Box: } - CheckBox correctBox { title = correct } + Horizontal { + Field outputBox { title = Box: } + } + Horizontal { + alignX = Right + expandX = No + CheckBox correctBox { title = correct } + } } Field outputExtent { title = Size: } Field outV1 { title = v1: } Modified: trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-07-23 10:18:48 UTC (rev 296) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-07-23 13:20:08 UTC (rev 297) @@ -69,6 +69,18 @@ f_CorrectInput1 = fieldC->addBool( "correctInput1" ); f_CorrectInput1->setBoolValue( false ); + f_V2WInput0 = fieldC->addBool( "V2WInput0" ); + f_V2WInput0->setBoolValue( false ); + + f_V2WInput1 = fieldC->addBool( "V2WInput1" ); + f_V2WInput1->setBoolValue( false ); + + f_W2VInput0 = fieldC->addBool( "W2VInput0" ); + f_W2VInput0->setBoolValue( false ); + + f_W2VInput1 = fieldC->addBool( "W2VInput1" ); + f_W2VInput1->setBoolValue( false ); + f_UseVoxelCenter = fieldC->addBool( "useVoxelCenter" ); f_UseVoxelCenter->setBoolValue( false ); @@ -131,13 +143,27 @@ //---------------------------------------------------------------------------------- //! Handle field changes of the field field. //---------------------------------------------------------------------------------- -void BoxArithmetic::handleNotification (Field * /*field*/) +void BoxArithmetic::handleNotification (Field *field) { ML_TRACE_IN("BoxArithmetic::handleNotification ()"); if (m_LockUpdate) {return;} m_LockUpdate = true; + if ( field == f_W2VInput0 && f_W2VInput0->getBoolValue() ){ + f_V2WInput0->setBoolValue( false ); + } + if ( field == f_W2VInput1 && f_W2VInput1->getBoolValue() ){ + f_V2WInput1->setBoolValue( false ); + } + + if ( field == f_V2WInput0 && f_V2WInput0->getBoolValue() ){ + f_W2VInput0->setBoolValue( false ); + } + if ( field == f_V2WInput1 && f_V2WInput1->getBoolValue() ){ + f_W2VInput1->setBoolValue( false ); + } + SubImgBoxf newBox = SubImgBoxf(); SubImgBoxf box0 = SubImgBoxf(); SubImgBoxf box1 = SubImgBoxf(); @@ -186,6 +212,32 @@ default: break; } + if ( f_W2VInput0->getBoolValue() ){ + PagedImg *inImage0 = getNonDummyUpdatedInImg( 0 ); + if ( inImage0 ){ + const Vector3 v1 = inImage0->mapWorldToVoxel(Vector3(box0.v1[0],box0.v1[1],box0.v1[2])); + const Vector3 v2 = inImage0->mapWorldToVoxel(Vector3(box0.v2[0],box0.v2[1],box0.v2[2])); + box0.v1[0] = v1[0]; + box0.v1[1] = v1[1]; + box0.v1[2] = v1[2]; + box0.v2[0] = v2[0]; + box0.v2[1] = v2[1]; + box0.v2[2] = v2[2]; + } + } + if ( f_V2WInput0->getBoolValue() ){ + PagedImg *inImage0 = getNonDummyUpdatedInImg( 0 ); + if ( inImage0 ){ + const Vector3 v1 = inImage0->mapVoxelToWorld(Vector3(box0.v1[0],box0.v1[1],box0.v1[2])); + const Vector3 v2 = inImage0->mapVoxelToWorld(Vector3(box0.v2[0],box0.v2[1],box0.v2[2])); + box0.v1[0] = v1[0]; + box0.v1[1] = v1[1]; + box0.v1[2] = v1[2]; + box0.v2[0] = v2[0]; + box0.v2[1] = v2[1]; + box0.v2[2] = v2[2]; + } + } if ( f_CorrectInput0->getBoolValue() ){ box0.correct(); } @@ -237,6 +289,32 @@ default: break; } + if ( f_W2VInput1->getBoolValue() ){ + const PagedImg *inImage1 = getNonDummyUpdatedInImg( 0 ); + if ( inImage1 ){ + const Vector3 v1 = inImage1->mapWorldToVoxel(Vector3(box1.v1[0],box1.v1[1],box1.v1[2])); + const Vector3 v2 = inImage1->mapWorldToVoxel(Vector3(box1.v2[0],box1.v2[1],box1.v2[2])); + box1.v1[0] = v1[0]; + box1.v1[1] = v1[1]; + box1.v1[2] = v1[2]; + box1.v2[0] = v2[0]; + box1.v2[1] = v2[1]; + box1.v2[2] = v2[2]; + } + } + if ( f_V2WInput0->getBoolValue() ){ + const PagedImg *inImage1 = getNonDummyUpdatedInImg( 1 ); + if ( inImage1 ){ + const Vector3 v1 = inImage1->mapVoxelToWorld(Vector3(box1.v1[0],box1.v1[1],box1.v1[2])); + const Vector3 v2 = inImage1->mapVoxelToWorld(Vector3(box1.v2[0],box1.v2[1],box1.v2[2])); + box1.v1[0] = v1[0]; + box1.v1[1] = v1[1]; + box1.v1[2] = v1[2]; + box1.v2[0] = v2[0]; + box1.v2[1] = v2[1]; + box1.v2[2] = v2[2]; + } + } if ( f_CorrectInput1->getBoolValue() ){ box1.correct(); } Modified: trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h 2010-07-23 10:18:48 UTC (rev 296) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h 2010-07-23 13:20:08 UTC (rev 297) @@ -58,7 +58,7 @@ BoxArithmetic (); //! Handle field changes of the field field. - virtual void handleNotification (Field * /*field*/); + virtual void handleNotification (Field * field); private: @@ -67,6 +67,10 @@ SubImgBoxfField *f_InBox1; BoolField *f_CorrectInput0; BoolField *f_CorrectInput1; + BoolField *f_V2WInput0; + BoolField *f_V2WInput1; + BoolField *f_W2VInput0; + BoolField *f_W2VInput1; BoolField *f_UseVoxelCenter; SubImgBoxfField *f_OutBox; SubImgBoxfField *f_OutBox0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-08-13 06:02:27
|
Revision: 320 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=320&view=rev Author: rhameeteman Date: 2010-08-13 06:02:20 +0000 (Fri, 13 Aug 2010) Log Message: ----------- KH. * Added totalSum, totalAverage, totalMin, totalMax as output statistics * some minor bug fixes Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2010-08-11 09:43:26 UTC (rev 319) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2010-08-13 06:02:20 UTC (rev 320) @@ -74,6 +74,13 @@ exampleNetwork = $(LOCAL)/CSOImageStatistics/CSOImageStatisticsExample.mlab documentation = "$(LOCAL)/CSOImageStatistics/CSOImageStatistics.html" + Description { + Field totalSum { persistent = No } + Field totalAverage { persistent = No } + Field totalMin { persistent = No } + Field totalMax { persistent = No } + Field statistics { persistent = No } + } Window { Vertical "Main" { @@ -110,9 +117,23 @@ Vertical Statistics { expandY = Yes - ListView statistics { + Box Totals { + layout = Horizontal + Vertical { + Field totalSum { edit = No } + Field totalAverage { edit = No } + } + Vertical { + Field totalMin { edit = No } + Field totalMax { edit = No } + } + } + Box Table { expandY = Yes - columnSeparator = ";" + ListView statistics { + expandY = Yes + columnSeparator = ";" + } } } // Vertical Statistics Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-08-11 09:43:26 UTC (rev 319) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-08-13 06:02:20 UTC (rev 320) @@ -113,6 +113,18 @@ f_Statistics = fieldC->addString("statistics"); f_Statistics->setStringValue( "Id;Voxels;Sum;Average" ); + f_TotalSum = fieldC->addDouble( "totalSum" ); + f_TotalSum->setDoubleValue( 0.0 ); + + f_TotalAverage = fieldC->addDouble( "totalAverage" ); + f_TotalAverage->setDoubleValue( 0.0 ); + + f_TotalMin = fieldC->addDouble( "totalMin" ); + f_TotalMin->setDoubleValue( 0.0 ); + + f_TotalMax = fieldC->addDouble( "totalMax" ); + f_TotalMax->setDoubleValue( 0.0 ); + const char* funcNames[] = {"NearestNeighbor", "Trilinear" , "TrilinearSkipBorder"}; f_InterpolationMode = getFieldContainer()->addEnum("interpolation",funcNames,3); f_InterpolationMode->setEnumValue(1); @@ -330,16 +342,35 @@ if (m_SelectedCSOIds.size() > 0){ + double totalMin = ML_DOUBLE_MAX; + double totalMax = ML_DOUBLE_MIN; + double totalAverage = 0.0; + double totalSum = 0.0; + double totalArea = 0.0; for (unsigned int i = 0; i < m_SelectedCSOIds.size(); i++){ const unsigned int currentId = m_SelectedCSOIds[i]; CSO* currentCSO = m_OutCSOList->getCSOById(currentId); if ( !currentCSO->isClosed() ){ continue; } double sum = 0.0; double average = 0.0; + double minimum = ML_DOUBLE_MAX; + double maximum = ML_DOUBLE_MIN; unsigned int iD = currentCSO->getId(); - double voxelCount; - this->GetStatistics( currentCSO, voxelCount, sum, average ); + size_t voxelCount; + this->GetStatistics( currentCSO, voxelCount, sum, average, minimum, maximum ); + totalSum += sum; + double currentArea = 0.0; + if (f_UseAllPointsInsideCSO->getBoolValue() ){ + currentArea = currentCSO->getArea(); + } else { + currentArea = currentCSO->getLength(); + } + totalAverage += average*currentArea; + totalArea += currentArea; + totalMin = ML_MIN(totalMin,minimum); + totalMax = ML_MAX(totalMax,maximum); + outputString << iD << ";" << voxelCount << ";" << sum << ";" << average << std::endl; m_SumSeries.push_back( sum ); @@ -357,8 +388,16 @@ currentCSO->setDescription( descriptionString ); } } //iD list + if ( totalArea ){ + totalAverage /= totalArea; + } else { + totalAverage = 0.0; + } + f_TotalSum->setDoubleValue( totalSum ); + f_TotalAverage->setDoubleValue( totalAverage ); + f_TotalMin->setDoubleValue( totalMin ); + f_TotalMax->setDoubleValue( totalMax ); - // Set Notification flags notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; notificationFlag |= CSOList::NOTIFICATION_GROUP_FINISHED; @@ -379,33 +418,13 @@ } -void CSOImageStatistics::SetCurves() +void CSOImageStatistics::GetStatistics( CSO* cso, + size_t &voxelCount, + double &sum, + double &average, + double &minimum, + double &maximum ) { - // Remove any existing curves - while ( !m_OutCurveList->getCurveList().empty() ) { - delete m_OutCurveList->getCurveList().back(); - m_OutCurveList->getCurveList().pop_back(); - } - - // Set Curve output - if ( f_OutputCurve->getBoolValue() ) { - if ( f_OutputSum->getBoolValue() ) { - CurveData *outputCurve = new CurveData; - outputCurve->setY( m_SumSeries.size(), &m_SumSeries[0], 1 ); - m_OutCurveList->getCurveList().push_back( outputCurve ); - } - if ( f_OutputAverage->getBoolValue() ) { - CurveData *outputCurve = new CurveData; - outputCurve->setY( m_AverageSeries.size(), &m_AverageSeries[0], 1 ); - m_OutCurveList->getCurveList().push_back( outputCurve ); - } - } - f_OutCurveList->notifyAttachments(); -} - - -void CSOImageStatistics::GetStatistics( CSO* cso, double &voxelCount, double &sum, double &average ) -{ if ( cso && getNonDummyUpdatedInImg(0) && cso->isInPlane() ){ // Create a MPRLight module @@ -503,68 +522,93 @@ &tile ); double* inputTile = reinterpret_cast< double* >(tile); + sum = 0.0; + average = 0.0; + voxelCount = 0; + minimum = ML_DOUBLE_MAX; + maximum = ML_DOUBLE_MIN; + // Remove data on error to avoid memory leaks. - if (inputTile && (err != ML_RESULT_OK)){ - if (inputTile) freeTile(inputTile); - inputTile = NULL; - } + if (inputTile ) { + if (err != ML_RESULT_OK) { + freeTile(inputTile); + inputTile = NULL; + } else { - if (inputTile ){ + std::vector< vec3 > contourPoints; - std::vector< vec3 > contourPoints; + // Convert pathPoints to voxel coordinates + ConvertCoorinateList( pathPoints, mprOutput); + if ( f_UseAllPointsInsideCSO->getBoolValue() ){ + // Fill contourPoints with all points inside the contour + GetPointsInsideContour( pathPoints, contourPoints, csoVoxelBox); + } else { + // Use just the pathPoints + contourPoints.swap( pathPoints ); + } - // Convert pathPoints to voxel coordinates - ConvertCoorinateList( pathPoints, mprOutput); - if ( f_UseAllPointsInsideCSO->getBoolValue() ){ - // Fill contourPoints with all points inside the contour - GetPointsInsideContour( pathPoints, contourPoints, csoVoxelBox); - } else { - // Use just the pathPoints - contourPoints.swap( pathPoints ); - } + voxelCount = contourPoints.size(); + const Vector strideVector = csoVoxelBox.getExt().getStrides(); + const int currentCSOIndex = cso->getCSOList()->getCSOIndex( cso ); + for ( unsigned int iPos = 0; iPos < voxelCount; ++iPos){ + const MLint x0 = static_cast< MLint >(contourPoints[iPos][0]); + const MLint y0 = static_cast< MLint >(contourPoints[iPos][1]); + const MLint z0 = static_cast< MLint >(contourPoints[iPos][2]); + const Vector currentPos( x0,y0,z0,0,0,0 ); + const Vector deltaPos = currentPos-csoVoxelBox.v1; + const MLint offset = deltaPos.dot( strideVector); + double* currentValue = inputTile+offset; + sum += *currentValue; + minimum = ML_MIN(minimum, *currentValue ); + maximum = ML_MAX(maximum, *currentValue ); + float x,y,z; + MLImageMapVoxelToWorld(mprOutput, currentPos[0]+0.5,currentPos[1]+0.5,currentPos[2]+0.5,&x,&y,&z); + XMarker currentMarker( vec3(x,y,z) ); + currentMarker.type = currentCSOIndex; + m_OutMarkerList->push_back( currentMarker ); + } - if ( contourPoints.size() == 0 ){ - voxelCount = -1; - sum = 1; - } - const Vector strideVector = csoVoxelBox.getExt().getStrides(); - const int currentCSOIndex = cso->getCSOList()->getCSOIndex( cso ); - for ( unsigned int iPos = 0; iPos < contourPoints.size(); ++iPos){ - const MLint x0 = static_cast< MLint >(contourPoints[iPos][0]); - const MLint y0 = static_cast< MLint >(contourPoints[iPos][1]); - const MLint z0 = static_cast< MLint >(contourPoints[iPos][2]); - const Vector currentPos( x0, y0,z0,0,0,0 ); - const Vector deltaPos = currentPos-csoVoxelBox.v1; - const MLint offset = deltaPos.dot( strideVector); - double* currentValue = inputTile+offset; - sum += *currentValue; - float x,y,z; - MLImageMapVoxelToWorld(mprOutput, currentPos[0],currentPos[1],currentPos[2]+0.5,&x,&y,&z); - XMarker currentMarker( vec3(x,y,z) ); - currentMarker.type = currentCSOIndex; - m_OutMarkerList->push_back( currentMarker ); - } - - - const double csoArea = cso->getArea(); - voxelCount = contourPoints.size(); - if ( voxelCount != 0 && csoArea != 0){ - if ( f_UseVoxelSize->getBoolValue() ){ - average = sum/csoArea; + const double csoArea = cso->getArea(); + const double csoLength = cso->getLength(); + if ( csoLength != 0 && csoArea != 0){ + if ( f_UseVoxelSize->getBoolValue() ){ + average = sum/csoArea; + } else { + average = sum/csoLength; + } } else { - average = sum/voxelCount; + average = 0; } - } else { - average = 0; } + freeTile( inputTile ); } - freeTile( inputTile ); - } else { - sum = 0.0; - average = 0.0; - voxelCount = 0.0; + } } + + +void CSOImageStatistics::SetCurves() +{ + // Remove any existing curves + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } + + // Set Curve output + if ( f_OutputCurve->getBoolValue() ) { + if ( f_OutputSum->getBoolValue() ) { + CurveData *outputCurve = new CurveData; + outputCurve->setY( m_SumSeries.size(), &m_SumSeries[0], 1 ); + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + if ( f_OutputAverage->getBoolValue() ) { + CurveData *outputCurve = new CurveData; + outputCurve->setY( m_AverageSeries.size(), &m_AverageSeries[0], 1 ); + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } + f_OutCurveList->notifyAttachments(); } Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h 2010-08-11 09:43:26 UTC (rev 319) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h 2010-08-13 06:02:20 UTC (rev 320) @@ -88,7 +88,12 @@ void ProcessCSOList(bool shouldSetupInternalCSOList); //! Get image statistics of cso - void GetStatistics(CSO* cso, double &voxelCount, double &sum, double &average ); + void GetStatistics( CSO* cso, + size_t &voxelCount, + double &sum, + double &average, + double &minimum, + double &maximum); //! Get a list of all points inside the contour defined by the pathPoints //! The contour should be axis aligned @@ -192,6 +197,11 @@ //! String containing all calculated statistics StringField *f_Statistics; + DoubleField *f_TotalSum; + DoubleField *f_TotalAverage; + DoubleField *f_TotalMin; + DoubleField *f_TotalMax; + //! mode defines the resampling filter that is applied ("NearestNeighbor", "Trilinear" , "TrilinearSkipBorder") EnumField *f_InterpolationMode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-08-13 06:09:00
|
Revision: 321 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=321&view=rev Author: rhameeteman Date: 2010-08-13 06:08:54 +0000 (Fri, 13 Aug 2010) Log Message: ----------- KH. * Added the option to calculate the centroid scaled by the area of the faces in stead of the node positions. This should be more accurate for non equally spaces nodes. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h Modified: trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def 2010-08-13 06:02:20 UTC (rev 320) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def 2010-08-13 06:08:54 UTC (rev 321) @@ -148,6 +148,13 @@ expandX = True } + Field useSurface { + tooltip = +"If checked the centroid is calculated through a +weighted average of the centroids of all faces. Otherwise +the centroid is the average of the node positions" + } + //Separator { direction = horizontal } //Horizontal { Modified: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp 2010-08-13 06:02:20 UTC (rev 320) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp 2010-08-13 06:08:54 UTC (rev 321) @@ -65,6 +65,9 @@ _inverseCenterOfMass = fieldC->addVec3f("inverseCenterOfMass"); _inverseCenterOfMass->setVec3fValue(vec3(0.0,0.0,0.0)); + _useSurface = fieldC->addBool("useSurface"); + _useSurface->setBoolValue( false ); + // Reactivate calls of handleNotification on field changes. handleNotificationOn(); } @@ -86,8 +89,9 @@ //---------------------------------------------------------------------------------- void WEMCenterOfMass::handleNotification (Field *field) { - ML_TRACE_IN("WEMCenterOfMass::handleNotification()") + ML_TRACE_IN("WEMCenterOfMass::handleNotification()"); + if ( field == _useSurface ) { this->_process(); } // call parent class and handle apply/autoApply and in/outputs WEMInspector::handleNotification(field); } @@ -136,23 +140,56 @@ if (_inWEM != NULL){ double sumX=0.0, sumY=0.0, sumZ=0.0; int num=0; + Vector3 centroid; + double totalArea=0.0; // Iterate over all nodes and compute sum of x, y and z-position for (unsigned int i = 0; i < _inWEM->getNumWEMPatches(); i++){ WEMPatch* wemPatch = _inWEM->getWEMPatchAt(i); const unsigned int numNodesInPatch = wemPatch->getNumNodes(); - for (unsigned int j = 0; j < numNodesInPatch; j++){ - WEMNode* node = wemPatch->getNodeAt(j); - float x, y, z; - node->getPosition(x, y, z); - sumX+=x; - sumY+=y; - sumZ+=z; - ++num; + if ( _useSurface->getBoolValue() ){ + WEMTrianglePatch * trianglePatch; + bool isTrangle = true; + if (_inWEM->getWEMPatchAt(i)->getPatchType() != WEM_PATCH_TRIANGLES ){ + trianglePatch = new WEMTrianglePatch; + isTrangle = false; + wemPatch->triangulate( trianglePatch, WEM_TRIANGULATION_CENTER ); + } else { + trianglePatch = (WEMTrianglePatch*)_inWEM->getWEMPatchAt(i); + } + unsigned int nFaces = trianglePatch->getNumFaces(); + for (unsigned int j = 0; j < nFaces; j++){ + WEMFace* face = trianglePatch->getFaceAt(j); + double area = face->getArea(); + Vector3 centroid = face->getCentroid(); + sumX+=centroid[0]*area; + sumY+=centroid[1]*area; + sumZ+=centroid[2]*area; + totalArea += area; + ++num; + } + if (!isTrangle){ + delete trianglePatch; + } + } else { + for (unsigned int j = 0; j < numNodesInPatch; j++){ + WEMNode* node = wemPatch->getNodeAt(j); + float x, y, z; + node->getPosition(x, y, z); + sumX+=x; + sumY+=y; + sumZ+=z; + ++num; + } } } // Set output fields - _centerOfMass->setVec3fValue(vec3(sumX/double(num), sumY/double(num), sumZ/double(num))); - _inverseCenterOfMass->setVec3fValue(-vec3(sumX/double(num), sumY/double(num), sumZ/double(num))); + if ( _useSurface->getBoolValue() ){ + _centerOfMass->setVec3fValue( vec3(sumX/totalArea, sumY/totalArea, sumZ/totalArea) ); + _inverseCenterOfMass->setVec3fValue( -vec3(sumX/totalArea, sumY/totalArea, sumZ/totalArea) ); + } else { + _centerOfMass->setVec3fValue(vec3(sumX/double(num), sumY/double(num), sumZ/double(num))); + _inverseCenterOfMass->setVec3fValue(-vec3(sumX/double(num), sumY/double(num), sumZ/double(num))); + } } else { // Reset output fields _centerOfMass->setVec3fValue(vec3()); Modified: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h 2010-08-13 06:02:20 UTC (rev 320) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h 2010-08-13 06:08:54 UTC (rev 321) @@ -63,6 +63,7 @@ //! Constructor. WEMCenterOfMass (std::string type="WEMCenterOfMass"); + protected: //! Destructor. @@ -86,6 +87,8 @@ //! Center of mass (and its inverse) output field Vec3fField *_centerOfMass, *_inverseCenterOfMass; + //! Calculate the center of mass using the area of the face associated with the nodes + BoolField *_useSurface; //@} //! The main processing routine. Here, the own mesh algorithm can be implemented. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-02-08 09:31:20
|
Revision: 341 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=341&view=rev Author: rhameeteman Date: 2011-02-08 09:31:14 +0000 (Tue, 08 Feb 2011) Log Message: ----------- KH. * Added option to get the properties of the first selected cso. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-02-08 08:56:27 UTC (rev 340) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-02-08 09:31:14 UTC (rev 341) @@ -71,6 +71,7 @@ } TabViewItem "Main" { Box "Input" { + expandY = No ButtonBar inputMode { show = Radio } tooltip = "Use -1 for all Ids" Field inputCSOString { title = "CSO Ids:" expandX = YES visibleOn = "*inputMode == "CSO" *" } @@ -78,17 +79,20 @@ } Box "Handle Notifications" { + expandY = No CheckBox listenToFinishingNotifications { title = "Finishing" } CheckBox listenToSelectionNotifications { title = "Selection" } } Box "Operation Mode" { + expandY = No Horizontal { alignX = Left CheckBox autoUpdate {} Button update {} } // horizontal CheckBox workDirectlyOnInputList { title = "Work On Input List"} + Button getProperties { title = "Get Properties" } } Box { Label { @@ -109,6 +113,7 @@ Field CSOLabel { name = CSOLabelFld dependsOn = setCSOLabel title = "Label:" alignGroupX = csog1 } Field CSODescription { name = CSODescriptionFld dependsOn = setCSODescription title = "Description:" alignGroupX = csog1 } Field CSOTimePointIndex { name = CSOTimePointIndexFld dependsOn = setCSOTimePointIndex title = "Time Point:" alignGroupX = csog1 step = 1 } + Field CSOCreatorId { name = CSOCreatorIdFld dependsOn = setCSOCreatorId title = "CreatorId:" alignGroupX = csog1 step = 1 } Horizontal { CheckBox CSOIsSelected { name = CSOIsSelectedFld dependsOn = setCSOIsSelected title = "Is selected" alignGroupX = csog1 } CheckBox CSOClearSelection { name = CSOClearSelectionFld dependsOn = setCSOIsSelected title = "Clear first" alignGroupX = csog2 } Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-02-08 08:56:27 UTC (rev 340) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-02-08 09:31:14 UTC (rev 341) @@ -82,6 +82,9 @@ static void CSOListNotifyObserverCB(void* userData, int notificationFlag); + //! Get the properties of first selected or first CSO of the connected CSOList + void GetProperties(); + private: @@ -122,6 +125,9 @@ //! Applies changes. NotifyField* f_Update; + //! Get the current properties. + NotifyField* f_GetPorperties; + //! Locking variable for removing/adding a notification observer. bool m_IsInNotificationCB; @@ -140,6 +146,7 @@ BoolField *f_CSOComputeNormal; StringField *f_CSOLabel; StringField *f_CSODescription; + IntField *f_CSOCreatorId; BoolField *f_CSOIsSelected; BoolField *f_CSOClearSelection; FloatField *f_CSOLineWidth; @@ -194,6 +201,7 @@ BoolField *f_SetCSOComputeNormal; BoolField *f_SetCSOLabel; BoolField *f_SetCSODescription; + BoolField *f_SetCSOCreatorId; BoolField *f_SetCSOIsSelected; BoolField *f_SetCSOLineWidth; BoolField *f_SetCSOLineStyle; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-02-08 09:44:32
|
Revision: 343 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=343&view=rev Author: rhameeteman Date: 2011-02-08 09:44:25 +0000 (Tue, 08 Feb 2011) Log Message: ----------- KH. * Renamed CurveFilter class to CMCurveFilter to avoid class clashes with another CurveFilter module. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def Added Paths: ----------- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h Removed Paths: ------------- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.h Modified: trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2011-02-08 09:38:27 UTC (rev 342) +++ trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2011-02-08 09:44:25 UTC (rev 343) @@ -9,11 +9,11 @@ //---------------------------------------------------------------------------------- -// MLModule CurveFilter +// MLModule CMCurveFilter //---------------------------------------------------------------------------------- MLModule CMCurveFilter { DLL = "MLCMCurveList" - class = "CurveFilter" + class = "CMCurveFilter" group = "BIGR" genre = "Diagram" author = "Reinhard Hameeteman" @@ -21,8 +21,8 @@ comment = "Select a curve from the curveList or curveSet" keywords = "curveList curveData curve filter" seeAlso = "CurveArithmetic CatCurves" - documentation = "$(LOCAL)/CurveFilter/CurveFilter.html" - exampleNetwork = "$(LOCAL)/CurveFilter/CurveFilterExample.mlab" + documentation = "$(LOCAL)/CMCurveFilter/CMCurveFilter.html" + exampleNetwork = "$(LOCAL)/CMCurveFilter/CMCurveFilterExample.mlab" Description { Field minCurveSet { @@ -86,7 +86,7 @@ } } } -} // MLModule CurveFilter +} // MLModule CMCurveFilter //---------------------------------------------------------------------------------- Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2011-02-08 09:38:27 UTC (rev 342) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2011-02-08 09:44:25 UTC (rev 343) @@ -117,6 +117,7 @@ Vertical Statistics { expandY = Yes + style { Prototype Field {expandX = Yes}} Box Totals { layout = Horizontal Vertical { Copied: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp (from rev 342, trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.cpp) =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp 2011-02-08 09:44:25 UTC (rev 343) @@ -0,0 +1,232 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CMCurveFilter. +/*! +// \file mlCMCurveFilter.cpp +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "mlCMCurveFilter.h" +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(CMCurveFilter, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +CMCurveFilter::CMCurveFilter (void) + : BaseOp(0, 0), m_InCurveList(0) +{ + ML_TRACE_IN("CMCurveFilter::CMCurveFilter()"); + + handleNotificationOff(); + + FieldContainer *fields = getFieldContainer(); + + m_InCurveList = NULL; + f_InCurveList = fields->addBase( "inCurveList" ); + f_InCurveList->setBaseValue( m_InCurveList ); + + m_OutCurveList = new CurveList; + f_OutCurveList = fields->addBase( "outCurveList" ); + f_OutCurveList->setBaseValue( m_OutCurveList ); + + f_Update = fields->addNotify( "update" ); + f_AutoUpdate = fields->addBool( "autoUpdate" ); + f_AutoUpdate->setBoolValue( false ); + + f_MinCurveSet = fields->addInt( "minCurveSet" ); + f_MinCurveSet->setIntValue( 0 ); + + f_MaxCurveSet = fields->addInt( "maxCurveSet" ); + f_MaxCurveSet->setIntValue( 0 ); + + f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); + f_NumberOfCurveSets->setIntValue( 0 ); + + f_MinCurve = fields->addInt("minCurve"); + f_MinCurve->setIntValue( 0 ); + + f_MaxCurve = fields->addInt("maxCurve"); + f_MaxCurve->setIntValue( 0 ); + + f_NumberOfCurves = fields->addInt( "numberOfCurves" ); + f_NumberOfCurves->setIntValue( 0 ); + + f_CropCurve = fields->addBool( "cropCurve" ); + f_CropCurve->setBoolValue( false ); + + f_XStart = fields->addFloat( "start" ); + f_XStart->setFloatValue( 0.0f ); + + f_XEnd = fields->addFloat( "end" ); + f_XEnd->setFloatValue( 0.0f ); + + handleNotificationOn(); +} + + +CMCurveFilter::~CMCurveFilter(void) +{ + ResetOutput(); + delete m_OutCurveList; +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void CMCurveFilter::handleNotification (Field *field) +{ + ML_TRACE_IN("CMCurveFilter::handleNotification()"); + + if ( field == f_InCurveList ) { + m_SingleCurveList.clear(); + m_InCurveList = NULL; + Base* baseInput = f_InCurveList->getBaseValue(); + m_InCurveList = mlbase_cast<CurveList*>(baseInput); + CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); + if (inCurve){ + m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( baseInput ) ); + m_InCurveList = &m_SingleCurveList; + } + + if ( m_InCurveList != NULL ) { + if ( f_AutoUpdate->getBoolValue() ){ + SetMaxValues(); + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } else { + ResetOutput(); + f_OutCurveList->notifyAttachments(); + } + + } else + if ( field == f_Update || + (f_AutoUpdate->getBoolValue() && + (field == f_AutoUpdate || + field == f_MinCurveSet || + field == f_MaxCurveSet || + field == f_MinCurve || + field == f_MaxCurve || + field == f_CropCurve || + (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) + ))){ + if ( m_InCurveList != NULL ){ + if ( m_InCurveList->getNumCurves() > 0 ){ + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } + } +} + + +void CMCurveFilter::ResetOutput() +{ + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } +} + + +void CMCurveFilter::SetMaxValues() +{ + int nCurveSets = 0; + int nCurves = 0; + if ( m_InCurveList != NULL ){ + nCurveSets = m_InCurveList->getNumCurves(); + for (int iSet = 0; iSet < nCurveSets; ++iSet ) { + nCurves = mlMax( static_cast<MLssize_t>(nCurves), m_InCurveList->getCurveData( iSet )->getNumSeries() ); + } + } + f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); + f_NumberOfCurves->setIntValue( nCurves-1 ); +} + + +void CMCurveFilter::SetOutputCurve(){ + + ResetOutput(); + + // Check for valid field values + // Curves are numbered from 0 + int nCurveSets = m_InCurveList->getNumCurves(); + if ( nCurveSets == 0 ) {return;} + int minSet = mlMax( static_cast<MLint>(0), f_MinCurveSet->getIntValue() ); + int maxSet = mlMax( static_cast<MLint>(minSet), f_MaxCurveSet->getIntValue() ); + maxSet = mlMin( maxSet, nCurveSets-1 ); + for (int iSet = minSet; iSet <= maxSet; ++iSet ) { + + int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); + if (nCurves == 0 ) {continue;} + int minCurve = mlMax(static_cast<MLint>(0),f_MinCurve->getIntValue() ); + int maxCurve = mlMax(static_cast<MLint>(minCurve), f_MaxCurve->getIntValue() ); + maxCurve = mlMin(maxCurve, nCurves-1 ); + for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { + + CurveData *curveSet = m_InCurveList->getCurveData( iSet ); + CurveData *outputCurve = new CurveData( *curveSet ); + outputCurve->clearData(); + std::vector< float > xSeries; + std::vector< float > ySeries; + + // Copy/Crop curve values + bool crop = f_CropCurve->getBoolValue(); + float minX = f_XStart->getFloatValue(); + float maxX = f_XEnd->getFloatValue(); + minX = mlMin(minX,maxX); + for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ + float xValue = curveSet->getXValue( iX ); + if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { + ySeries.push_back( curveSet->getYValue( minCurve, iX) ); + xSeries.push_back( xValue ); + } + } + outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); + outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); + + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } +} + + +ML_END_NAMESPACE + Copied: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h (from rev 342, trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.h) =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h 2011-02-08 09:44:25 UTC (rev 343) @@ -0,0 +1,123 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CMCurveFilter. +/*! +// \file mlCMCurveFilter.h +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlCMCurveFilter_H +#define __mlCMCurveFilter_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Select a curve from the curveList or curveSet +class MLCMCURVELIST_EXPORT CMCurveFilter : public BaseOp +{ +public: + + //! Constructor. + CMCurveFilter (void); + + //! Destructor + ~CMCurveFilter(void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + void SetOutputCurve(); + + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(CMCurveFilter); + + //! Remove any existing output curves + void ResetOutput(); + + //! Set the maximum values allowed for curves and series. + void SetMaxValues(); + + //! Input curve data + CurveList *m_InCurveList; + BaseField *f_InCurveList; + CurveList m_SingleCurveList; + + //! Output curve data + CurveList *m_OutCurveList; + BaseField *f_OutCurveList; + + //! Update modes + NotifyField *f_Update; + BoolField *f_AutoUpdate; + + //! Curve set range + IntField *f_MinCurveSet; + IntField *f_MaxCurveSet; + + //! Curve series range + IntField *f_MinCurve; + IntField *f_MaxCurve; + + //! Number of curves present in input + IntField *f_NumberOfCurveSets; + + //! Number of series present in input + IntField *f_NumberOfCurves; + + //! Crop the curve? + BoolField *f_CropCurve; + FloatField *f_XStart; + FloatField *f_XEnd; + +}; + + +ML_END_NAMESPACE + +#endif // __mlCMCurveFilter_H + + Deleted: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2011-01-28 10:42:48 UTC (rev 339) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.cpp 2011-02-08 09:44:25 UTC (rev 343) @@ -1,232 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), -// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of BIGR nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- -//! The ML module class CurveFilter. -/*! -// \file mlCurveFilter.cpp -// \author Reinhard Hameeteman -// \date 2008-03-03 -// -// Select a curve from the curveList or curveSet -*/ -//---------------------------------------------------------------------------------- - - -// Local includes -#include "mlCurveFilter.h" -ML_START_NAMESPACE - - -//! Implements code for the runtime type system of the ML -ML_BASEOP_CLASS_SOURCE(CurveFilter, BaseOp); - -//---------------------------------------------------------------------------------- -//! Constructor -//---------------------------------------------------------------------------------- -CurveFilter::CurveFilter (void) - : BaseOp(0, 0), m_InCurveList(0) -{ - ML_TRACE_IN("CurveFilter::CurveFilter()"); - - handleNotificationOff(); - - FieldContainer *fields = getFieldContainer(); - - m_InCurveList = NULL; - f_InCurveList = fields->addBase( "inCurveList" ); - f_InCurveList->setBaseValue( m_InCurveList ); - - m_OutCurveList = new CurveList; - f_OutCurveList = fields->addBase( "outCurveList" ); - f_OutCurveList->setBaseValue( m_OutCurveList ); - - f_Update = fields->addNotify( "update" ); - f_AutoUpdate = fields->addBool( "autoUpdate" ); - f_AutoUpdate->setBoolValue( false ); - - f_MinCurveSet = fields->addInt( "minCurveSet" ); - f_MinCurveSet->setIntValue( 0 ); - - f_MaxCurveSet = fields->addInt( "maxCurveSet" ); - f_MaxCurveSet->setIntValue( 0 ); - - f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); - f_NumberOfCurveSets->setIntValue( 0 ); - - f_MinCurve = fields->addInt("minCurve"); - f_MinCurve->setIntValue( 0 ); - - f_MaxCurve = fields->addInt("maxCurve"); - f_MaxCurve->setIntValue( 0 ); - - f_NumberOfCurves = fields->addInt( "numberOfCurves" ); - f_NumberOfCurves->setIntValue( 0 ); - - f_CropCurve = fields->addBool( "cropCurve" ); - f_CropCurve->setBoolValue( false ); - - f_XStart = fields->addFloat( "start" ); - f_XStart->setFloatValue( 0.0f ); - - f_XEnd = fields->addFloat( "end" ); - f_XEnd->setFloatValue( 0.0f ); - - handleNotificationOn(); -} - - -CurveFilter::~CurveFilter(void) -{ - ResetOutput(); - delete m_OutCurveList; -} - - -//---------------------------------------------------------------------------------- -//! Handle field changes of the field \c field. -//---------------------------------------------------------------------------------- -void CurveFilter::handleNotification (Field *field) -{ - ML_TRACE_IN("CurveFilter::handleNotification()"); - - if ( field == f_InCurveList ) { - m_SingleCurveList.clear(); - m_InCurveList = NULL; - Base* baseInput = f_InCurveList->getBaseValue(); - m_InCurveList = mlbase_cast<CurveList*>(baseInput); - CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); - if (inCurve){ - m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( baseInput ) ); - m_InCurveList = &m_SingleCurveList; - } - - if ( m_InCurveList != NULL ) { - if ( f_AutoUpdate->getBoolValue() ){ - SetMaxValues(); - SetOutputCurve(); - f_OutCurveList->notifyAttachments(); - } - } else { - ResetOutput(); - f_OutCurveList->notifyAttachments(); - } - - } else - if ( field == f_Update || - (f_AutoUpdate->getBoolValue() && - (field == f_AutoUpdate || - field == f_MinCurveSet || - field == f_MaxCurveSet || - field == f_MinCurve || - field == f_MaxCurve || - field == f_CropCurve || - (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) - ))){ - if ( m_InCurveList != NULL ){ - if ( m_InCurveList->getNumCurves() > 0 ){ - SetOutputCurve(); - f_OutCurveList->notifyAttachments(); - } - } - } -} - - -void CurveFilter::ResetOutput() -{ - while ( !m_OutCurveList->getCurveList().empty() ) { - delete m_OutCurveList->getCurveList().back(); - m_OutCurveList->getCurveList().pop_back(); - } -} - - -void CurveFilter::SetMaxValues() -{ - int nCurveSets = 0; - int nCurves = 0; - if ( m_InCurveList != NULL ){ - nCurveSets = m_InCurveList->getNumCurves(); - for (int iSet = 0; iSet < nCurveSets; ++iSet ) { - nCurves = mlMax( static_cast<MLssize_t>(nCurves), m_InCurveList->getCurveData( iSet )->getNumSeries() ); - } - } - f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); - f_NumberOfCurves->setIntValue( nCurves-1 ); -} - - -void CurveFilter::SetOutputCurve(){ - - ResetOutput(); - - // Check for valid field values - // Curves are numbered from 0 - int nCurveSets = m_InCurveList->getNumCurves(); - if ( nCurveSets == 0 ) {return;} - int minSet = mlMax( static_cast<MLint>(0), f_MinCurveSet->getIntValue() ); - int maxSet = mlMax( static_cast<MLint>(minSet), f_MaxCurveSet->getIntValue() ); - maxSet = mlMin( maxSet, nCurveSets-1 ); - for (int iSet = minSet; iSet <= maxSet; ++iSet ) { - - int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); - if (nCurves == 0 ) {continue;} - int minCurve = mlMax(static_cast<MLint>(0),f_MinCurve->getIntValue() ); - int maxCurve = mlMax(static_cast<MLint>(minCurve), f_MaxCurve->getIntValue() ); - maxCurve = mlMin(maxCurve, nCurves-1 ); - for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { - - CurveData *curveSet = m_InCurveList->getCurveData( iSet ); - CurveData *outputCurve = new CurveData( *curveSet ); - outputCurve->clearData(); - std::vector< float > xSeries; - std::vector< float > ySeries; - - // Copy/Crop curve values - bool crop = f_CropCurve->getBoolValue(); - float minX = f_XStart->getFloatValue(); - float maxX = f_XEnd->getFloatValue(); - minX = mlMin(minX,maxX); - for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ - float xValue = curveSet->getXValue( iX ); - if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { - ySeries.push_back( curveSet->getYValue( minCurve, iX) ); - xSeries.push_back( xValue ); - } - } - outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); - outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); - - m_OutCurveList->getCurveList().push_back( outputCurve ); - } - } -} - - -ML_END_NAMESPACE - Deleted: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h 2011-01-28 10:42:48 UTC (rev 339) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.h 2011-02-08 09:44:25 UTC (rev 343) @@ -1,123 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), -// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of BIGR nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- -//! The ML module class CurveFilter. -/*! -// \file mlCurveFilter.h -// \author Reinhard Hameeteman -// \date 2008-03-03 -// -// Select a curve from the curveList or curveSet -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __mlCurveFilter_H -#define __mlCurveFilter_H - - -// Local includes -#include "../MLCMCurveListSystem.h" - -// ML includes -#include "mlOperatorIncludes.h" - -#include <mlDiagramData.h> - -ML_START_NAMESPACE - - -//! Select a curve from the curveList or curveSet -class MLCMCURVELIST_EXPORT CurveFilter : public BaseOp -{ -public: - - //! Constructor. - CurveFilter (void); - - //! Destructor - ~CurveFilter(void); - - //! Handle field changes of the field \c field. - virtual void handleNotification (Field *field); - - void SetOutputCurve(); - - -private: - - - //! Implements interface for the runtime type system of the ML. - ML_BASEOP_CLASS_HEADER(CurveFilter); - - //! Remove any existing output curves - void ResetOutput(); - - //! Set the maximum values allowed for curves and series. - void SetMaxValues(); - - //! Input curve data - CurveList *m_InCurveList; - BaseField *f_InCurveList; - CurveList m_SingleCurveList; - - //! Output curve data - CurveList *m_OutCurveList; - BaseField *f_OutCurveList; - - //! Update modes - NotifyField *f_Update; - BoolField *f_AutoUpdate; - - //! Curve set range - IntField *f_MinCurveSet; - IntField *f_MaxCurveSet; - - //! Curve series range - IntField *f_MinCurve; - IntField *f_MaxCurve; - - //! Number of curves present in input - IntField *f_NumberOfCurveSets; - - //! Number of series present in input - IntField *f_NumberOfCurves; - - //! Crop the curve? - BoolField *f_CropCurve; - FloatField *f_XStart; - FloatField *f_XEnd; - -}; - - -ML_END_NAMESPACE - -#endif // __mlCurveFilter_H - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-03-31 08:58:53
|
Revision: 350 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=350&view=rev Author: rhameeteman Date: 2011-03-31 08:58:47 +0000 (Thu, 31 Mar 2011) Log Message: ----------- KH. * Added the option to pass on incoming notifications. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-03-31 08:49:31 UTC (rev 349) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-03-31 08:58:47 UTC (rev 350) @@ -82,6 +82,7 @@ expandY = No CheckBox listenToFinishingNotifications { title = "Finishing" } CheckBox listenToSelectionNotifications { title = "Selection" } + CheckBox passOnNotifications {} } Box "Operation Mode" { Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-03-31 08:49:31 UTC (rev 349) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-03-31 08:58:47 UTC (rev 350) @@ -75,6 +75,8 @@ (f_ListenToFinishingNotifications = fieldC->addBool("listenToFinishingNotifications"))->setBoolValue(true); (f_ListenToSelectionNotifications = fieldC->addBool("listenToSelectionNotifications"))->setBoolValue(true); + (f_PassOnNotifications = fieldC->addBool("passOnNotifications"))->setBoolValue( false ); + (f_AutoUpdate = fieldC->addBool( "autoUpdate"))->setBoolValue( false ); f_Update = fieldC->addNotify("update"); @@ -444,17 +446,18 @@ } } - - void CSOSetProperties::SetProperties(bool shouldSetupInternalCSOList) { + this->SetProperties(shouldSetupInternalCSOList, 0 ); +} + +void CSOSetProperties::SetProperties(bool shouldSetupInternalCSOList, int notificationFlag) +{ if (shouldSetupInternalCSOList){ SetupInternalCSOList(); } if (m_OutputCSOList != NULL){ - int notificationFlag = 0; - switch ( f_InputMode->getEnumValue() ){ case CSOINPUT: { @@ -515,6 +518,7 @@ }// m_selectedCSOIds loop break; } //CSOINPUT + case GROUPINPUT: { ParseInputGroupString(); @@ -655,26 +659,23 @@ CSOSetProperties* thisp = static_cast<CSOSetProperties*>(userData); thisp->m_IsInNotificationCB = true; + int flags = (( thisp->f_PassOnNotifications->getBoolValue() && + !thisp->f_WorkDirectlyOnInputList->getBoolValue() ) ? notificationFlag : 0); if (!thisp->m_IsNotifyingMyself){ if ( thisp->f_AutoUpdate->getBoolValue() ){ - if ((notificationFlag & CSOList::NOTIFICATION_CSO_FINISHED) || - (notificationFlag & CSOList::NOTIFICATION_GROUP_FINISHED)) - { - if (thisp->f_ListenToFinishingNotifications->getBoolValue() == true){ - thisp->SetProperties(true); - } + if ( thisp->f_ListenToFinishingNotifications->getBoolValue() && + ((notificationFlag & CSOList::NOTIFICATION_CSO_FINISHED) || + (notificationFlag & CSOList::NOTIFICATION_GROUP_FINISHED)) ){ + thisp->SetProperties( true, flags ); } - if ((notificationFlag & CSOList::NOTIFICATION_CSO_SELECTION) || - (notificationFlag & CSOList::NOTIFICATION_GROUP_SELECTION)) - { - if (thisp->f_ListenToSelectionNotifications->getBoolValue() == true){ - thisp->SetProperties(true); - } + if ( thisp->f_ListenToSelectionNotifications->getBoolValue() && + ((notificationFlag & CSOList::NOTIFICATION_CSO_SELECTION) || + (notificationFlag & CSOList::NOTIFICATION_GROUP_SELECTION)) ){ + thisp->SetProperties( true, flags ); } } } - thisp->m_IsInNotificationCB = false; } Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-03-31 08:49:31 UTC (rev 349) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-03-31 08:58:47 UTC (rev 350) @@ -64,6 +64,7 @@ //! Handle field changes of the field \c field. virtual void handleNotification (Field *field); void SetProperties(bool shouldSetupInternalCSOList); + void SetProperties(bool shouldSetupInternalCSOList, int notificationFlag); //! Sets up the internal pointer to the input CSOList. void SetupInternalCSOList(); @@ -119,6 +120,9 @@ //! Shall the module listen to selection change notifications? BoolField* f_ListenToSelectionNotifications; + //! Pass on incoming notifications + BoolField* f_PassOnNotifications; + //! Auto update mode. BoolField* f_AutoUpdate; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-06-17 06:11:45
|
Revision: 359 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=359&view=rev Author: rhameeteman Date: 2011-06-17 06:11:39 +0000 (Fri, 17 Jun 2011) Log Message: ----------- KH. * First version of a module to convert a curve to a string. Similar to PrintCurves, but I wanted the curves to be easily importable in Excel. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def Added Paths: ----------- trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/ trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.h Modified: trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2011-06-15 07:57:48 UTC (rev 358) +++ trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2011-06-17 06:11:39 UTC (rev 359) @@ -100,7 +100,7 @@ status = "work-in-progress" comment = "Convert a string into a curve" keywords = "string curve convert curvelist curvedata" - seeAlso = "PrintCurves" + seeAlso = "PrintCurves CurveToString" documentation = "$(LOCAL)/StringToCurve/StringToCurve.html" exampleNetwork = "$(LOCAL)/StringToCurve/StringToCurveExample.mlab" @@ -116,3 +116,33 @@ } } // MLModule StringToCurve + + +//---------------------------------------------------------------------------------- +// MLModule CurveToString +//---------------------------------------------------------------------------------- +MLModule CurveToString { + DLL = "MLCMCurveList" + group = "BIGR" + genre = Diagram + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Convert a curve into a string" + keywords = "string curve convert curvelist curvedata" + seeAlso = "PrintCurves StringToCurve" + documentation = "$(LOCAL)/CurveToString/CurveToString.html" + exampleNetwork = "$(LOCAL)/CurveToString/CurveToStringExample.mlab" + +Window { + expandY = Yes + Box { + expandY = Yes + Horizontal { + Field curveSeparator { title = curveSeparators } + Field valueSeparator { title = valueSeparators } + } + TextView curveString { expandY = Yes } + } +} + +} // MLModule CurveToString \ No newline at end of file Added: trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.cpp 2011-06-17 06:11:39 UTC (rev 359) @@ -0,0 +1,135 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CurveToString. +/*! +// \file mlCurveToString.cpp +// \author Reinhard Hameeteman +// \date 2011-06-06 +// +// Convert a curve into a string +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlCurveToString.h" + +#include <boost/algorithm/string.hpp> +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_MODULE_CLASS_SOURCE(CurveToString, Module); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +CurveToString::CurveToString () : Module(0, 0) +{ + ML_TRACE_IN("CurveToString::CurveToString ()") + + handleNotificationOff(); + + FieldContainer *fieldC = getFieldContainer(); + + f_InCurveList = fieldC->addBase( "inCurveList" ); + + f_CurveString = fieldC->addString("curveString"); + f_CurveString->setStringValue(""); + + f_IndexString = fieldC->addString("indexString"); + f_IndexString->setStringValue(""); + + f_ValueSeparator = fieldC->addString("valueSeparator"); + f_ValueSeparator->setStringValue(" "); + + f_CurveSeparator = fieldC->addString( "curveSeparator" ); + f_CurveSeparator->setStringValue(";"); + + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void CurveToString::handleNotification (Field * field) +{ + ML_TRACE_IN("CurveToString::handleNotification ()"); + if ( field == f_InCurveList ) { + m_SingleCurveList.clear(); + m_InCurveList = NULL; + Base* baseInput = f_InCurveList->getBaseValue(); + CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); + if (inCurve){ + m_SingleCurveList.getCurveList().push_back( inCurve ); + m_InCurveList = &m_SingleCurveList; + } else { + m_InCurveList = mlbase_cast<CurveList*>(baseInput); + } + } + if ( m_InCurveList ){ + UpdateString(); + } +} + + +void CurveToString::UpdateString() +{ + + std::stringstream curveString; + std::string vSep = f_ValueSeparator->getStringValue(); + std::string cSep = f_CurveSeparator->getStringValue(); + int nCurveSets = m_InCurveList->getNumCurves(); + if ( nCurveSets == 0 ) {return;} + + for (int iSet = 0; iSet < nCurveSets; ++iSet ) { + + int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); + if (nCurves == 0 ) {continue;} + + for (int iCurve = 0; iCurve < nCurves; ++iCurve ) { + + CurveData *curveSet = m_InCurveList->getCurveData( iSet ); + + for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ + float xValue = curveSet->getXValue( iX ); + float yValue = curveSet->getYValue( iCurve,iX ); + curveString << yValue << vSep; + } + char dummy; + curveString >> dummy; + curveString << cSep; + } + } + f_CurveString->setStringValue( curveString.str() ); + +} + +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveToString/mlCurveToString.h 2011-06-17 06:11:39 UTC (rev 359) @@ -0,0 +1,98 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CurveToString. +/*! +// \file mlCurveToString.cpp +// \author Reinhard Hameeteman +// \date 2011-06-06 +// +// Convert a curve into a string +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlCurveToString_H +#define __mlCurveToString_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlModuleIncludes.h" +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Convert a string into a curve +class MLCMCURVELIST_EXPORT CurveToString : public Module +{ +public: + + //! Constructor. + CurveToString (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field * /*field*/); + + //! Curve data + BaseField *f_InCurveList; + + //! String containing all curves + StringField *f_CurveString; + + //! String with index values that are used for all curves + StringField *f_IndexString; + + //! Characters that separate the curves in the curvesString + StringField *f_ValueSeparator; + + //! Characters that separate the values in the curvesString + StringField *f_CurveSeparator; + +private: + + //! CurveList containing the output curves + CurveList *m_InCurveList; + + CurveList m_SingleCurveList; + + //! Actual conversion method + void UpdateString(); + + //! Implements interface for the runtime type system of the ML. + ML_MODULE_CLASS_HEADER(CurveToString) +}; + + +ML_END_NAMESPACE + +#endif // __mlCurveToString_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-09-26 14:24:15
|
Revision: 384 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=384&view=rev Author: rhameeteman Date: 2011-09-26 14:24:04 +0000 (Mon, 26 Sep 2011) Log Message: ----------- KH. * Added the posibility to calculate the distances between the COSs (with the same index) of two input Lists * Added a mode field specifying how to find the matching CSO, default is still the old behavior show the distance between the first 2 CSO of input0 and only the minimal distance. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.h Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2011-09-26 13:41:31 UTC (rev 383) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2011-09-26 14:24:04 UTC (rev 384) @@ -13,7 +13,7 @@ documentation = "$(LOCAL)/CSODistance/CSODistance.html" Window { - Category { + Category Totals { Field minimumDistance { edit = NO minLength = 10 } Separator { direction = Horizontal } Field minimumDistancePoint1 { minLength = 10 } @@ -27,12 +27,25 @@ Separator { direction = Horizontal } + RadioButtonGroup mode {} + Horizontal { + alignX = Left + Label {title = "Curve statistic:" } + ButtonBar curveStatistic { show = One } + } Horizontal { alignX = Right CheckBox = autoApply Button = apply } } + Category Distances { + expandY = Yes + ListView distances { + expandY = Yes + columnSeparator = "," + } + } } }// MLModule CSODistance Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.cpp 2011-09-26 13:41:31 UTC (rev 383) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.cpp 2011-09-26 14:24:04 UTC (rev 384) @@ -15,23 +15,42 @@ handleNotificationOff(); - _csoList = NULL; + _csoList0 = NULL; + _csoList1 = NULL; + _tableHeader = "Id1,Id2,min,max,mean,stdDev"; FieldContainer* fieldC = getFieldContainer(); ML_CHECK(fieldC); - (_inputCSOFld = fieldC->addBase("inCSOList"))->setBaseValue(NULL); + (_input0CSOFld = fieldC->addBase("inCSOList"))->setBaseValue(NULL); + (_input1CSOFld = fieldC->addBase("inCSOList1"))->setBaseValue(NULL); ////////////////////////////////////////////////////////////////////////// + char* distanceModes[LASTMODE]; + distanceModes[ FIRST2 ] = "First 2 CSOs"; + distanceModes[ INPLANE ] = "Match in plane CSOs"; + distanceModes[ TWOINPUTS ] = "Match index of two CSOLists"; + _modeFld = fieldC->addEnum("mode",distanceModes,LASTMODE); + _modeFld->setEnumValue( FIRST2 ); + + ////////////////////////////////////////////////////////////////////////// + (_minimumDistanceFld = fieldC->addFloat("minimumDistance"))->setFloatValue(0); (_minimumDistancePoint1Fld = fieldC->addVec3f("minimumDistancePoint1"))->setVec3fValue(vec3(0.0,0.0,0.0)); (_minimumDistancePoint2Fld = fieldC->addVec3f("minimumDistancePoint2"))->setVec3fValue(vec3(0.0,0.0,0.0)); + _distancesFld = addString("distances",_tableHeader ); ////////////////////////////////////////////////////////////////////////// + _tolleranceFld = addDouble("tollerance", 0.0001 ); + + ////////////////////////////////////////////////////////////////////////// + _applyFld = fieldC->addNotify("apply"); (_autoApplyFld = fieldC->addBool("autoApply"))->setBoolValue(true); + _statusFld = fieldC->addString("status"); + _statusFld->setStringValue("Ready"); ////////////////////////////////////////////////////////////////////////// @@ -42,12 +61,21 @@ (_listenToSelectionChangedNotificationsFld = fieldC->addBool("listenToSelectionChangedNotifications")) ->setBoolValue(false); + char* statisticsNames[LASTSTATISTIC]; + statisticsNames[ MIN ] = "Minimum"; + statisticsNames[ MAX ] = "Maximum"; + statisticsNames[ MEAN ] = "Mean"; + statisticsNames[ STDEV ] = "StDev"; + _curveStatistic = addEnum("curveStatistic",statisticsNames,LASTSTATISTIC ); + _isInNotificationCB = false; ML_CHECK_NEW(_outputXMarkerList,XMarkerList()); (_outputXMarkerListFld = getFieldContainer()->addBase("outputXMarkerList"))->setBaseValue(NULL); + _outputCurveList = new CurveList; + (_outputCurveListFld = getFieldContainer()->addBase("outputCurveList"))->setBaseValue( _outputCurveList ); handleNotificationOn(); } @@ -58,11 +86,19 @@ { ML_TRACE_IN("CSODistance::~CSODistance()"); - if (_csoList != NULL){ - _csoList->removeNotificationObserver(_csoListNotificationCB, this); + if (_csoList0 != NULL){ + _csoList0->removeNotificationObserver(_csoListNotificationCB, this); } ML_DELETE(_outputXMarkerList); + + // Delete all created CurveData objects + while ( !_outputCurveList->getCurveList().empty() ) { + ML_DELETE( _outputCurveList->getCurveList().back() ); + _outputCurveList->getCurveList().pop_back(); + } + ML_DELETE( _outputCurveList ); + } ////////////////////////////////////////////////////////////////////////// @@ -84,26 +120,46 @@ { ML_TRACE_IN("void CSODistance::handleNotification(Field* field)"); - if (field == _inputCSOFld){ + if (field == _input0CSOFld){ - if (!_isInNotificationCB) { CSOList::removeNotificationObserverFromAllCSOLists(_csoListNotificationCB, this);} + if (!_isInNotificationCB && _csoList0 ) { _csoList0->removeNotificationObserver(_csoListNotificationCB, this);} - if (BASE_IS_A((static_cast<Base*>(_inputCSOFld->getBaseValue())), CSOList)){ + if (BASE_IS_A((static_cast<Base*>(_input0CSOFld->getBaseValue())), CSOList)){ - _csoList = static_cast<CSOList*>(_inputCSOFld->getBaseValue()); + _csoList0 = static_cast<CSOList*>(_input0CSOFld->getBaseValue()); - if (_csoList != NULL){ + if (_csoList0 != NULL){ - if (!_isInNotificationCB) { _csoList->addNotificationObserver(_csoListNotificationCB, this); } + if (!_isInNotificationCB) { _csoList0->addNotificationObserver(_csoListNotificationCB, this); } } } else { - _csoList = NULL; + _csoList0 = NULL; } if (_autoApplyFld->getBoolValue()) { _process(); } } else - if (field == _applyFld) { + if (field == _input1CSOFld){ + + if (!_isInNotificationCB && _csoList1 ) { _csoList1->removeNotificationObserver(_csoListNotificationCB, this);} + + if (BASE_IS_A((static_cast<Base*>(_input1CSOFld->getBaseValue())), CSOList)){ + + _csoList1 = static_cast<CSOList*>(_input1CSOFld->getBaseValue()); + + if (_csoList1 != NULL){ + + if (!_isInNotificationCB) { _csoList1->addNotificationObserver(_csoListNotificationCB, this); } + } + } else { + + _csoList1 = NULL; + } + + if (_autoApplyFld->getBoolValue()) { _process(); } + } else + if ( field == _applyFld || ( _autoApplyFld->getBoolValue() && + ( field == _tolleranceFld || field == _curveStatistic )) ){ _process(); } @@ -119,56 +175,248 @@ _outputXMarkerList->clearList(); - if (_csoList != NULL) { + // Delete all created CurveData objects + while ( !_outputCurveList->getCurveList().empty() ) { + ML_DELETE( _outputCurveList->getCurveList().back() ); + _outputCurveList->getCurveList().pop_back(); + } - if ((_csoList->numCSO() >= 2) && (_csoList->getCSOAt(0)->getIsFinished()) && (_csoList->getCSOAt(1)->getIsFinished())) { - MinimalDistancePointClouds* pointSetsMinDist = NULL; - ML_CHECK_NEW(pointSetsMinDist, MinimalDistancePointClouds); + if (_csoList0 != NULL) { - std::vector<vec3>pointSet1; - std::vector<vec3>pointSet2; - - _csoList->getCSOAt(0)->fillPathPointCoordinatesFlattened(pointSet1); - _csoList->getCSOAt(1)->fillPathPointCoordinatesFlattened(pointSet2); + int nCSOs = _csoList0->numCSO(); - pointSetsMinDist->setPointSets(pointSet1, pointSet2); - pointSetsMinDist->setNumEntries(200); + double minDistance = 0.0; + double maxDistance = 0.0; + double avgDistance = 0.0; + double stdDevDistance = 0.0; - vec3 nPoint1, nPoint2; - pointSetsMinDist->computeDistance(nPoint1,nPoint2); + std::stringstream distances; + distances << _tableHeader << std::endl; - _minimumDistancePoint1Fld->setVec3fValue(nPoint1); - _minimumDistancePoint2Fld->setVec3fValue(nPoint2); - double distance = sqrt((nPoint1[0]-nPoint2[0])*(nPoint1[0]-nPoint2[0]) + - (nPoint1[1]-nPoint2[1])*(nPoint1[1]-nPoint2[1]) + - (nPoint1[2]-nPoint2[2])*(nPoint1[2]-nPoint2[2])); + switch ( _modeFld->getEnumValue() ){ + case FIRST2 : + { + if ((nCSOs >= 2) && (_csoList0->getCSOAt(0)->getIsFinished()) && (_csoList0->getCSOAt(1)->getIsFinished())) { + std::vector<vec3>pointSet1; + std::vector<vec3>pointSet2; + + _csoList0->getCSOAt(0)->fillPathPointCoordinatesFlattened(pointSet1); + _csoList0->getCSOAt(1)->fillPathPointCoordinatesFlattened(pointSet2); - _minimumDistanceFld->setFloatValue(distance); + Vector3 minPoint1,minPoint2,maxPoint1,maxPoint2; - _outputXMarkerList->appendItem(XMarker(vec6(nPoint1[0],nPoint1[1],nPoint1[2],0.5f,0.0f,0.0f), - vec3(nPoint2[0]-nPoint1[0],nPoint2[1]-nPoint1[1],0.0f), - 0,"")); - - ML_DELETE(pointSetsMinDist); + MinimalDistancePointClouds* pointSetsMinDist = NULL; + ML_CHECK_NEW(pointSetsMinDist, MinimalDistancePointClouds); + + pointSetsMinDist->setPointSets(pointSet1, pointSet2); + pointSetsMinDist->setNumEntries(200); + pointSetsMinDist->computeDistance(minPoint1,minPoint2); - } else { - _minimumDistancePoint1Fld->setVec3fValue(vec3(0.0,0.0,0.0)); - _minimumDistancePoint2Fld->setVec3fValue(vec3(0.0,0.0,0.0)); - _minimumDistanceFld->setFloatValue(0.0f); + minDistance = sqrt((minPoint1[0]-minPoint2[0])*(minPoint1[0]-minPoint2[0]) + + (minPoint1[1]-minPoint2[1])*(minPoint1[1]-minPoint2[1]) + + (minPoint1[2]-minPoint2[2])*(minPoint1[2]-minPoint2[2])); + + + + _minimumDistanceFld->setFloatValue( static_cast<float>(minDistance)); + + _outputXMarkerList->appendItem(XMarker( vec6(minPoint1[0],minPoint1[1],minPoint1[2],0.5f,0.0f,0.0f), + vec3(minPoint2[0]-minPoint1[0],minPoint2[1]-minPoint1[1],minPoint2[2]-minPoint1[2]), + 0,"")); + distances << _csoList0->getCSOAt(0)->getId() << "," + << _csoList0->getCSOAt(1)->getId() << "," + << minDistance << "," + << maxDistance << "," + << avgDistance << "," + << stdDevDistance + << std::endl; + } else { + _minimumDistancePoint1Fld->setVec3fValue(vec3(0.0,0.0,0.0)); + _minimumDistancePoint2Fld->setVec3fValue(vec3(0.0,0.0,0.0)); + _minimumDistanceFld->setFloatValue(0.0f); + _distancesFld->setStringValue( _tableHeader ); + } + break; + } + case INPLANE: + { + CurveData *outputCurve = new CurveData; + double *yValues = new double[ nCSOs ]; + + double minDist = ML_DOUBLE_MAX; + vec3 point1; + vec3 point2; + for ( int iCSO = 0; iCSO<nCSOs; ++iCSO ){ + CSO* currentCSO = _csoList0->getCSOAt( iCSO ); + CSO* matchingCSO = _findMatchingCSO(iCSO); + if (!matchingCSO) {continue;} + + std::vector<vec3>pointSet1; + std::vector<vec3>pointSet2; + currentCSO->fillPathPointCoordinatesFlattened(pointSet1); + matchingCSO->fillPathPointCoordinatesFlattened(pointSet2); + + Vector3 minPoint1,minPoint2,maxPoint1,maxPoint2; + + _getDistances( pointSet1, pointSet2, + minDistance,maxDistance,avgDistance,stdDevDistance, + minPoint1,minPoint2,maxPoint1,maxPoint2); + + distances << currentCSO->getId() << "," + << matchingCSO->getId() << "," + << minDistance << "," + << maxDistance << "," + << avgDistance << "," + << stdDevDistance + << std::endl; + + if ( minDistance < minDist ){ + minDist = minDistance; + point1 = minPoint1; + point2 = minPoint2; + } + + _outputXMarkerList->appendItem(XMarker( vec6(minPoint1[0],minPoint1[1],minPoint1[2],0.5f,0.0f,0.0f), + vec3(minPoint2[0]-minPoint1[0],minPoint2[1]-minPoint1[1],minPoint2[2]-minPoint1[2]), + currentCSO->getId(),"")); + + switch ( _curveStatistic->getEnumValue() ){ + case MIN: + yValues[ iCSO ] = minDistance; + break; + case MAX: + yValues[ iCSO ] = maxDistance; + break; + case MEAN: + yValues[ iCSO ] = avgDistance; + break; + case STDEV: + yValues[ iCSO ] = stdDevDistance; + break; + default: + break; + } + } // iCSO + outputCurve->setY( nCSOs, yValues); + delete[] yValues; + _outputCurveList->getCurveList().push_back( outputCurve ); + _distancesFld->setStringValue( distances.str() ); + _minimumDistancePoint1Fld->setVec3fValue(point1); + _minimumDistancePoint2Fld->setVec3fValue(point2); + _minimumDistanceFld->setFloatValue( static_cast<float>(minDistance) ); + break; + } + default: + break; } + } else { _minimumDistancePoint1Fld->setVec3fValue(vec3(0.0,0.0,0.0)); _minimumDistancePoint2Fld->setVec3fValue(vec3(0.0,0.0,0.0)); _minimumDistanceFld->setFloatValue(0.0f); + _distancesFld->setStringValue( _tableHeader ); } _outputXMarkerListFld->setBaseValue(_outputXMarkerList); + _outputCurveListFld->touch(); } ////////////////////////////////////////////////////////////////////////// +void CSODistance::_getDistances( std::vector<Vector3> &set1, + std::vector<Vector3> &set2, + double &minDistance, + double &maxDistance, + double &averageDistance, + double &stdDevDistance, + Vector3 &minPoint1, + Vector3 &minPoint2, + Vector3 &maxPoint1, + Vector3 &maxPoint2) +{ + + + minDistance = ML_DOUBLE_MAX; + maxDistance = 0.0; + double sumDist = 0.0; + double sqrDist = 0.0; + for(int i = 0; i < int(set1.size()); i++) + { + Vector3 pos1 = set1[i]; + Vector3 pos2; + double currentDistance = ML_DOUBLE_MAX; + for(int j = 0; j < int( set2.size() ); j++) + { + Vector3 pos = set2[j]; + double dist = (pos1 - pos).length(); + if ( dist < currentDistance ){ + currentDistance = dist; + pos2 = pos; + } + } + + if ( minDistance > currentDistance ){ + minDistance = currentDistance; + minPoint1 = pos1; + minPoint2 = pos2; + } + if (maxDistance < currentDistance ){ + maxDistance = currentDistance; + maxPoint1 = pos1; + maxPoint2 = pos2; + } + sumDist += currentDistance; + sqrDist += currentDistance*currentDistance; + } + double nPoints = ( set1.size() ? static_cast<double>(set1.size()) : 1.0); + averageDistance = sumDist/nPoints; + stdDevDistance = sqrDist/nPoints - averageDistance*averageDistance; +} + +////////////////////////////////////////////////////////////////////////// + +CSO* CSODistance::_findMatchingCSO(int findCSO) +{ + CSO* matchingCSO = NULL; + + if ( _modeFld->getEnumValue() == TWOINPUTS && _csoList0 != NULL && _csoList1 != NULL) { + if (findCSO < static_cast<int>( _csoList1->numCSO()) ){ + matchingCSO = _csoList1->getCSOAt( findCSO ); + } + } else { + + const int nCSOs = _csoList0->numCSO(); + const CSO* currentCSO = _csoList0->getCSOAt( findCSO ); + const double tollerance = _tolleranceFld->getDoubleValue(); + vec3 currentNormal = currentCSO->getPlaneNormal(); + currentNormal.normalize(); + const vec3 currentPoint = currentCSO->getFirstSeedPoint()->worldPosition; + + double minError = ML_DOUBLE_MAX; + for ( int iCSO = 0; iCSO<nCSOs; ++iCSO ){ + CSO* cso = _csoList0->getCSOAt( iCSO ); + if ( cso == currentCSO ) { continue; } + vec3 normal = cso->getPlaneNormal(); + normal.normalize(); + const vec3 matchingPoint = cso->getFirstSeedPoint()->worldPosition; + const double angleError = 1- abs( currentNormal.dot( normal )); + const double distanceError = abs(currentNormal.dot( matchingPoint - currentPoint )); + const double currentError = angleError + distanceError; + if ( currentError < minError && angleError < tollerance && distanceError < 10*tollerance ) { + minError = currentError; + matchingCSO = cso; + } + } + } + + return matchingCSO; +} + + +////////////////////////////////////////////////////////////////////////// + void CSODistance::_csoListNotificationCB(void* userData, int notificationFlag) { ML_TRACE_IN("void CSODistance::_csoListNotificationCB()"); Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.h 2011-09-26 13:41:31 UTC (rev 383) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSODistance/CSODistance.h 2011-09-26 14:24:04 UTC (rev 384) @@ -8,6 +8,7 @@ #include "../MinimalDistancePointClouds/MinimalDistancePointClouds.h" #include <mlXMarkerList.h> +#include <mlDiagramData.h> ML_START_NAMESPACE @@ -23,6 +24,8 @@ //! Standard constructor. CSODistance(); + enum {FIRST2=0, INPLANE, TWOINPUTS, LASTMODE}; + protected: //! Standard destructor. @@ -39,8 +42,14 @@ /* FIELDS */ //! CSO input field. - BaseField* _inputCSOFld; + BaseField* _input0CSOFld; + //! CSO input field. + BaseField* _input1CSOFld; + + //! Mode + EnumField* _modeFld; + //! Shall the module update on every event? BoolField* _listenToRepaintNotificationsFld; //! Shall the module listen to finishing events? @@ -48,33 +57,55 @@ //! Shall the module listen to selection change notifications? BoolField* _listenToSelectionChangedNotificationsFld; + //! Only calculate distances for CSOs in the same plane. + DoubleField* _tolleranceFld; + //! Field for displaying the minimum distance. FloatField* _minimumDistanceFld; //! Field for displaying the position of the first point Vec3fField* _minimumDistancePoint1Fld; //! Field for displaying the position of the second point Vec3fField* _minimumDistancePoint2Fld; + //! Field for holding the distances per cso + StringField* _distancesFld; //! Apply field NotifyField* _applyFld; //! Auto apply field BoolField* _autoApplyFld; + //! Status field + StringField* _statusFld; + //! XMarkerList output field BaseField *_outputXMarkerListFld; + //! CurveList output field; + BaseField* _outputCurveListFld; + + //! Output statistic + EnumField* _curveStatistic; + + enum STATISTICS {MIN,MAX,MEAN,STDEV,LASTSTATISTIC}; /* MEMBER VARIABLES */ //! A pointer to the input CSOList. - CSOList* _csoList; + CSOList* _csoList0; + //! A pointer to the input CSOList. + CSOList* _csoList1; + //! Locking variable... bool _isInNotificationCB; //! Output XMarkerList XMarkerList *_outputXMarkerList; + //! output CurveList + CurveList* _outputCurveList; + std::string _tableHeader; + /* METHODS */ //! Reads out information and displays them. @@ -83,6 +114,19 @@ //! Can be notified from anywhere in the network. static void _csoListNotificationCB(void* userData, int notificationFlag); + CSO* _findMatchingCSO(int csoIndex); + + void _getDistances( std::vector<Vector3> &set1, + std::vector<Vector3> &set2, + double &minDistance, + double &maxDistance, + double &averageDistance, + double &stdDevDistance, + Vector3 &minPoint1, + Vector3 &minPoint2, + Vector3 &maxPoint1, + Vector3 &maxPoint2); + ML_BASEOP_CLASS_HEADER(CSODistance); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |