You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(144) |
Jul
(5) |
Aug
(23) |
Sep
(3) |
Oct
(8) |
Nov
(6) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(4) |
Feb
|
Mar
(34) |
Apr
(1) |
May
(10) |
Jun
(12) |
Jul
(17) |
Aug
(28) |
Sep
(2) |
Oct
|
Nov
(2) |
Dec
(3) |
2011 |
Jan
(4) |
Feb
(7) |
Mar
(5) |
Apr
(1) |
May
|
Jun
(15) |
Jul
(1) |
Aug
(7) |
Sep
(9) |
Oct
(3) |
Nov
|
Dec
(1) |
2012 |
Jan
(1) |
Feb
(13) |
Mar
(6) |
Apr
|
May
(1) |
Jun
|
Jul
(1) |
Aug
(9) |
Sep
(7) |
Oct
(2) |
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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: <awa...@us...> - 2010-06-14 08:15:37
|
Revision: 278 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=278&view=rev Author: awakeideas Date: 2010-06-14 08:15:30 +0000 (Mon, 14 Jun 2010) Log Message: ----------- split large loop into two smaller loops for SM2.0 graphics cards Modified Paths: -------------- trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab Modified: trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab =================================================================== --- trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab 2010-06-11 08:15:09 UTC (rev 277) +++ trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab 2010-06-14 08:15:30 UTC (rev 278) @@ -174,10 +174,10 @@ } fields { instanceName = VolRenLUT - currentColor = "0.862745106220245 0.309803932905197 0.160784319043159" - currentOpacity = 0.131034 - currentPosition = 1377.83 - currentIndex = 7 + currentColor = "1 1 1" + currentOpacity = 0 + currentPosition = 0 + currentIndex = 0 rangeMin = 0 rangeMax = 4095 viewMin = 0 @@ -318,7 +318,7 @@ moduleGroupName = "" windows { window _viewer { - geometry = "834 174 528 507" + geometry = "726 203 528 507" sizeHint = "400 400" wasOpen = yes wasActive = no @@ -384,10 +384,10 @@ stereoViewing = FALSE stereoOffset = 3 height = 0.78539801 - position = "-79.1226501464844 86.703857421875 79.9663619995117" - orientation = "-0.189089938998222 0.429181843996048 0.883203208446503 3.73977541923523" - nearDistance = 86.419075 - farDistance = 197.47377 + position = "-89.5694122314453 94.9458541870117 59.2226638793945" + orientation = "0.221742615103722 -0.495839625597 -0.839626908302307 2.55545544624329" + nearDistance = 88.165863 + farDistance = 198.22769 focalDistance = 142.02036 forceRedrawOnInteraction = FALSE button1events = TO_VIEWER @@ -565,9 +565,9 @@ moduleGroupName = "" windows { window _default { - geometry = "467 521 1047 917" + geometry = "1314 345 1047 917" sizeHint = "422 346" - wasOpen = no + wasOpen = yes wasActive = no } } @@ -607,23 +607,25 @@ vec4 fragColor = vec4(0.0); bool stop = false; - for (int i = 0; i < 4000; i++) { - // advance ray by step - dataPos = dataPos + dirStep; - // stop condition - stop = dot(sign(dataPos-texMin),sign(texMax-dataPos)) < 3.0; - if (stop) break; - // data fetching and transfer function evaluation - float myIndex = texture3D(data, dataPos).r; - vec4 myColor = texture1D(lut, myIndex); - // opacity calculation - float prev_alpha = myColor.a - (myColor.a * fragColor.a); - fragColor.rgb = prev_alpha * myColor.rgb + fragColor.rgb; - fragColor.a += prev_alpha; - // Lambertian illumination - vec3 L = normalize(Lpos.xyz - normalize(dataPos)); - float sampleL = texture3D(data, dataPos + step*L).r; - fragColor.rgb += 1.0 * lightColor * (myIndex - sampleL); + for (int j = 0; j < 10; j++) { + for (int i = 0; i < 400; i++) { + // advance ray by step + dataPos = dataPos + dirStep; + // stop condition + stop = dot(sign(dataPos-texMin),sign(texMax-dataPos)) < 3.0; + if (stop) break; + // data fetching and transfer function evaluation + float myIndex = texture3D(data, dataPos).r; + vec4 myColor = texture1D(lut, myIndex); + // opacity calculation + float prev_alpha = myColor.a - (myColor.a * fragColor.a); + fragColor.rgb = prev_alpha * myColor.rgb + fragColor.rgb; + fragColor.a += prev_alpha; + // Lambertian illumination + vec3 L = normalize(Lpos.xyz - normalize(dataPos)); + float sampleL = texture3D(data, dataPos + step*L).r; + fragColor.rgb += 1.0 * lightColor * (myIndex - sampleL); + } } gl_FragColor = fragColor; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bar...@us...> - 2010-06-11 08:15:18
|
Revision: 277 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=277&view=rev Author: bartdedobbelaer Date: 2010-06-11 08:15:09 +0000 (Fri, 11 Jun 2010) Log Message: ----------- - Added missing Linux shell script to create project Added Paths: ----------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.sh Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.sh =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.sh (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.sh 2010-06-11 08:15:09 UTC (rev 277) @@ -0,0 +1,2 @@ +#!/bin/bash +python $MLAB_ROOT/MeVis/Foundation/BuildTools/Scripts/createProject.py MLMatlabScriptWrapper \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-06-08 09:23:01
|
Revision: 276 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=276&view=rev Author: awakeideas Date: 2010-06-08 09:22:55 +0000 (Tue, 08 Jun 2010) Log Message: ----------- removed -deskop option for OSX as there have been reports of communication issues between MATLAB & MeVisLab Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-07 14:02:33 UTC (rev 275) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-08 09:22:55 UTC (rev 276) @@ -193,9 +193,6 @@ if (! m_startCmd.empty()) { std::cout << "Found matlab binary at: " << m_startCmd.c_str() << std::endl; - - // Show the MATLAB IDE - m_startCmd += " -desktop"; } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-06-07 14:02:39
|
Revision: 275 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=275&view=rev Author: awakeideas Date: 2010-06-07 14:02:33 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Added simple volume ray caster as an example for the SoShader framework. Feel free to extend to network! Added Paths: ----------- trunk/Community/General/Modules/Inventor/SoShader/ trunk/Community/General/Modules/Inventor/SoShader/networks/ trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab Added: trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab =================================================================== --- trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab (rev 0) +++ trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab 2010-06-07 14:02:33 UTC (rev 275) @@ -0,0 +1,688 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module LocalImage { + internal { + frame = "421 389 104 56" + moduleGroupName = "" + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module SoLUTEditor { + internal { + frame = "193 -47 128 64" + moduleGroupName = "" + windows { + window _default { + geometry = "192 369 545 442" + sizeHint = "553 442" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = BackgroundLUT + currentColor = "1 1 1" + currentOpacity = 0 + currentPosition = 0 + currentIndex = 0 + rangeMin = 0 + rangeMax = 4095 + viewMin = 0 + viewMax = 4095 + window = 1 + level = 0.5 + allowNewPoints = TRUE + colorIsValid = TRUE + opacityIsValid = TRUE + updateLutWhileDragging = TRUE + relativeLut = FALSE + rangeInfo = [0.00,4095.00] + viewRangeInfo = [0,4095] + colorInterpolation = InterpolateRGB + colorPoints = "[ 0 0.113725 0.137255 0.172549, 505.658 0.521569 0.670588 0.87451, 4095 1 1 1 ]" + alphaPoints = "[ 0 0, 505.658 1, 4095 1 ]" + alphaFactor = 1 + newRangeMin = 0 + newRangeMax = 4095 + newRangeMode = ClipFormerLUT + colorEditorHeight = 24 + showColorEditor = TRUE + showAlphaEditor = TRUE + markerRadius = 4 + selectedMarkerRadius = 6 + snapMarkerRadius = 10 + alphaLineWidth = 2 + backgroundColor = "0.800000011920929 0.800000011920929 0.800000011920929" + borderColor = "0 0 0" + alphaLineColor = "0 0 0" + histogramColor = "0.400000005960464 0.400000005960464 0.400000005960464" + drawColoredMarkers = TRUE + markerColor = "1 1 1" + selectedMarkerColor = "1 0.5 0.5" + selectedTriangleSize = 8 + triangleSize = 6 + useAntiAliasing = TRUE + } +} +module SoBackground { + internal { + frame = "333 -43 120 56" + moduleGroupName = "" + } + fields { + instanceName = SoBackground + rotate = TRUE + flip = FALSE + on = TRUE + depthBuffer = TRUE + } +} +module SoMaterial { + internal { + frame = "465 -47 144 64" + moduleGroupName = "" + windows { + window _automatic { + geometry = "279 404 260 211" + sizeHint = "260 211" + wasOpen = no + wasActive = no + } + window _materialeditor { + geometry = "619 386 195 158" + sizeHint = "195 158" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Transparent_Cube + ambientColor = "0.2 0.2 0.2" + diffuseColor = "0.8 0.8 0.8" + specularColor = "0 0 0" + emissiveColor = "0 0 0" + shininess = 0.2 + transparency = 0.1 + } +} +module SoCalculator { + internal { + frame = "1101 221 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "162 145 349 692" + sizeHint = "349 692" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoCalculator + a = 64 + b = 64 + c = 64 + d = 1 + e = 1 + f = 1 + g = 0 + h = 0 + va = "0 0 0" + vb = "0 0 0" + vc = "0 0 0" + vd = "0 0 0" + ve = "0 0 0" + vf = "0 0 0" + vg = "0 0 0" + vh = "0 0 0" + oa = 64 + ob = 64 + oc = 64 + od = 0 + ova = "0 0 0" + ovb = "0 0 0" + ovc = "0 0 0" + ovd = "0 0 0" + expression = "oa=a*d; +ob=b*e; +oc=c*f;" + } +} +module SoLUTEditor { + internal { + frame = "285 297 104 64" + moduleGroupName = "" + windows { + window _default { + geometry = "50 245 575 441" + sizeHint = "581 441" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = VolRenLUT + currentColor = "0.862745106220245 0.309803932905197 0.160784319043159" + currentOpacity = 0.131034 + currentPosition = 1377.83 + currentIndex = 7 + rangeMin = 0 + rangeMax = 4095 + viewMin = 0 + viewMax = 4095 + window = 1 + level = 0.5 + allowNewPoints = TRUE + colorIsValid = TRUE + opacityIsValid = TRUE + updateLutWhileDragging = TRUE + relativeLut = FALSE + rangeInfo = [0.00,4095.00] + viewRangeInfo = [0,4095] + colorInterpolation = InterpolateRGB + colorPoints = "[ 0 0 0 0, 0.004095 0 0 0, 101 1 1 1, 291 1 1 1, 480.852 1 1 1, 653 0 0 0, 1139.21 0 0 0, 1377.83 0.862745 0.309804 0.160784, 1539.47 0.972549 0.898039 0.45098, 1703 1 1 1, 1703 1 1 1, 4095 1 1 1 ]" + alphaPoints = "[ 0 0, 0.004095 0, 101 0, 291 0.008, 480.852 0.04, 653 0, 1139.21 0, 1377.83 0.131034, 1539.47 0.324138, 1703 0.941, 1703 0, 4095 0 ]" + alphaFactor = 1 + newRangeMin = 0 + newRangeMax = 4095 + newRangeMode = ClipFormerLUT + colorEditorHeight = 24 + showColorEditor = TRUE + showAlphaEditor = TRUE + markerRadius = 4 + selectedMarkerRadius = 6 + snapMarkerRadius = 10 + alphaLineWidth = 2 + backgroundColor = "0.800000011920929 0.800000011920929 0.800000011920929" + borderColor = "0 0 0" + alphaLineColor = "0 0 0" + histogramColor = "0.400000005960464 0.400000005960464 0.400000005960464" + drawColoredMarkers = TRUE + markerColor = "1 1 1" + selectedMarkerColor = "1 0.5 0.5" + selectedTriangleSize = 8 + triangleSize = 6 + useAntiAliasing = TRUE + } +} +module SoMLSampler1D { + internal { + frame = "273 137 128 64" + moduleGroupName = "" + windows { + window _default { + geometry = "188 305 412 454" + sizeHint = "412 454" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = lut + name = lut + unit = 1 + enableBorder = FALSE + borderColor = "0 0 0 0" + minFilter = LINEAR + magFilter = LINEAR + wrapS = CLAMP_TO_BORDER + use16BitFloat = TRUE + startT = 0 + startU = 0 + startY = 0 + startZ = 0 + } +} +module Info { + internal { + frame = "1213 221 56 56" + moduleGroupName = "" + windows { + window _default { + geometry = "108 475 604 397" + sizeHint = "604 397" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Info + bypassIndex = -1 + inPlaceIndex = -1 + } +} +module Histogram { + internal { + frame = "281 389 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "445 419 506 352" + sizeHint = "506 352" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Histogram + useMask = FALSE + xRange = "Static Min/Max" + maskMode = Weights + curveType = Line + curveStyle = 0 + curveTitle = "" + updateMode = AutoUpdate + useStepFunction = FALSE + useBinSizeOneRepresentation = TRUE + useBackgroundValue = FALSE + backgroundValue = 0 + binSize = 1 + } +} +module SoShaderParameterMLImageProps { + internal { + frame = "541 137 232 64" + moduleGroupName = "" + windows { + window _default { + geometry = "73 437 251 107" + sizeHint = "251 107" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = data_properties + name = data + } +} +module SoCustomExaminerViewer { + internal { + frame = "581 -147 184 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "834 174 528 507" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + window _default { + geometry = "62 233 591 474" + sizeHint = "591 474" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "695 399 529 433" + sizeHint = "529 433" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoCustomExaminerViewer + 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 + inputDevicesList = "" + headlight = TRUE + decoration = TRUE + popupMenuEnabled = TRUE + 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 = "-79.1226501464844 86.703857421875 79.9663619995117" + orientation = "-0.189089938998222 0.429181843996048 0.883203208446503 3.73977541923523" + nearDistance = 86.419075 + farDistance = 197.47377 + focalDistance = 142.02036 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = TRUE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + enablePickNView = FALSE + enableHome = FALSE + enableViewAll = TRUE + enableSeek = FALSE + enableASC = TRUE + enableProjType = FALSE + enableDolly = TRUE + enableM3Control = FALSE + chooseView = VIEW_ANTERIOR + transformDeltaIn = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + } +} +module SoSeparator { + internal { + frame = "593 29 240 56" + moduleGroupName = "" + } + fields { + instanceName = SoSeparator + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module LUTToMLImage { + internal { + frame = "273 221 128 56" + moduleGroupName = "" + windows { + window _default { + geometry = "158 233 284 236" + sizeHint = "284 236" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LUTToMLImage + minIndex = 0 + maxIndex = 4095 + autoIndexRange = TRUE + maxEntry = 255 + height = 1 + depth = 1 + rescale = FALSE + rescaleWidth = 256 + } +} +module Scale { + internal { + frame = "441 261 64 56" + moduleGroupName = "" + windows { + window _default { + geometry = "26 59 439 248" + sizeHint = "439 248" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Scale + inputMin = 0 + inputMax = 4095 + updateMode = AutoUpdateMinMaxOn + useTrueRange = FALSE + typeSelect = UInt8 + outputMin = 0 + outputMax = 255 + } +} +module SoCube { + internal { + frame = "1193 137 80 64" + moduleGroupName = "" + windows { + window _default { + geometry = "695 178 118 94" + sizeHint = "118 94" + wasOpen = no + wasActive = yes + } + } + } + fields { + instanceName = proxy + width = 64 + height = 64 + depth = 64 + } +} +module SoShaderProgram { + internal { + frame = "1053 141 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "158 233 432 126" + sizeHint = "432 126" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoShaderProgram + shaderObject = "[ ]" + parameter = "[ ]" + geometryInputType = TRIANGLES_INPUT + geometryOutputType = TRIANGLE_STRIP_OUTPUT + maxEmittedGeometryVertices = 8 + } +} +module SoVertexShader { + internal { + frame = "777 141 128 56" + moduleGroupName = "" + windows { + window _default { + geometry = "20 182 741 439" + sizeHint = "422 346" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoVertexShader + isActive = TRUE + sourceType = GLSL_PROGRAM + sourceProgram = "// simple volume ray-caster +// +// enable backface culling! + +uniform ivec3 data_size; +uniform vec3 data_voxelSize; +varying vec3 dataTextureCoord; +varying vec3 geomPos; + +void main() +{ + gl_Position = ftransform(); + + geomPos = gl_Vertex.xyz; + // cube's coords go from -x/2 to +x/2 + dataTextureCoord = gl_Vertex.xyz / (vec3(data_size)*data_voxelSize) + 0.5; +} +" + } +} +module SoFragmentShader { + internal { + frame = "905 141 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "467 521 1047 917" + sizeHint = "422 346" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoFragmentShader + isActive = TRUE + sourceType = GLSL_PROGRAM + sourceProgram = "// simple volume ray-caster + +uniform sampler3D data; +uniform ivec3 data_size; +uniform vec3 data_voxelSize; +uniform vec2 data_range; +uniform sampler1D lut; +uniform vec4 oiv_ViewPosition; +varying vec3 dataTextureCoord; +varying vec3 geomPos; + +void main() +{ + vec3 lightColor = vec3(0.2,0.2,0.2); + + vec4 lightDisplacement = vec4(0.1,0.2,0.6,0.); + vec3 Lpos = (normalize(oiv_ViewPosition) + lightDisplacement*gl_ModelViewMatrixInverse).xyz; + + vec3 texMin = vec3(0.); + vec3 texMax = vec3(1.); + + vec3 cameraPos = gl_ModelViewMatrixInverse[3].xyz; + + vec3 step = 0.1 / (vec3(data_size) * data_voxelSize); + + vec3 dataPos = dataTextureCoord; + vec3 geomDir = normalize(geomPos - cameraPos); + vec3 dirStep = geomDir * step; + vec4 fragColor = vec4(0.0); + bool stop = false; + + for (int i = 0; i < 4000; i++) { + // advance ray by step + dataPos = dataPos + dirStep; + // stop condition + stop = dot(sign(dataPos-texMin),sign(texMax-dataPos)) < 3.0; + if (stop) break; + // data fetching and transfer function evaluation + float myIndex = texture3D(data, dataPos).r; + vec4 myColor = texture1D(lut, myIndex); + // opacity calculation + float prev_alpha = myColor.a - (myColor.a * fragColor.a); + fragColor.rgb = prev_alpha * myColor.rgb + fragColor.rgb; + fragColor.a += prev_alpha; + // Lambertian illumination + vec3 L = normalize(Lpos.xyz - normalize(dataPos)); + float sampleL = texture3D(data, dataPos + step*L).r; + fragColor.rgb += 1.0 * lightColor * (myIndex - sampleL); + } + gl_FragColor = fragColor; +} +" + } +} +module SoMLSampler3D { + internal { + frame = "409 137 128 64" + moduleGroupName = "" + windows { + window _default { + geometry = "114 175 412 454" + sizeHint = "412 454" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "782 409 354 413" + sizeHint = "354 413" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = data + name = data + unit = 0 + enableBorder = FALSE + borderColor = "0 0 0 0" + minFilter = LINEAR + magFilter = LINEAR + wrapS = REPEAT + use16BitFloat = TRUE + startT = 0 + startU = 0 + wrapT = REPEAT + wrapR = REPEAT + } +} +connections { + SoCalculator.a = Info.sizeX + SoCalculator.b = Info.sizeY + SoCalculator.c = Info.sizeZ + SoCalculator.d = Info.voxelSizeX + SoCalculator.e = Info.voxelSizeY + SoCalculator.f = Info.voxelSizeZ + VolRenLUT.inHistogram = Histogram.outputHistogramCurve + lut.image = LUTToMLImage.output0 + Info.input0 = Scale.output0 + Histogram.input0 = LocalImage.outImage + SoCustomExaminerViewer.children = "BackgroundLUT.outInventorLUT SoBackground.self Transparent_Cube.self SoSeparator.self" + SoSeparator.children = "lut.self data.self data_properties.self SoVertexShader.self SoFragmentShader.self SoShaderProgram.self proxy.self" + LUTToMLImage.inLUT = VolRenLUT.outLUT + Scale.input0 = LocalImage.outImage + proxy.width = SoCalculator.oa + proxy.height = SoCalculator.ob + proxy.depth = SoCalculator.oc + data.image = Scale.output0 +} +networkModel = "" Property changes on: trunk/Community/General/Modules/Inventor/SoShader/networks/SoShader_VolumeRayCaster.mlab ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2010-06-07 11:32:20
|
Revision: 274 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=274&view=rev Author: broersen Date: 2010-06-07 11:32:13 +0000 (Mon, 07 Jun 2010) Log Message: ----------- ENH: -Added buffer to capture Matlab output Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2010-06-07 11:30:48 UTC (rev 273) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2010-06-07 11:32:13 UTC (rev 274) @@ -188,6 +188,14 @@ } } } // Category Strings + Category Output { + TextView matlabOutput { + autoApply = Yes + edit = False + visibleRows = 33 + wrap = off + } + } // Category Output } // Window } // MLModule MatlabScriptWrapper Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 2010-06-07 11:30:48 UTC (rev 273) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 2010-06-07 11:32:13 UTC (rev 274) @@ -41,13 +41,11 @@ Up to three images can be used. Images are stored as up to six dimensional matrices in Matlab. Note that MeVisLab and Matlab use different coordinate systems, see below for further information. </li> - <br> <li><span style="font-weight: bold;">XMarkerLists:</span> An XMarker is an object that contains a point (up to 6-D), a vector (3-D) 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> - <br> <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, @@ -62,12 +60,10 @@ <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> - <br> <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 @@ -95,12 +91,12 @@ If you choose to use existing script, the script in script field will disappear and there is no posibility to edit a Matlab script file from MevisLab. <br> -Push the "Update"-button to execute the Matlab script, or set Auto-Update on input data change. +Push the "Update"-button to execute the Matlab script, set "Auto update" to update on input value change, +or set "Auto apply" to update on parameter value change. <br> Use the "Show Matlab session window" checkbox to show or hide the session window. <br> The "Restart Matlab"-button can be used to restart a Matlab session once it is terminated externally. -<br> </blockquote> @@ -133,8 +129,7 @@ <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> Up to three 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). +in Matlab without input from MeVisLab (see the example network for examples). </blockquote> @@ -162,14 +157,22 @@ <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -<b>Auto-update on input data change</b> +<b>Auto update</b> <br> Execute the script automatically on input change (only for input images -and the XMarkerList, not for changes in the GUI).<br> +and the XMarkerList, not for changes in the names).<br> </blockquote> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> +<b>Auto apply</b> +<br> +Execute the script automatically on parameter change (only for fields, +not for changes in the names).<br> +</blockquote> + + +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <b>Show Matlab session window</b> <br> Show or hide the Matlab session window.<br> @@ -197,7 +200,14 @@ </blockquote> +<blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> +<b>Matlab Output</b> <br> +Displays the output of executed Matlab script.<br> +</blockquote> + + +<br> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <b>Input/Output image, XMarkerList, scalar, vector, matrix names and strings</b> <br> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2010-06-07 11:30:55
|
Revision: 273 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=273&view=rev Author: broersen Date: 2010-06-07 11:30:48 +0000 (Mon, 07 Jun 2010) Log Message: ----------- ENH: -Added buffer to capture Matlab output Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-04 15:43:37 UTC (rev 272) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-07 11:30:48 UTC (rev 273) @@ -15,7 +15,7 @@ // 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 +// 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 @@ -26,7 +26,7 @@ //! The ML module class MatlabScriptWrapper. /*! // \file mlMatlabScriptWrapper.cpp -// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter +// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter, Alexander Broersen // \date 2009-02-23 // // Module for executing Matlab scripts in MeVisLab. @@ -158,6 +158,9 @@ (_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"); + //! Add field to display Matlab output. + (_matlabOutputBufferFld = fields->addString("matlabOutput"))->setStringValue(""); + #if defined(MACOS) if (m_startCmd.empty()) { // Try to locate matlab binary in PATH environment @@ -319,11 +322,27 @@ // Insert at the end of the script variable to proof execution status // and run the script in Matlab - evaluateString += "\nmevmatscr=1"; + evaluateString += "\nmevmatscr=1;"; // Added ';' to prevent unnecessary output _statusFld->setStringValue("Matlab script is executing...."); + + // Buffer to capture Matlab output + #define BUFSIZE 5120 + char buffer[BUFSIZE+1]; + buffer[BUFSIZE] = '\0'; + // Start logging Matlab output + engOutputBuffer(m_pEngine, buffer, BUFSIZE); + + // and run the script in Matlab engEvalString(m_pEngine, evaluateString.c_str()); - // If variable mevmatscr exist it means the whole matlab script was executed. + // Stop logging Matlab output + engOutputBuffer(m_pEngine, NULL, 0); + // Use rich text format in output for visibility + std::string output("<PRE>"); + output.append(buffer); + _matlabOutputBufferFld->setStringValue(output); + + // If variable mevmatscr exist it means the whole Matlab script was executed. mxArray *mtmp = engGetVariable(m_pEngine,"mevmatscr"); if(mtmp!=NULL) { _statusFld->setStringValue("Execution successful!"); @@ -337,6 +356,7 @@ // If the script string was not valid, clear all data so that // the user notes this. else { + _matlabOutputBufferFld->setStringValue(""); _clearAllVariables(); } @@ -734,7 +754,7 @@ Vector(imgSize.x-1, imgSize.y-1, imgSize.z-1,imgSize.c-1, imgSize.t-1, imgSize.u-1)), inImg->getDataType(), &data, - ScaleShiftData(1,0)); + ScaleShiftData(1, 0)); // Check and save error code if necessary. if (localErr != ML_RESULT_OK) { @@ -1086,7 +1106,7 @@ std::cerr << "_getVectorsBackFromMatlab(): Incorrect vector size" << std::endl << std::flush; } } else { - std::cerr << "_getVectorsBackFromMatlab(): Output type from Matlab not supported" << std::endl << std::flush; + std::cerr << "_getVectorsBackFromMatlab(): Output type from Matlab not supported" << std::endl << std::flush; } } } Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-06-04 15:43:37 UTC (rev 272) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-06-07 11:30:48 UTC (rev 273) @@ -15,7 +15,7 @@ // 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 +// 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 @@ -204,6 +204,9 @@ StringField *_stringNameFld[6]; //@} + //! Field to view Matlab output. + StringField* _matlabOutputBufferFld; + //! 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: <awa...@us...> - 2010-06-04 15:43:43
|
Revision: 272 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=272&view=rev Author: awakeideas Date: 2010-06-04 15:43:37 +0000 (Fri, 04 Jun 2010) Log Message: ----------- - start MATLAB IDE on OSX - cleaned up environment setup hint for OSX Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-26 15:21:02 UTC (rev 271) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-06-04 15:43:37 UTC (rev 272) @@ -190,6 +190,9 @@ if (! m_startCmd.empty()) { std::cout << "Found matlab binary at: " << m_startCmd.c_str() << std::endl; + + // Show the MATLAB IDE + m_startCmd += " -desktop"; } #endif @@ -198,18 +201,14 @@ if ( !_checkMatlabIsStarted() ) { std::cerr << "MatlabScriptWrapper::MatlabScriptWrapper():" << std::endl; - std::cerr << "Error: Matlab Engine not found. For this module to work, a Matlab installation is required." << std::endl << std::endl; + std::cerr << "Error: MATLAB Engine not found. For this module to work, a MATLAB installation is required." << std::endl << std::endl; std::cerr << "Additional Hints: " << std::endl; - std::cerr << " (1) On Windows, the matlab COM server must be registered. Execute " << std::endl; + std::cerr << " (1) On Windows, the MATLAB COM server must be registered. Execute " << std::endl; std::cerr << " >> matlab /regserver " << std::endl; std::cerr << " on a command line." << std::endl; - std::cerr << " (2) On Mac OS X, it is currently required to start MeVisLab from a shell with" << std::endl; - std::cerr << " PATH set to " << std::endl; - std::cerr << " $PATH:/bin:/sbin:/usr/bin:/usr/sbin:/Applications/MATLAB_R2007b/bin" << std::endl; - std::cerr << " (3) When starting from Xcode, ensure that the executable environment contains a variable" << std::endl; - std::cerr << " PATH set to the above. Edit your 'current executable' settings accordingly." << std::endl; - std::cerr << " DYLD_LIBRARY_PATH has to be extended to contain" << std::endl; - std::cerr << " /Applications/MATLAB_R2007b/bin/maci:/Applications/MATLAB_R2007b/sys/os/maci" << std::endl; + std::cerr << " (2) On Mac OS X, it is currently required to set the environment variable" << std::endl; + std::cerr << " DYLD_LIBRARY_PATH to /Applications/MATLAB_R2010a.app/bin/maci64 before" << std::endl; + std::cerr << " MeVisLab is started." << std::endl; (_showSessionWindowFld = fields->addBool("showSessionWindow"))->setBoolValue(false); _statusFld->setStringValue("Cannot find Matlab engine!"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-05-26 15:21:09
|
Revision: 271 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=271&view=rev Author: awakeideas Date: 2010-05-26 15:21:02 +0000 (Wed, 26 May 2010) Log Message: ----------- cleanup Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-26 13:31:27 UTC (rev 270) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-26 15:21:02 UTC (rev 271) @@ -163,24 +163,28 @@ // Try to locate matlab binary in PATH environment const char *pathEnv = getenv("PATH"); if (pathEnv) { - std::istringstream path(pathEnv); - while (! path.eof()) { - std::string test; - std::getline(path, test, ':'); - test.append("/matlab"); + std::istringstream pathList(pathEnv); + while (! pathList.eof()) { + std::string path; + std::getline(pathList, path, ':'); + path.append("/matlab"); struct stat info; - if (::stat(test.c_str(), &info) == 0) { - m_startCmd = test; + if (::stat(path.c_str(), &info) == 0) { + m_startCmd = path; } } } } if (m_startCmd.empty()) { - // Try to locate matlab binary on Mac OS X without relying on the PATH environment variable + // Try to locate matlab binary via its bundle id std::string matlabBundle = macx::Bundle::getBundleDirectory("com.mathworks.StartMATLAB"); if (! matlabBundle.empty()) { - m_startCmd = matlabBundle + "/bin/matlab"; + std::string path = matlabBundle + "/bin/matlab"; + struct stat info; + if (::stat(path.c_str(), &info) == 0) { + m_startCmd = path; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-05-26 13:31:33
|
Revision: 270 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=270&view=rev Author: awakeideas Date: 2010-05-26 13:31:27 +0000 (Wed, 26 May 2010) Log Message: ----------- Facilitated detection of matlab binary for OSX Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-26 09:31:49 UTC (rev 269) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-26 13:31:27 UTC (rev 270) @@ -40,6 +40,11 @@ // SDK includes #include <macBundle.h> +// System includes +#include <iostream> +#include <sstream> +#include <sys/stat.h> + ML_START_NAMESPACE //! Implements code for the runtime type system of the ML @@ -154,16 +159,37 @@ (_matrixFld[2] = fields->addMatrix("matrix2"))->setStringValue("1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1"); #if defined(MACOS) - // Try to locate Matlab on Mac OS X without relying on the PATH environment variable - std::string matlabBundle = macx::Bundle::getBundleDirectory("com.mathworks.StartMATLAB"); - if (! matlabBundle.empty()) { - std::string matlabExe = matlabBundle + "/bin/matlab"; - - // use matlabExe.c_str() as a parameter to engOpen() + if (m_startCmd.empty()) { + // Try to locate matlab binary in PATH environment + const char *pathEnv = getenv("PATH"); + if (pathEnv) { + std::istringstream path(pathEnv); + while (! path.eof()) { + std::string test; + std::getline(path, test, ':'); + test.append("/matlab"); + struct stat info; + if (::stat(test.c_str(), &info) == 0) { + m_startCmd = test; + } + } + } } + + if (m_startCmd.empty()) { + // Try to locate matlab binary on Mac OS X without relying on the PATH environment variable + std::string matlabBundle = macx::Bundle::getBundleDirectory("com.mathworks.StartMATLAB"); + if (! matlabBundle.empty()) { + m_startCmd = matlabBundle + "/bin/matlab"; + } + } + + if (! m_startCmd.empty()) { + std::cout << "Found matlab binary at: " << m_startCmd.c_str() << std::endl; + } #endif - m_pEngine = engOpen(NULL); + m_pEngine = engOpen( (m_startCmd.empty()) ? NULL : m_startCmd.c_str() ); if ( !_checkMatlabIsStarted() ) { @@ -219,7 +245,7 @@ { if(!_checkMatlabIsStarted()) { // Start Matlab if it's not started. - m_pEngine = engOpen(NULL); + m_pEngine = engOpen( (m_startCmd.empty()) ? NULL : m_startCmd.c_str() ); // If Matlab engine is started, make session window (in)visible if(_checkMatlabIsStarted()) { engSetVisible(m_pEngine,_showSessionWindowFld->getBoolValue()); Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-05-26 09:31:49 UTC (rev 269) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-05-26 13:31:27 UTC (rev 270) @@ -40,9 +40,14 @@ // Local includes #include "MLMatlabScriptWrapperSystem.h" + +// SDK includes #include <mlXMarkerList.h> #include <mlVersion.h> +// System includes +#include <string> + // Include the Matlab engine. Note that the correct path to this // file must be set in the MLMatlabScriptWrapper.pro file. #include "engine.h" @@ -204,6 +209,9 @@ //! Instance of the Matlab engine. ::Engine *m_pEngine; + + //! Engine start command + std::string m_startCmd; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-05-26 09:31:55
|
Revision: 269 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=269&view=rev Author: awakeideas Date: 2010-05-26 09:31:49 +0000 (Wed, 26 May 2010) Log Message: ----------- added author Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-26 09:11:29 UTC (rev 268) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-26 09:31:49 UTC (rev 269) @@ -2,7 +2,7 @@ # MLMatlabScriptWrapper project profile # # \file MLMatlabScriptWrapper.pro -# \author Alexander Gryanik, Markus Harz, Ola Friman +# \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter # \date 2009-02-23 # ----------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-05-26 09:11:35
|
Revision: 268 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=268&view=rev Author: awakeideas Date: 2010-05-26 09:11:29 +0000 (Wed, 26 May 2010) Log Message: ----------- added MeVisLab 2.1 compatibility Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-25 18:01:36 UTC (rev 267) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-26 09:11:29 UTC (rev 268) @@ -26,7 +26,7 @@ //! The ML module class MatlabScriptWrapper. /*! // \file mlMatlabScriptWrapper.cpp -// \author Alexander Gryanik, Markus Harz, Ola Friman +// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter // \date 2009-02-23 // // Module for executing Matlab scripts in MeVisLab. @@ -391,6 +391,14 @@ } } + +#if ML_MAJOR_VERSION >= 2 +# define __setInSubImageDataType(__t) for(int __i=0;__i<3;++__i) {getOutImg(outIndex)->setInSubImageDataType(__i,__t);} +#else +# define __setInSubImageDataType(__t) +#endif + + //---------------------------------------------------------------------------------- //! Sets properties of the output image at output \c outIndex. //---------------------------------------------------------------------------------- @@ -402,6 +410,10 @@ if (!_checkMatlabIsStarted()) { std::cerr << "calcOutImageProps(): Cannot find Matlab engine!" << std::endl << std::flush; +#if ML_MAJOR_VERSION >= 2 + getOutImg(outIndex)->setOutOfDate(); + getOutImg(outIndex)->setStateInfo("Cannot find Matlab engine!", ML_BAD_DATA_TYPE); +#endif return; } @@ -429,14 +441,14 @@ getOutImg(outIndex)->setImgExt(outExt); // Set output image datatype. switch (mxGetClassID(m_pImage)) { - case mxDOUBLE_CLASS: getOutImg(outIndex)->setDataType(MLdoubleType); break; - case mxSINGLE_CLASS: getOutImg(outIndex)->setDataType(MLfloatType); break; - case mxINT8_CLASS: getOutImg(outIndex)->setDataType(MLint8Type); break; - case mxUINT8_CLASS: getOutImg(outIndex)->setDataType(MLuint8Type); break; - case mxINT16_CLASS: getOutImg(outIndex)->setDataType(MLint16Type); break; - case mxUINT16_CLASS: getOutImg(outIndex)->setDataType(MLuint16Type); break; - case mxINT32_CLASS: getOutImg(outIndex)->setDataType(MLint32Type); break; - case mxUINT32_CLASS: getOutImg(outIndex)->setDataType(MLuint32Type); break; + case mxDOUBLE_CLASS: getOutImg(outIndex)->setDataType(MLdoubleType); __setInSubImageDataType(MLdoubleType); break; + case mxSINGLE_CLASS: getOutImg(outIndex)->setDataType(MLfloatType); __setInSubImageDataType(MLdoubleType); break; + case mxINT8_CLASS: getOutImg(outIndex)->setDataType(MLint8Type); __setInSubImageDataType(MLdoubleType); break; + case mxUINT8_CLASS: getOutImg(outIndex)->setDataType(MLuint8Type); __setInSubImageDataType(MLdoubleType); break; + case mxINT16_CLASS: getOutImg(outIndex)->setDataType(MLint16Type); __setInSubImageDataType(MLdoubleType); break; + case mxUINT16_CLASS: getOutImg(outIndex)->setDataType(MLuint16Type); __setInSubImageDataType(MLdoubleType); break; + case mxINT32_CLASS: getOutImg(outIndex)->setDataType(MLint32Type); __setInSubImageDataType(MLdoubleType); break; + case mxUINT32_CLASS: getOutImg(outIndex)->setDataType(MLuint32Type); __setInSubImageDataType(MLdoubleType); break; case mxINT64_CLASS: // Matlab does not support basic operations on this type //getOutImg(outIndex)->setDataType(MLint64Type); //break; @@ -469,6 +481,7 @@ } } +#if ML_MAJOR_VERSION < 2 //---------------------------------------------------------------------------------- //! Request input image in basic datatype. //---------------------------------------------------------------------------------- @@ -482,6 +495,7 @@ props.inSubImgDType = MLdoubleType; } } +#endif //---------------------------------------------------------------------------------- //! Returns the input image region required to calculate a region of an output image. Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-05-25 18:01:36 UTC (rev 267) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-05-26 09:11:29 UTC (rev 268) @@ -26,7 +26,7 @@ //! The ML module class MatlabScriptWrapper. /*! // \file mlMatlabScriptWrapper.h -// \author Alexander Gryanik, Markus Harz, Ola Friman +// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter // \date 2009-02-23 // // Module for executing Matlab scripts in MeVisLab. @@ -40,7 +40,8 @@ // Local includes #include "MLMatlabScriptWrapperSystem.h" -#include "mlXMarkerList.h" +#include <mlXMarkerList.h> +#include <mlVersion.h> // Include the Matlab engine. Note that the correct path to this // file must be set in the MLMatlabScriptWrapper.pro file. @@ -80,11 +81,13 @@ //! \return Region of input image needed to compute the region \c outSubImgBox on output \c outIndex. virtual SubImgBox calcInSubImageBox (int inIndex, const SubImgBox &outSubImgBox, int outIndex); +#if ML_MAJOR_VERSION < 2 //! Request input image in basic datatypes according to user choice //! \param inIndex The input of which the datatype shall be set. //! \param props The properties of input image upon calling of method. //! \param outIndex The index of the output image. virtual void calcInSubImageProps(int inIndex, InSubImageProps &/*props*/, int /*outIndex*/); +#endif //! 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. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-05-25 18:01:43
|
Revision: 267 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=267&view=rev Author: awakeideas Date: 2010-05-25 18:01:36 +0000 (Tue, 25 May 2010) Log Message: ----------- check if MATLAB is found on OSX Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-25 17:43:04 UTC (rev 266) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-25 18:01:36 UTC (rev 267) @@ -33,7 +33,11 @@ # If this does not work set MATLAB_INSTALL_DIR manually MATLAB_INSTALL_DIR = $$system(osascript -e \'tell application \"Finder\" to get POSIX path of \(application file id \"com.mathworks.StartMATLAB\" as string\)\' 2>/dev/null) - message ( MATLAB_INSTALL_DIR is $$MATLAB_INSTALL_DIR ) + isEmpty(MATLAB_INSTALL_DIR) { + error( Automatic detection of MATLAB failed. Please add the location of the MATLAB bundle to the MATLAB_INSTALL_DIR variable in the .pro file ) + } else { + message ( MATLAB_INSTALL_DIR is $$MATLAB_INSTALL_DIR ) + } } else:linux { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-05-25 17:43:13
|
Revision: 266 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=266&view=rev Author: awakeideas Date: 2010-05-25 17:43:04 +0000 (Tue, 25 May 2010) Log Message: ----------- Added automatic detection of newer MATLAB releases for build configuration on Mac OS X Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-25 13:30:52 UTC (rev 265) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-25 17:43:04 UTC (rev 266) @@ -26,11 +26,33 @@ # --------- CHANGE PATHS TO MATLAB FILES HERE --------- -# path to the Matlab *.lib files -MATLAB_LIBDIR = "C:/Program Files/MATLAB/R2007b/extern/lib/win32/microsoft" -# add path to the Matlab engine.h file -INCLUDEPATH += "C:/Program Files/MATLAB/R2007b/extern/include" +macx { + + # Locate MATLAB bundle via its bundle id (Tested for MATLAB 2010a that yields: '/Applications/MATLAB_R2010a.app') + # If this does not work set MATLAB_INSTALL_DIR manually + MATLAB_INSTALL_DIR = $$system(osascript -e \'tell application \"Finder\" to get POSIX path of \(application file id \"com.mathworks.StartMATLAB\" as string\)\' 2>/dev/null) + + message ( MATLAB_INSTALL_DIR is $$MATLAB_INSTALL_DIR ) + +} else:linux { + + # add path to the Matlab engine.h file + INCLUDEPATH += + + # path to the Matlab *.so files + MATLAB_LIBDIR = + +} else { + + # add path to the Matlab engine.h file + INCLUDEPATH += "C:/Program Files/MATLAB/R2007b/extern/include" + + # path to the Matlab *.lib files + MATLAB_LIBDIR = "C:/Program Files/MATLAB/R2007b/extern/lib/win32/microsoft" + +} + # ----------------------------------------------------- win64 { @@ -55,17 +77,30 @@ LIBS += libmx.lib } else:macx { - 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 + MATLAB_INCDIR = $${MATLAB_INSTALL_DIR}/extern/include + 64bit { + MATLAB_LIBDIR = $${MATLAB_INSTALL_DIR}/bin/maci64 + } else { + MATLAB_LIBDIR = $${MATLAB_INSTALL_DIR}/bin/maci + } + + message ( MATLAB headers location is $$MATLAB_INCDIR ) + message ( MATLAB libraries location is $$MATLAB_LIBDIR ) + + INCLUDEPATH += $$MATLAB_INCDIR + QMAKE_LIBDIR += $$MATLAB_LIBDIR + + LIBS += -leng + LIBS += -lmx + + contains(MAKEFILE_GENERATOR,XCODE):message ( Execute the following commands in the Terminal: \ + install_name_tool -change @loader_path/libeng.dylib $${MATLAB_LIBDIR}/libeng.dylib $${DESTDIR}/lib$${TARGET}$${d}.dylib ; \ + install_name_tool -change @loader_path/libmx.dylib $${MATLAB_LIBDIR}/libmx.dylib $${DESTDIR}/lib$${TARGET}$${d}.dylib ) + + # Due to a limitiation in qmake, this does not work in Xcode currently + QMAKE_POST_LINK = \ + install_name_tool -change @loader_path/libeng.dylib $${MATLAB_LIBDIR}/libeng.dylib $${DESTDIR}/lib$${TARGET}$${d}.dylib && \ + install_name_tool -change @loader_path/libmx.dylib $${MATLAB_LIBDIR}/libmx.dylib $${DESTDIR}/lib$${TARGET}$${d}.dylib } else:linux { QMAKE_LIBDIR += $${MATLAB_LIBDIR} Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-25 13:30:52 UTC (rev 265) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-25 17:43:04 UTC (rev 266) @@ -154,10 +154,15 @@ (_matrixFld[2] = fields->addMatrix("matrix2"))->setStringValue("1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1"); #if defined(MACOS) - // Try to locate Matlab on Mac OS X - // std::string matlabBundle = macx::Bundle::getBundleDirectory("com.mathworks.matlab"); + // Try to locate Matlab on Mac OS X without relying on the PATH environment variable + std::string matlabBundle = macx::Bundle::getBundleDirectory("com.mathworks.StartMATLAB"); + if (! matlabBundle.empty()) { + std::string matlabExe = matlabBundle + "/bin/matlab"; + + // use matlabExe.c_str() as a parameter to engOpen() + } #endif - + m_pEngine = engOpen(NULL); if ( !_checkMatlabIsStarted() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2010-05-25 13:30:59
|
Revision: 265 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=265&view=rev Author: awakeideas Date: 2010-05-25 13:30:52 +0000 (Tue, 25 May 2010) Log Message: ----------- - ignore *.xcodeproj - some smaller cleanups Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Property Changed: ---------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/ Property changes on: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper ___________________________________________________________________ Added: svn:ignore + *.xcodeproj Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-25 11:27:42 UTC (rev 264) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro 2010-05-25 13:30:52 UTC (rev 265) @@ -14,7 +14,7 @@ DLLDESTDIR = ../../../lib # add dependencies of this project here -CONFIG += dll ML MLBase +CONFIG += dll ML MLBase MLMacOSSupport # 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-05-25 11:27:42 UTC (rev 264) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-25 13:30:52 UTC (rev 265) @@ -37,6 +37,9 @@ // Local includes #include "mlMatlabScriptWrapper.h" +// SDK includes +#include <macBundle.h> + ML_START_NAMESPACE //! Implements code for the runtime type system of the ML @@ -150,20 +153,25 @@ (_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"); +#if defined(MACOS) + // Try to locate Matlab on Mac OS X + // std::string matlabBundle = macx::Bundle::getBundleDirectory("com.mathworks.matlab"); +#endif + m_pEngine = engOpen(NULL); if ( !_checkMatlabIsStarted() ) { std::cerr << "MatlabScriptWrapper::MatlabScriptWrapper():" << std::endl; - std::cerr << "Error: Matlab Engine not found. For this module to work, a matlab installation is required." << std::endl << std::endl; + std::cerr << "Error: Matlab Engine not found. For this module to work, a Matlab installation is required." << std::endl << std::endl; std::cerr << "Additional Hints: " << std::endl; std::cerr << " (1) On Windows, the matlab COM server must be registered. Execute " << std::endl; std::cerr << " >> matlab /regserver " << std::endl; std::cerr << " on a command line." << std::endl; - std::cerr << " (2) On MacOSX, it is currently required to start MeVisLab from a shell with" << std::endl; + std::cerr << " (2) On Mac OS X, it is currently required to start MeVisLab from a shell with" << std::endl; std::cerr << " PATH set to " << std::endl; std::cerr << " $PATH:/bin:/sbin:/usr/bin:/usr/sbin:/Applications/MATLAB_R2007b/bin" << std::endl; - std::cerr << " (3) When starting from XCode, ensure that the executable environment contains a variable" << std::endl; + std::cerr << " (3) When starting from Xcode, ensure that the executable environment contains a variable" << std::endl; std::cerr << " PATH set to the above. Edit your 'current executable' settings accordingly." << std::endl; std::cerr << " DYLD_LIBRARY_PATH has to be extended to contain" << std::endl; std::cerr << " /Applications/MATLAB_R2007b/bin/maci:/Applications/MATLAB_R2007b/sys/os/maci" << std::endl; @@ -189,7 +197,7 @@ { ML_TRACE_IN("MatlabScriptWrapper::~MatlabScriptWrapper()"); - if (_checkMatlabIsStarted()) { + if (m_pEngine != NULL) { engClose(m_pEngine); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gu...@us...> - 2010-05-25 11:27:49
|
Revision: 264 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=264&view=rev Author: gunjo Date: 2010-05-25 11:27:42 +0000 (Tue, 25 May 2010) Log Message: ----------- Fixed logical bug in MatlabScriptWrapper::~MatlabScriptWrapper() Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-25 09:36:09 UTC (rev 263) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-25 11:27:42 UTC (rev 264) @@ -189,7 +189,7 @@ { ML_TRACE_IN("MatlabScriptWrapper::~MatlabScriptWrapper()"); - if (!_checkMatlabIsStarted()) { + if (_checkMatlabIsStarted()) { engClose(m_pEngine); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <of...@us...> - 2010-05-25 09:36:19
|
Revision: 263 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=263&view=rev Author: ofriman Date: 2010-05-25 09:36:09 +0000 (Tue, 25 May 2010) Log Message: ----------- Bugfix: Check if Matlab engine pointer is NULL in _checkMatlabIsStarted() to avoid crash. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-07 15:41:20 UTC (rev 262) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-05-25 09:36:09 UTC (rev 263) @@ -584,6 +584,12 @@ //! Check if Matlab is started. bool MatlabScriptWrapper::_checkMatlabIsStarted() { + // Is there an engine at all? + if(m_pEngine == NULL) { + return false; + } + + // Check that it is working properly if(0 == engEvalString(m_pEngine, "mevTestIfMatlabIsRunning=3.14")) { engEvalString(m_pEngine, "clear mevTestIfMatlabIsRunning"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-05-07 15:41:26
|
Revision: 262 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=262&view=rev Author: coertmetz Date: 2010-05-07 15:41:20 +0000 (Fri, 07 May 2010) Log Message: ----------- CM: Solved a bug which triggered loading when the output XMarkerList changed. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp 2010-04-09 08:37:09 UTC (rev 261) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp 2010-05-07 15:41:20 UTC (rev 262) @@ -111,7 +111,7 @@ { ML_TRACE_IN("XMarkerListFromFile::handleNotification()") - if (field==_updateFld || _autoUpdateFld->getBoolValue()) { + if ( field==_updateFld || ( _autoUpdateFld->getBoolValue() && field != _outputXMarkerListFld ) ) { _outputXMarkerList.clear(); // Check if an input image is connected when coordinate system is set to voxel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-04-09 08:37:15
|
Revision: 261 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=261&view=rev Author: coertmetz Date: 2010-04-09 08:37:09 +0000 (Fri, 09 Apr 2010) Log Message: ----------- CM: Added two new options to the nSyncViewer. One to turn on/off 'use global input image' for all viewers and one to change the layout of the viewers. Modified Paths: -------------- trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script Modified: trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py 2010-03-23 17:04:41 UTC (rev 260) +++ trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py 2010-04-09 08:37:09 UTC (rev 261) @@ -90,6 +90,9 @@ ctx.field('In0.noBypass').value = True ctx.field('invInput0').disconnectOutputs() ctx.field( 'OrthoView2D0.'+ ctx.field('singleInvInput').stringValue() ).connectFrom(ctx.field('invInput0') ) + # Set global input image option + ctx.field("OrthoView2D0.useGlobalInputImage").value = ctx.field("useGlobalInputImages").value + ctx.field("OrthoView2D0.layout").value = ctx.field("viewerLayout").value # create the appropriate modules for iInput in range(1,nInputs) : @@ -106,11 +109,18 @@ ctx.field('invInput' + str(iInput)).disconnectOutputs() ctx.field( 'OrthoView2D'+ str( iInput ) + '.' + ctx.field('singleInvInput').stringValue() ).connectFrom(ctx.field('invInput' + str(iInput))) + # Set global input image option + globalOption = viewerModuleName + ".useGlobalInputImage" + ctx.field(globalOption).value = ctx.field("useGlobalInputImages").value + + # Set layout option + layoutOption = viewerModuleName + ".layout" + ctx.field(layoutOption).value = ctx.field("viewerLayout").value + # Sync several fields ctx.field( viewerModuleName+'.worldPosition' ).connectFrom( ctx.field('OrthoView2D'+str(iInput-1)+'.worldPosition' )) ctx.field( viewerModuleName+'.pos.blendOnto' ).connectFrom( ctx.field('OrthoView2D'+str(iInput-1)+'.pos.blendOnto' )) ctx.field( viewerModuleName+'.ext.annoCoords').connectFrom( ctx.field('OrthoView2D'+str(iInput-1)+'.ext.annoCoords')) - ctx.field( viewerModuleName+'.layout').value = 'LAYOUT_AXIAL' ctx.field( viewerModuleName+'.ext.borderOn').value = False ctx.field( viewerModuleName+'.ext.annotVerticalRuler').value = False ctx.field( 'SyncPos.vector0' ).connectFrom( ctx.field( 'OrthoView2D'+ str( nInputs-1 ) + '.worldPosition' ) ) Modified: trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script 2010-03-23 17:04:41 UTC (rev 260) +++ trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script 2010-04-09 08:37:09 UTC (rev 261) @@ -94,6 +94,23 @@ } } Field layout { type = string value = "{1:[1,1],2:[1,2],3:[1,3],4:[2,2],5:[2,3]}"} + Field viewerLayout { + type = enum + items { + item LAYOUT_AXIAL { + title = "Axial" + } + item LAYOUT_SAGITTAL { + title = "Sagittal" + } + item LAYOUT_CORONAL { + title = "Coronal" + } + item LAYOUT_CUBE_EQUAL { + title = "Cube equal" + } + } + } Field syncZoom { type = bool value = false } Field unZoom { type = trigger } Field syncPanning { type = bool value = false } @@ -105,8 +122,8 @@ Field coordSystem { internalName = OrthoView2D0.ext.annoCoords } Field interpolationMethod { internalName = Reformat0.interpolation } Field cursorAlpha { internalName = OrthoView2D0.pos.blendOnto } + Field useGlobalInputImages { type = bool value = True } - //Field titleString { type = string value = "input0,input1" } //Field showTitleString { type = string value = "False,False" } //Field newTitle { type = string value = "" } @@ -128,6 +145,8 @@ FieldListener syncPanning { command = SyncPanning } FieldListener syncLUT { command = SyncLUT } FieldListener syncTimepoints { command = SyncTimepoints } + FieldListener useGlobalInputImages { command = NumberOfInputChanged } + FieldListener viewerLayout { command = NumberOfInputChanged } FieldListener { listenField = reformat listenField = referenceGrid @@ -139,6 +158,7 @@ MenuItem "Sync Zoom" { field = syncZoom } MenuItem "Sync LUT" { field = syncLUT } MenuItem "Sync Timepoints" { field = syncTimepoints } + MenuItem "Use global input images" { field = useGlobalInputImages } } } @@ -182,6 +202,7 @@ tooltip = "*You can specify the layout in a Python dictionary form: {nInputs:[rows,cols],nInputs:[rows,cols]}, e.g. {5:[3,2],10:[2,5]}*"} + Field viewerLayout {} Field showInventorInputs {} Field singleInvInput { dependsOn = showInventorInputs } Horizontal { @@ -189,6 +210,7 @@ Field syncZoom { alignGroup = g1 } Button unZoom { title = Reset } } + Field useGlobalInputImages { alignGroup = g1 } Field syncPanning { alignGroup = g1 } Field syncLUT { alignGroup = g1 } Field syncTimepoints { alignGroup = g1 } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-23 17:04:49
|
Revision: 260 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=260&view=rev Author: rhameeteman Date: 2010-03-23 17:04:41 +0000 (Tue, 23 Mar 2010) Log Message: ----------- KH. * fixed two bugs that were introduced in the last revision: MLLoadLibrary returns 1 on ok and not ML_RESULT_OK void tile* was not initialised to NULL Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-03-15 09:59:16 UTC (rev 259) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-03-23 17:04:41 UTC (rev 260) @@ -412,7 +412,7 @@ MLErrorCode libErr = MLLoadLibrary("MLResample1"); mlModule* mpr = NULL; mpr = MLCreateModuleFromName("MPR"); - if ( mpr == NULL || libErr != ML_RESULT_OK ) { + if ( mpr == NULL || libErr != 1 ) { mlDebug("Error creating module"); return; } @@ -495,7 +495,7 @@ Vector(x2,y2,z2,0,t,0) ); // Allocate memory block and fill it with the mpr image. - void* tile; + void* tile = NULL; MLErrorCode err = getTile( static_cast<BaseOp*>(mpr), 0, csoVoxelBox, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tva...@us...> - 2010-03-15 09:59:24
|
Revision: 259 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=259&view=rev Author: tvanwalsum Date: 2010-03-15 09:59:16 +0000 (Mon, 15 Mar 2010) Log Message: ----------- TVW: Fixed, to remove warning during build. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro Modified: trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro 2010-03-11 14:33:52 UTC (rev 258) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro 2010-03-15 09:59:16 UTC (rev 259) @@ -15,7 +15,7 @@ # add dependencies of this project here -CONFIG += dll ML nr +CONFIG += dll ML # set high warn level (warn 4 on MSCV) WARN = HIGH This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tva...@us...> - 2010-03-11 14:34:05
|
Revision: 258 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=258&view=rev Author: tvanwalsum Date: 2010-03-11 14:33:52 +0000 (Thu, 11 Mar 2010) Log Message: ----------- TVW: Re-added erf, with an erf implementation from the internet. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp Modified: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp 2010-03-10 08:57:50 UTC (rev 257) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp 2010-03-11 14:33:52 UTC (rev 258) @@ -27,11 +27,84 @@ #include "parser.h" +#include <math.h> + using namespace std; const double Parser::pi = 4.0*atan(1.0); const double Parser::e = exp(1.0); + +// below erf codes are from http://www.digitalmars.com/archives/cplusplus/3634.html + +static const double rel_error= 1E-12; //calculate 12 significant figures +//you can adjust rel_error to trade off between accuracy and speed +//but don't ask for > 15 figures (assuming usual 52 bit mantissa in a double) + +double erfc(double); + +double erf(double x) +//erf(x) = 2/sqrt(pi)*integral(exp(-t^2),t,0,x) +// = 2/sqrt(pi)*[x - x^3/3 + x^5/5*2! - x^7/7*3! + ...] +// = 1-erfc(x) +{ + static const double two_sqrtpi= 1.128379167095512574; // 2/sqrt(pi) + if (fabs(x) > 2.2) { + return 1.0 - erfc(x); //use continued fraction when fabs(x) > 2.2 + } + double sum= x, term= x, xsqr= x*x; + int j= 1; + do { + term*= xsqr/j; + sum-= term/(2*j+1); + ++j; + term*= xsqr/j; + sum+= term/(2*j+1); + ++j; + } while (fabs(term/sum) > rel_error); // CORRECTED LINE + return two_sqrtpi*sum; +} + + +double erfc(double x) +//erfc(x) = 2/sqrt(pi)*integral(exp(-t^2),t,x,inf) +// = exp(-x^2)/sqrt(pi) * [1/x+ (1/2)/x+ (2/2)/x+ (3/2)/x+ (4/2)/x+ ...] +// = 1-erf(x) +//expression inside [] is a continued fraction so '+' means add to denominator only + +{ + static const double one_sqrtpi= 0.564189583547756287; // 1/sqrt(pi) + if (fabs(x) < 2.2) { + return 1.0 - erf(x); //use series when fabs(x) < 2.2 + } + if ( /* signbit(x) */ x < 0) { //continued fraction only valid for x>0 + return 2.0 - erfc(-x); + } + double a=1, b=x; //last two convergent numerators + double c=x, d=x*x+0.5; //last two convergent denominators + double q1, q2= b/d; //last two convergents (a/c and b/d) + double n= 1.0, t; + do { + t= a*n+b*x; + a= b; + b= t; + t= c*n+d*x; + c= d; + d= t; + n+= 0.5; + q1= q2; + q2= b/d; + } while (fabs(q1-q2)/q2 > rel_error); + return one_sqrtpi*exp(-x*x)*q2; +} + + + + + + + + //=========================================================================== Parser::Parser (const char* infix, ostream& ostr) : tokenList(0), isValid(1) @@ -309,13 +382,13 @@ *f = log; return 1; } - /* + if ( strncmp(string,"erf",3) == 0 ) { *f = erf; return 1; } - */ + case 4: if ( strncmp(string,"sqrt",4) == 0 ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2010-03-10 08:57:57
|
Revision: 257 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=257&view=rev Author: broersen Date: 2010-03-10 08:57:50 +0000 (Wed, 10 Mar 2010) Log Message: ----------- ENH: -Added 'Auto apply' function Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2010-03-10 08:56:39 UTC (rev 256) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2010-03-10 08:57:50 UTC (rev 257) @@ -68,7 +68,8 @@ } } Horizontal { - CheckBox autoUpdate { title = "Auto-update on input data change" } + CheckBox autoUpdate { title = "Auto update" tooltip = "Update on input changes." } + CheckBox autoApply { title = "Auto apply" tooltip = "Update on field changes." } CheckBox showSessionWindow { title = "Show Matlab session window" } Button restartMatlab { alignX = Right title = "Restart Matlab" } } Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab 2010-03-10 08:56:39 UTC (rev 256) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab 2010-03-10 08:57:50 UTC (rev 257) @@ -23,7 +23,7 @@ } module SoWEMRenderer { internal { - frame = "801 521 128 64" + frame = "801 513 128 64" moduleGroupName = "" windows { window _default { @@ -86,7 +86,7 @@ } module SoExaminerViewer { internal { - frame = "793 453 144 56" + frame = "793 445 144 56" moduleGroupName = "" windows { window _default { @@ -320,7 +320,7 @@ fields { instanceName = LocalImage name = $(DemoDataPath)/Bone.tiff - trueName = "C:/Program Files/MeVisLab2.0aVC8/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + trueName = "" autoLoad = TRUE status = "File open" } @@ -928,7 +928,7 @@ drawMode = DrawModeCorrect instanceName = So3DXMarker listString = "" - numItems = 30 + numItems = 0 index = 0 persistent = FALSE listStringEnable = FALSE @@ -987,7 +987,7 @@ OutputXMarkerList.type = [1:size(OutputXMarkerList.pos,1)]'; " useExternalScript = FALSE - matlabScriptPath = K:/Repository/MeVisResearch/Private/Modules/ML/MLMatlabModules/test.m + matlabScriptPath = "" inDataName0 = Input0 inDataName1 = Input1 inDataName2 = Input2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2010-03-10 08:56:45
|
Revision: 256 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=256&view=rev Author: broersen Date: 2010-03-10 08:56:39 +0000 (Wed, 10 Mar 2010) Log Message: ----------- ENH: -Added 'Auto apply' function Modified Paths: -------------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-03-09 14:58:05 UTC (rev 255) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-03-10 08:56:39 UTC (rev 256) @@ -90,6 +90,7 @@ //! Create image data randomly. (_autoCalculationFld = fields->addBool("autoUpdate"))->setBoolValue(false); + (_autoApplyFld = fields->addBool("autoApply"))->setBoolValue(false); //! Add toggle to delete user set variables before new calculation. //(_deleteMatlabVarFld = fields->addBool("delMatlabVar"))->setBoolValue(false); //! Add update button. @@ -227,7 +228,17 @@ // Update output on an update or if autoapply is enabled. if( (field == _calculateFld) || - _autoCalculationFld->isOn() && ((field == getInField(0))||(field == getInField(1))||(field == getInField(2))) ) { + (_autoCalculationFld->isOn() && ((field == getInField(0))||(field == getInField(1))||(field == getInField(2))|| + (field == _inXMarkerNameFld)) ) || + (_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])|| + (field == _vectorFld[3])||(field == _vectorFld[4])||(field == _vectorFld[5])|| + (field == _matrixFld[0])||(field == _matrixFld[1])||(field == _matrixFld[2])|| + (field == _matrixFld[3])||(field == _matrixFld[4])||(field == _matrixFld[5])|| + (field == _stringFld[0])||(field == _stringFld[1])||(field == _stringFld[2])|| + (field == _stringFld[3])||(field == _stringFld[4])||(field == _stringFld[5])) ) + ) { // Check if Matlab is started. if (!_checkMatlabIsStarted()) { _statusFld->setStringValue("Cannot find Matlab engine!"); @@ -655,9 +666,10 @@ // Get whole image. MLErrorCode localErr = - getTile(getInOp(i),getInOpIndex(i), + getTile(getInOp(i), + getInOpIndex(i), SubImgBox(Vector(0, 0, 0, 0, 0, 0), - Vector(imgSize.x-1, imgSize.y-1, imgSize.z-1,imgSize.c-1, imgSize.t-1, imgSize.u-1)), + Vector(imgSize.x-1, imgSize.y-1, imgSize.z-1,imgSize.c-1, imgSize.t-1, imgSize.u-1)), inImg->getDataType(), &data, ScaleShiftData(1,0)); Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-03-09 14:58:05 UTC (rev 255) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-03-10 08:56:39 UTC (rev 256) @@ -67,10 +67,10 @@ // ---------------------------------------------------------- //@{ \name Image processing methods. // ---------------------------------------------------------- - + //! Sets properties of the output image at output \c outIndex. virtual void calcOutImageProps (int outIndex); - + //! Returns the input image region required to calculate a region of an output image. //! \param inIndex The input of which the regions shall be calculated. //! \param outSubImageBox The region of the output image for which the required input region @@ -79,20 +79,20 @@ //! shall be calculated. //! \return Region of input image needed to compute the region \c outSubImgBox on output \c outIndex. virtual SubImgBox calcInSubImageBox (int inIndex, const SubImgBox &outSubImgBox, int outIndex); - + //! Request input image in basic datatypes according to user choice //! \param inIndex The input of which the datatype shall be set. //! \param props The properties of input image upon calling of method. //! \param outIndex The index of the output image. virtual void calcInSubImageProps(int inIndex, InSubImageProps &/*props*/, int /*outIndex*/); - + //! 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. @@ -100,7 +100,7 @@ // template <typename T> // void calcOutSubImage (TSubImg<T> *outSubImg, int outIndex, TSubImg<T> *inSubImg1); // virtual void calcOutSubImage (SubImg *outSubImg, int outIndex, SubImg *inSubImg); - + //@} private: @@ -168,12 +168,14 @@ StringField *_outXMarkerNameFld; //@} - //! If true, the module updates on field changes. + //! If pressed, the module updates. + NotifyField* _calculateFld; + //! If true, the module updates on input changes. BoolField* _autoCalculationFld; + //! If true, the module updates on parameter/field changes. + BoolField* _autoApplyFld; //! Status messages. StringField* _statusFld; - //! If pressed, the module updates. - NotifyField* _calculateFld; //! Restart Matlab button. NotifyField* _restartMatlabFld; @@ -204,5 +206,5 @@ ML_END_NAMESPACE + #endif // __mlMatlabScriptWrapper_H - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tva...@us...> - 2010-03-09 14:58:11
|
Revision: 255 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=255&view=rev Author: tvanwalsum Date: 2010-03-09 14:58:05 +0000 (Tue, 09 Mar 2010) Log Message: ----------- TVW: Removed erf function, not supported (yet). Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro Modified: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp 2010-03-09 14:38:19 UTC (rev 254) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp 2010-03-09 14:58:05 UTC (rev 255) @@ -27,10 +27,6 @@ #include "parser.h" -// Include NR error function code -#include "nr3.h" -#include "erf.h" - using namespace std; const double Parser::pi = 4.0*atan(1.0); @@ -278,11 +274,10 @@ return rand()*randfac; } -double erf(double f) -{ - Erf erf; - return erf.erf(f); -} +//double erf(double f) +//{ +// erf(f); +//} int Parser::IsFunction (const char* string, int length, UnaryFunction* f) { @@ -314,11 +309,13 @@ *f = log; return 1; } + /* if ( strncmp(string,"erf",3) == 0 ) { *f = erf; return 1; } + */ case 4: if ( strncmp(string,"sqrt",4) == 0 ) { Modified: trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro 2010-03-09 14:38:19 UTC (rev 254) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro 2010-03-09 14:58:05 UTC (rev 255) @@ -21,9 +21,7 @@ WARN = HIGH -MLAB_PACKAGES += EMC_General \ - EMC_ThirdParty \ - MeVisLab_Standard +MLAB_PACKAGES += MeVisLab_Standard # make sure that this file is included after CONFIG and MLAB_PACKAGES include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |