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: <wol...@us...> - 2011-06-08 15:32:06
|
Revision: 354 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=354&view=rev Author: wolfspindler Date: 2011-06-08 15:31:57 +0000 (Wed, 08 Jun 2011) Log Message: ----------- MeVisLab2.1 to MeVisLab2.2: -Support for controlled library export symbols for non windows platforms added. -Missing gcc4.4 header files included. -Usage of ILAB5 definition not supported any more. Since no ILAB4 codes are supported any more those compiler switches have been removed completely. -CSO-Interface changes adopted. -Outdated Toggle fields replaced by BoolFields. -Outdated variable references removed from field creations. Modified Paths: -------------- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h trunk/Community/General/Sources/ML/MLBarcode/MLBarcodeSystem.h trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.cpp trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.h trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateSystem.h trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFiltersSystem.h trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/MLCSOCommunityModulesSystem.h trunk/Community/General/Sources/ML/MLCSOToRTStructure/MLCSOToRTStructureSystem.h trunk/Community/General/Sources/ML/MLCSOToRTStructure/mlCSOToRTStructure.cpp trunk/Community/General/Sources/ML/MLCSOToRTStructure/mlCSOToRTStructure.h trunk/Community/General/Sources/ML/MLFuzzyConnectedness/MLFuzzyConnectednessSystem.h trunk/Community/General/Sources/ML/MLImageUtilities/MLImageUtilitiesSystem.h trunk/Community/General/Sources/ML/MLLoadCAT08Data/MLLoadCAT08DataSystem.h trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapperSystem.h trunk/Community/General/Sources/ML/MLOsiriXImporter/MLOsiriXImporterSystem.h trunk/Community/General/Sources/ML/MLTestModules/MLTestModulesSystem.h trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModulesSystem.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesSystem.h trunk/Community/General/Sources/ML/UMDsplitCurveList/UMDsplitCurveListSystem.h Modified: trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h =================================================================== --- trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/CVLAscendingAortaDetection/CVLAscendingAortaDetectionSystem.h 2011-06-08 15:31:57 UTC (rev 354) @@ -1,34 +1,46 @@ -//---------------------------------------------------------------------------------- -//! Project global and OS specific declarations. -/*! -// \file CVLAscendingAortaDetectionSystem.h -// \author Stefan Saur -// \date 2007-03-24 -// -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __CVLAscendingAortaDetectionSystem_H -#define __CVLAscendingAortaDetectionSystem_H - - -// DLL export macro definition -#ifdef WIN32 -#ifdef CVLASCENDINGAORTADETECTION_EXPORTS -// Use the CVLASCENDINGAORTADETECTION_EXPORT macro to export classes and functions -#define CVLASCENDINGAORTADETECTION_EXPORT __declspec(dllexport) -#else -// If included by external modules, exported symbols are declared as import symbols -#define CVLASCENDINGAORTADETECTION_EXPORT __declspec(dllimport) -#endif - -#else -// No export declarations are necessary for non-Windows systems -#define CVLASCENDINGAORTADETECTION_EXPORT -#endif - - -#endif // __CVLAscendingAortaDetectionSystem_H - - +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file CVLAscendingAortaDetectionSystem.h +// \author Stefan Saur +// \date 2007-03-24 +// +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __CVLAscendingAortaDetectionSystem_H +#define __CVLAscendingAortaDetectionSystem_H + + +// DLL export macro definition +#if defined (ML_LIBRARY_EXPORT_ATTRIBUTE) || defined (ML_LIBRARY_IMPORT_ATTRIBUTE) + // Make use of the new style and platform independent import/export definitions. + #ifdef CVLASCENDINGAORTADETECTION_EXPORTS + // Export library symbols. + #define CVLASCENDINGAORTADETECTION_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE + #else + // If included by external modules, exported symbols are declared as import symbols + #define CVLASCENDINGAORTADETECTION_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE + #endif +#else + + // Only for backward compatibility to versions < MeVisLab2.2. + #ifdef WIN32 + #ifdef CVLASCENDINGAORTADETECTION_EXPORTS + // Use the CVLASCENDINGAORTADETECTION_EXPORT macro to export classes and functions + #define CVLASCENDINGAORTADETECTION_EXPORT __declspec(dllexport) + #else + // If included by external modules, exported symbols are declared as import symbols + #define CVLASCENDINGAORTADETECTION_EXPORT __declspec(dllimport) + #endif + + #else + // No export declarations are necessary for non-Windows systems + #define CVLASCENDINGAORTADETECTION_EXPORT + #endif +#endif + +#endif // __CVLAscendingAortaDetectionSystem_H + + Modified: trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h =================================================================== --- trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/CVLSegmentationEvaluationMetric/CVLSegmentationEvaluationMetricSystem.h 2011-06-08 15:31:57 UTC (rev 354) @@ -1,33 +1,44 @@ -//---------------------------------------------------------------------------------- -//! Project global and OS specific declarations. -/*! -// \file CVLSegmentationEvaluationMetricSystem.h -// \author Stefan Saur -// \date 2009-07-21 -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __CVLSegmentationEvaluationMetricSystem_H -#define __CVLSegmentationEvaluationMetricSystem_H - - -// DLL export macro definition -#ifdef WIN32 -#ifdef CVLSEGMENTATIONEVALUATIONMETRIC_EXPORTS -// Use the CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT macro to export classes and functions -#define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT __declspec(dllexport) -#else -// If included by external modules, exported symbols are declared as import symbols -#define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT __declspec(dllimport) -#endif - -#else -// No export declarations are necessary for non-Windows systems -#define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT -#endif - - -#endif // __CVLSegmentationEvaluationMetricSystem_H - - +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file CVLSegmentationEvaluationMetricSystem.h +// \author Stefan Saur +// \date 2009-07-21 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __CVLSegmentationEvaluationMetricSystem_H +#define __CVLSegmentationEvaluationMetricSystem_H + + +// DLL export macro definition +#if defined (ML_LIBRARY_EXPORT_ATTRIBUTE) || defined (ML_LIBRARY_IMPORT_ATTRIBUTE) + // Make use of the new style and platform independent import/export definitions. + #ifdef CVLSEGMENTATIONEVALUATIONMETRIC_EXPORTS + // Export library symbols. + #define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE + #else + // If included by external modules, exported symbols are declared as import symbols + #define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE + #endif +#else + // Only for backward compatibility to versions < MeVisLab2.2. + #ifdef WIN32 + #ifdef CVLSEGMENTATIONEVALUATIONMETRIC_EXPORTS + // Use the CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT macro to export classes and functions + #define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT __declspec(dllexport) + #else + // If included by external modules, exported symbols are declared as import symbols + #define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT __declspec(dllimport) + #endif + + #else + // No export declarations are necessary for non-Windows systems + #define CVLSEGMENTATIONEVALUATIONMETRIC_EXPORT + #endif +#endif + +#endif // __CVLSegmentationEvaluationMetricSystem_H + + Modified: trunk/Community/General/Sources/ML/MLBarcode/MLBarcodeSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLBarcode/MLBarcodeSystem.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLBarcode/MLBarcodeSystem.h 2011-06-08 15:31:57 UTC (rev 354) @@ -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 @@ -44,17 +44,28 @@ //---------------Export from DLL---------------------- // To export classes in this DLL, mark them with the // MLBARCODE_EXPORT macro -#ifdef WIN32 -#ifdef MLBARCODE_EXPORTS -#define MLBARCODE_EXPORT __declspec(dllexport) +#if defined (ML_LIBRARY_EXPORT_ATTRIBUTE) || defined (ML_LIBRARY_IMPORT_ATTRIBUTE) + // Make use of the new style and platform independent import/export definitions. + #ifdef MLBARCODE_EXPORTS + // Export library symbols. + #define MLBARCODE_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLBARCODE_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE + #endif #else -#define MLBARCODE_EXPORT __declspec(dllimport) -#endif + // Only for backward compatibility to versions < MeVisLab2.2. + #ifdef WIN32 + #ifdef MLBARCODE_EXPORTS + #define MLBARCODE_EXPORT __declspec(dllexport) + #else + #define MLBARCODE_EXPORT __declspec(dllimport) + #endif -#else -#define MLBARCODE_EXPORT + #else + #define MLBARCODE_EXPORT + #endif #endif - #endif Modified: trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.cpp 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.cpp 2011-06-08 15:31:57 UTC (rev 354) @@ -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 @@ -27,7 +27,7 @@ //! Implementation of an example operator for adding /*! // \file mlBarcode.cpp -// \author Dominik Boehm +// \author Dominik Boehm // \date 8/2003 */ //-------------------------------------------------------------------------------- @@ -89,27 +89,27 @@ handleNotificationOff(); _lockNotification = 1; - _qFld = getFieldContainer()->addInt("margin", &_q); + _qFld = getFieldContainer()->addInt("margin"); _qFld->setIntValue(200); - _xFld = getFieldContainer()->addInt("barWidth", &_x); + _xFld = getFieldContainer()->addInt("barWidth"); _xFld->setIntValue(8); - _ratioFld = getFieldContainer()->addFloat("ratio", &_ratio); + _ratioFld = getFieldContainer()->addFloat("ratio"); _ratioFld->setFloatValue(2.0); - _iFld = getFieldContainer()->addInt("interval", &_i); + _iFld = getFieldContainer()->addInt("interval"); _iFld->setIntValue(8); //! Pixelvalue for lightbars - _foregroundFld = getFieldContainer()->addInt("background", &_background); + _foregroundFld = getFieldContainer()->addInt("background"); _foregroundFld->setIntValue(4095); //! Pixelvalue for darkbars - _backgroundFld = getFieldContainer()->addInt("foreground", &_foreground); + _backgroundFld = getFieldContainer()->addInt("foreground"); _backgroundFld->setIntValue(0); - _ysizeFld = getFieldContainer()->addInt("height", &_ysize); + _ysizeFld = getFieldContainer()->addInt("height"); _ysizeFld->setIntValue(300); _textFld = getFieldContainer()->addString("text"); @@ -121,8 +121,8 @@ _apply->attachField(getOutField()); - _autoApplyFld = getFieldContainer()->addToggle("autoApply"); - _autoApplyFld->setIntValue(true); + _autoApplyFld = getFieldContainer()->addBool("autoApply"); + _autoApplyFld->setBoolValue(true); _lockNotification = 0; @@ -201,7 +201,9 @@ // Set value for color. - _color = _background; + const MLint backgroundVal = _foregroundFld->getIntValue(); + const MLint foregroundVal = _backgroundFld->getIntValue(); + _color = backgroundVal; // Number of chars to be coded (plus 2 chars for the '*' at the beginning and the end @@ -209,7 +211,11 @@ // Calculate the size of the codeline in pixel - _xsize = (int)((_numofchars+2)*(6*_x + 3*_ratio*_x) + (_numofchars+1) * _i + 2*_q); + const MLint qVal = _qFld->getIntValue(); + const MLint xVal = _xFld->getIntValue(); + const MLint iVal = _iFld->getIntValue(); + const float ratioVal = _ratioFld->getFloatValue(); + _xsize = (int)((_numofchars+2)*(6*xVal + 3*ratioVal*xVal) + (_numofchars+1) * iVal + 2*qVal); // Check, if an old codeline exists and remove this. if (_codeline!=NULL) { @@ -223,7 +229,7 @@ } // Initialize new codeline, set all pixels to white for (x=0; x<_xsize; x++) { - _codeline[x]=_background; + _codeline[x]=backgroundVal; } // Allocate memory for the complete text (including 2x'*') @@ -240,12 +246,12 @@ // Light area at the beginning - for(x=0; x<_q; x++) { - _codeline[x]=_background; + for(x=0; x<qVal; x++) { + _codeline[x]=backgroundVal; } // Now we can start to build the bars for each character - _color = _background; + _color = backgroundVal; // Loop through the complete text @@ -260,21 +266,21 @@ for (n=0; n < 9; n++) { // change color - if (_color == _background) { - _color = _foreground; + if (_color == backgroundVal) { + _color = foregroundVal; } else { - _color = _background; + _color = backgroundVal; } switch (_stripcode[n]) { // small bar - case '0': + case '0': { // fill with color - for(dx=0;dx<_x;dx++) + for(dx=0;dx<xVal;dx++) { _codeline[x]=_color; x++; @@ -285,7 +291,7 @@ case '1': // large bar { // fill with color - for(dx=0;dx<(int) (_ratio * _x);dx++) + for(dx=0;dx<(int) (ratioVal * xVal);dx++) { _codeline[x]=_color; x++; @@ -300,12 +306,12 @@ } // end code loop // interval between two chars - _color = _background; + _color = backgroundVal; //fill the interval with color, but not for the last one if(i3+1<strlen(_barcodefull)) { - for(dx=0;dx<_i;dx++) + for(dx=0;dx<iVal;dx++) { _codeline[x]=_color; x++; @@ -316,19 +322,19 @@ // After all this the light space at the end of the codeline should be left or - // in other words: _xsize - x == _q + // in other words: _xsize - x == qVal //Light area at the end while (x<_xsize ) { - _codeline[x]=_background; + _codeline[x]=backgroundVal; x++; } delete [] _barcodefull; - } + } //----------------------------------------------------------------------------- // Returns the Code 3 of 9 value for a given ASCII character. @@ -338,45 +344,45 @@ switch (Asc) { case ' ': - return "011000100"; + return "011000100"; case '$': - return "010101000"; + return "010101000"; case '%': - return "000101010"; + return "000101010"; case '*': return "010010100"; // * Start/Stop case '+': - return "010001010"; + return "010001010"; case '|': - return "010000101"; + return "010000101"; case '.': - return "110000100"; + return "110000100"; case '/': - return "010100010"; + return "010100010"; case '0': - return "000110100"; + return "000110100"; case '1': - return "100100001"; + return "100100001"; case '2': - return "001100001"; + return "001100001"; case '3': - return "101100000"; + return "101100000"; case '4': - return "000110001"; + return "000110001"; case '5': - return "100110000"; + return "100110000"; case '6': - return "001110000"; + return "001110000"; case '7': - return "000100101"; + return "000100101"; case '8': - return "100100100"; + return "100100100"; case '9': - return "001100100"; + return "001100100"; case 'A': - return "100001001"; + return "100001001"; case 'B': - return "001001001"; + return "001001001"; case 'C': return "101001000"; case 'D': @@ -426,7 +432,7 @@ case 'Z': return "011010000"; default: - return "011000100"; + return "011000100"; } } @@ -463,12 +469,12 @@ // Output image (barcode) is rotated for better use in mammogramms! - getOutImg()->setImgExt ( Vector(_xsize, _ysize, 1, 1, 1, 1)); - getOutImg()->setPageExt ( Vector(_xsize, _ysize, 1, 1, 1, 1)); + getOutImg()->setImgExt ( Vector(_xsize, _ysizeFld->getIntValue(), 1, 1, 1, 1)); + getOutImg()->setPageExt ( Vector(_xsize, _ysizeFld->getIntValue(), 1, 1, 1, 1)); // Determine new min/max range. - long double min = _foreground; - long double max = _background; + long double min = _backgroundFld->getIntValue(); + long double max = _foregroundFld->getIntValue(); getOutImg()->setMinVoxelValue( min ); getOutImg()->setMaxVoxelValue( max ); @@ -482,7 +488,7 @@ } //-------------------------------------------------------------------------------- - //! Calls correctly typed (template) version of calcOutSubImage to calculate page + //! Calls correctly typed (template) version of calcOutSubImage to calculate page //! outSubImg of output image with index outSubImg. //-------------------------------------------------------------------------------- CALC_OUTSUBIMAGE0_CPP(Barcode); @@ -490,7 +496,7 @@ //-------------------------------------------------------------------------------- //! Method template for type-specific page calculation. Called by calcOutSubImage(). //! \param outSubImg The typed subimage of output image outIndex loaded form file. - //! Parameter outIndex is the index of the output the subimage is calculated for and + //! Parameter outIndex is the index of the output the subimage is calculated for and //! is not used here. //-------------------------------------------------------------------------------- template <typename DATATYPE> Modified: trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.h =================================================================== --- trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLBarcode/mlBarcode.h 2011-06-08 15:31:57 UTC (rev 354) @@ -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 @@ -53,7 +53,7 @@ //! Constructor: Barcode(); - + //! Destructor. ~Barcode(); @@ -76,24 +76,19 @@ IntField* _foregroundFld; //! Field for image background value. IntField* _backgroundFld; - + //! Field to manage the apply button. - NotifyField* _apply; - + NotifyField* _apply; + //! Field to manage the auto apply toggle. - ToggleField* _autoApplyFld; + BoolField* _autoApplyFld; //@} private: - //! Pixelvalue for background - MLint _background; - //! Pixelvalue for foreground - MLint _foreground; - + int _lockNotification; - MLint _q, _x, _i, _ysize, _xsize; - float _ratio; + MLint _xsize; //! Pointer to a memory buffer for a code line. int* _codeline; @@ -124,7 +119,7 @@ //! Method template for type-specific page calculation. Called by calcOutSubImage(). //! \param outSubImg The typed subimage of output image outIndex loaded form file. - //! Parameter outIndex is the index of the output the subimage is calculated for and + //! Parameter outIndex is the index of the output the subimage is calculated for and //! is not used here. template <typename DATATYPE> void calcOutSubImage(TSubImg<DATATYPE> *outImg, int /*outIndex*/); Modified: trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateSystem.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateSystem.h 2011-06-08 15:31:57 UTC (rev 354) @@ -1,33 +1,44 @@ -//---------------------------------------------------------------------------------- -//! Project global and OS specific declarations. -/*! -// \file MLCMCoordinateSystem.h -// \author Reinhard Hameeteman -// \date 2010-03-05 -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __MLCMCoordinateSystem_H -#define __MLCMCoordinateSystem_H - - -// DLL export macro definition -#ifdef WIN32 -#ifdef MLCMCOORDINATE_EXPORTS -// Use the MLCMCoordinate_EXPORT macro to export classes and functions -#define MLCMCOORDINATE_EXPORT __declspec(dllexport) -#else -// If included by external modules, exported symbols are declared as import symbols -#define MLCMCOORDINATE_EXPORT __declspec(dllimport) -#endif - -#else -// No export declarations are necessary for non-Windows systems -#define MLCMCOORDINATE_EXPORT -#endif - - -#endif // __MLCMCoordinateSystem_H - - +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLCMCoordinateSystem.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMCoordinateSystem_H +#define __MLCMCoordinateSystem_H + + +// DLL export macro definition +#if defined (ML_LIBRARY_EXPORT_ATTRIBUTE) || defined (ML_LIBRARY_IMPORT_ATTRIBUTE) + // Make use of the new style and platform independent import/export definitions. + #ifdef MLCMCOORDINATE_EXPORTS + // Export library symbols. + #define MLCMCOORDINATE_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMCOORDINATE_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE + #endif +#else + // Only for backward compatibility to versions < MeVisLab2.2. + #ifdef WIN32 + #ifdef MLCMCOORDINATE_EXPORTS + // Use the MLCMCoordinate_EXPORT macro to export classes and functions + #define MLCMCOORDINATE_EXPORT __declspec(dllexport) + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMCOORDINATE_EXPORT __declspec(dllimport) + #endif + + #else + // No export declarations are necessary for non-Windows systems + #define MLCMCOORDINATE_EXPORT + #endif +#endif + +#endif // __MLCMCoordinateSystem_H + + Modified: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h 2011-06-08 15:31:57 UTC (rev 354) @@ -1,33 +1,44 @@ -//---------------------------------------------------------------------------------- -//! Project global and OS specific declarations. -/*! -// \file MLCMCurveListSystem.h -// \author Reinhard Hameeteman -// \date 2010-03-05 -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __MLCMCurveListSystem_H -#define __MLCMCurveListSystem_H - - -// DLL export macro definition -#ifdef WIN32 -#ifdef MLCMCURVELIST_EXPORTS -// Use the MLCMCURVELIST_EXPORT macro to export classes and functions -#define MLCMCURVELIST_EXPORT __declspec(dllexport) -#else -// If included by external modules, exported symbols are declared as import symbols -#define MLCMCURVELIST_EXPORT __declspec(dllimport) -#endif - -#else -// No export declarations are necessary for non-Windows systems -#define MLCMCURVELIST_EXPORT -#endif - - -#endif // __MLCMCurveListSystem_H - - +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLCMCurveListSystem.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMCurveListSystem_H +#define __MLCMCurveListSystem_H + + +// DLL export macro definition +#if defined (ML_LIBRARY_EXPORT_ATTRIBUTE) || defined (ML_LIBRARY_IMPORT_ATTRIBUTE) + // Make use of the new style and platform independent import/export definitions. + #ifdef MLCMCURVELIST_EXPORTS + // Export library symbols. + #define MLCMCURVELIST_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMCURVELIST_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE + #endif +#else + // Only for backward compatibility to versions < MeVisLab2.2. + #ifdef WIN32 + #ifdef MLCMCURVELIST_EXPORTS + // Use the MLCMCURVELIST_EXPORT macro to export classes and functions + #define MLCMCURVELIST_EXPORT __declspec(dllexport) + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMCURVELIST_EXPORT __declspec(dllimport) + #endif + + #else + // No export declarations are necessary for non-Windows systems + #define MLCMCURVELIST_EXPORT + #endif +#endif + +#endif // __MLCMCurveListSystem_H + + Modified: trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h 2011-06-08 15:31:57 UTC (rev 354) @@ -1,33 +1,44 @@ -//---------------------------------------------------------------------------------- -//! Project global and OS specific declarations. -/*! -// \file MLCMFieldsSystem.h -// \author Reinhard Hameeteman -// \date 2010-03-05 -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __MLCMFieldsSystem_H -#define __MLCMFieldsSystem_H - - -// DLL export macro definition -#ifdef WIN32 -#ifdef MLCMFIELDS_EXPORTS -// Use the MLCMFIELDS_EXPORT macro to export classes and functions -#define MLCMFIELDS_EXPORT __declspec(dllexport) -#else -// If included by external modules, exported symbols are declared as import symbols -#define MLCMFIELDS_EXPORT __declspec(dllimport) -#endif - -#else -// No export declarations are necessary for non-Windows systems -#define MLCMFIELDS_EXPORT -#endif - - -#endif // __MLCMFieldsSystem_H - - +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLCMFieldsSystem.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMFieldsSystem_H +#define __MLCMFieldsSystem_H + + +// DLL export macro definition +#if defined (ML_LIBRARY_EXPORT_ATTRIBUTE) || defined (ML_LIBRARY_IMPORT_ATTRIBUTE) + // Make use of the new style and platform independent import/export definitions. + #ifdef MLCMFIELDS_EXPORTS + // Export library symbols. + #define MLCMFIELDS_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMFIELDS_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE + #endif +#else + // Only for backward compatibility to versions < MeVisLab2.2. + #ifdef WIN32 + #ifdef MLCMFIELDS_EXPORTS + // Use the MLCMFIELDS_EXPORT macro to export classes and functions + #define MLCMFIELDS_EXPORT __declspec(dllexport) + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMFIELDS_EXPORT __declspec(dllimport) + #endif + + #else + // No export declarations are necessary for non-Windows systems + #define MLCMFIELDS_EXPORT + #endif +#endif + +#endif // __MLCMFieldsSystem_H + + Modified: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp 2011-06-08 15:31:57 UTC (rev 354) @@ -1,7 +1,7 @@ // Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), // Departments of Radiology and Medical Informatics, Erasmus MC. All // rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright @@ -12,7 +12,7 @@ // * Neither the name of BIGR nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -28,6 +28,8 @@ #include "parser.h" #include <math.h> +#include <string.h> +#include <stdlib.h> using namespace std; @@ -382,13 +384,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/MLCMImageFiltersSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFiltersSystem.h 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFiltersSystem.h 2011-06-08 15:31:57 UTC (rev 354) @@ -13,21 +13,32 @@ // DLL export macro definition -#ifdef WIN32 -#ifdef MLCMIMAGEFILTERS_EXPORTS -// Use the MLCMIMAGEFILTERS_EXPORT macro to export classes and functions -#define MLCMIMAGEFILTERS_EXPORT __declspec(dllexport) +#if defined (ML_LIBRARY_EXPORT_ATTRIBUTE) || defined (ML_LIBRARY_IMPORT_ATTRIBUTE) + // Make use of the new style and platform independent import/export definitions. + #ifdef MLCMIMAGEFILTERS_EXPORTS + // Export library symbols. + #define MLCMIMAGEFILTERS_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMIMAGEFILTERS_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE + #endif #else -// If included by external modules, exported symbols are declared as import symbols -#define MLCMIMAGEFILTERS_EXPORT __declspec(dllimport) -#endif + // Only for backward compatibility to versions < MeVisLab2.2. + #ifdef WIN32 + #ifdef MLCMIMAGEFILTERS_EXPORTS + // Use the MLCMIMAGEFILTERS_EXPORT macro to export classes and functions + #define MLCMIMAGEFILTERS_EXPORT __declspec(dllexport) + #else + // If included by external modules, exported symbols are declared as import symbols + #define MLCMIMAGEFILTERS_EXPORT __declspec(dllimport) + #endif -#else -// No export declarations are necessary for non-Windows systems -#define MLCMIMAGEFILTERS_EXPORT + #else + // No export declarations are necessary for non-Windows systems + #define MLCMIMAGEFILTERS_EXPORT + #endif #endif - #endif // __MLCMImageFiltersSystem_H Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-06-03 11:54:30 UTC (rev 353) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-06-08 15:31:57 UTC (rev 354) @@ -1,683 +1,696 @@ -// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), -// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of BIGR nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//---------------------------------------------------------------------------------- -//! The ML module class CSOSetProperties. -/*! -// \file mlCSOSetProperties.cpp -// \author Reinhard Hameeteman / Olaf Konrad -// \date 2007-11-06 -// -// Set the properties of all cso in a list to a CSO value -*/ -//---------------------------------------------------------------------------------- - - -// Local includes -#include "mlCSOSetProperties.h" - -ML_START_NAMESPACE - - -//! Implements code for the runtime type system of the ML -ML_BASEOP_CLASS_SOURCE(CSOSetProperties, BaseOp); - -//---------------------------------------------------------------------------------- -//! Constructor -//---------------------------------------------------------------------------------- -CSOSetProperties::CSOSetProperties (void) - : BaseOp(0, 0) -{ - ML_TRACE_IN("CSOSetProperties::CSOSetProperties()") - - handleNotificationOff(); - FieldContainer* fieldC = getFieldContainer(); - ML_CHECK(fieldC); - - m_InputCSOList = NULL; - f_InputCSOList = fieldC->addBase("inputCSOList"); - f_InputCSOList->setBaseValue(m_InputCSOList); - - m_OutputCSOList = NULL; - ML_CHECK_NEW(m_OutputCSOList, CSOList()); - - (f_OutputCSOList = fieldC->addBase("outputCSOList"))->setBaseValue(m_OutputCSOList); - - (f_InputCSOString = fieldC->addString("inputCSOString"))->setStringValue(""); - - const char *inputMode[2] = {"CSO", "Group"}; - (f_InputMode = fieldC->addEnum("inputMode",inputMode,2))->setEnumValue( CSOINPUT ); - (f_InputGroupString = fieldC->addString("inputGroupString"))->setStringValue(""); - - (f_WorkDirectlyOnInputList = fieldC->addBool("workDirectlyOnInputList"))->setBoolValue(false); - - (f_ListenToFinishingNotifications = fieldC->addBool("listenToFinishingNotifications"))->setBoolValue(true); - (f_ListenToSelectionNotifications = fieldC->addBool("listenToSelectionNotifications"))->setBoolValue(true); - - (f_PassOnNotifications = fieldC->addBool("passOnNotifications"))->setBoolValue( false ); - - (f_AutoUpdate = fieldC->addBool( "autoUpdate"))->setBoolValue( false ); - f_Update = fieldC->addNotify("update"); - - f_GetPorperties = fieldC->addNotify("getProperties"); - - m_IsInNotificationCB = false; - m_IsNotifyingMyself = false; - - // CSO Properties fields - f_CSOComputeNormal = fieldC->addBool ("CSOComputeNormal"); - f_CSOLabel = fieldC->addString("CSOLabel"); - f_CSODescription = fieldC->addString("CSODescription"); - f_CSOCreatorId = fieldC->addInt ("CSOCreatorId"); - f_CSOIsSelected = fieldC->addBool ("CSOIsSelected"); - f_CSOClearSelection = fieldC->addBool ("CSOClearSelection"); - f_CSOLineWidth = fieldC->addFloat ("CSOLineWidth"); - f_CSOLineStyle = fieldC->addEnum ("CSOLineStyle", CSOList::sLineStyleModeStrings, 4); - f_CSOColor = fieldC->addColor ("CSOColor"); - f_CSOAlpha = fieldC->addFloat ("CSOAlpha"); - f_CSOTimePointIndex = fieldC->addInt ("CSOTimePointIndex"); - f_CSOVoxelWriteMode = fieldC->addEnum ("CSOVoxelWriteMode", CSOList::sVoxelWriteModeStrings, 4); - f_CSOVoxelWriteValue = fieldC->addFloat("CSOVoxelWriteValue"); - f_CSOShowState = fieldC->addBool ("CSOShowState"); - f_CSOVoxelizeState = fieldC->addBool ("CSOVoxelizeState"); - f_CSOEditableState = fieldC->addBool ("CSOEditableState"); - f_CSOMarkerMode = fieldC->addEnum ("CSOMarkerMode", CSOList::sMarkerModeStrings, 3); - f_CSOMarkerColor = fieldC->addColor("CSOMarkerColor"); - f_CSOMarkerAlpha = fieldC->addFloat("CSOMarkerAlpha"); - f_CSOMarkerSize = fieldC->addFloat("CSOMarkerSize"); - - // Group properties - f_GroupLabel = fieldC->addString("GroupLabel"); - f_GroupDescription = fieldC->addString("GroupDescription"); - f_GroupIsSelected = fieldC->addBool ("GroupIsSelected"); - f_GroupClearSelection = fieldC->addBool ("GroupClearSelection"); - f_GroupLineWidth = fieldC->addFloat ("GroupLineWidth"); - f_GroupLineStyle = fieldC->addEnum ("GroupLineStyle", CSOList::sLineStyleModeStrings, 4); - f_GroupColor = fieldC->addColor ("GroupColor"); - f_GroupAlpha = fieldC->addFloat ("GroupAlpha"); - f_GroupTimePointIndex = fieldC->addInt ("GroupTimePointIndex"); - f_GroupVoxelWriteMode = fieldC->addEnum ("GroupVoxelWriteMode", CSOList::sVoxelWriteModeStrings, 4); - f_GroupVoxelWriteValue = fieldC->addFloat ("GroupVoxelWriteValue"); - f_GroupShowState = fieldC->addBool ("GroupShowState"); - f_GroupVoxelizeState = fieldC->addBool ("GroupVoxelizeState"); - f_GroupEditableState = fieldC->addBool ("GroupEditableState"); - f_GroupMarkerMode = fieldC->addEnum ("GroupMarkerMode", CSOList::sMarkerModeStrings, 3); - f_GroupMarkerColor = fieldC->addColor ("GroupMarkerColor"); - f_GroupMarkerAlpha = fieldC->addFloat ("GroupMarkerAlpha"); - f_GroupMarkerSize = fieldC->addFloat ("GroupMarkerSize"); - f_GroupUseVisuals = fieldC->addBool ("GroupUseVisuals"); - f_GroupUseShowState = fieldC->addBool ("GroupUseShowState"); - f_GroupUseVoxelizeState = fieldC->addBool ("GroupUseVoxelizeState"); - f_GroupUseEditableState = fieldC->addBool ("GroupUseEditableState"); - f_GroupUseVoxelWrite = fieldC->addBool ("GroupUseVoxelWrite"); - f_GroupUseTimePointIndex = fieldC->addBool ("GroupUseTimePointIndex"); - f_GroupUseMarkerSettings = fieldC->addBool ("GroupUseMarkerSettings"); - f_GroupMaximumNumCSOs = fieldC->addInt ("GroupMaximumNumCSOs"); - f_GroupOverflowHandling = fieldC->addEnum ("GroupOverflowHandling", CSOGroupRules::sOverflowHandlingStrings, NUM_OVERFLOW_MODES ); - f_GroupRemoveFromGroupHandling = fieldC->addEnum ("GroupRemoveFromGroupHandling", CSOGroupRules::sRemoveHandlingStrings, NUM_REMOVE_MODES ); - f_GroupDeleteGroupCSOHandling = fieldC->addEnum ("GroupDeleteGroupCSOHandling", CSOGroupRules::sRemoveHandlingStrings, NUM_REMOVE_MODES ); - - // Set defaults - f_CSOComputeNormal->setBoolValue( false ); - f_CSOLabel->setStringValue(""); - f_CSODescription->setStringValue(""); - f_CSOCreatorId->setIntValue( 0 ); - f_CSOIsSelected->setBoolValue( false ); - f_CSOClearSelection->setBoolValue( false ); - f_CSOLineWidth->setFloatValue(1.0f); - f_CSOLineStyle->setEnumValue(LINE_STYLE_SOLID); - f_CSOColor->setColorValue(1,1,1); - f_CSOAlpha->setFloatValue(1); - f_CSOAlpha->setFloatMinValue(0); - f_CSOAlpha->setFloatMaxValue(1); - f_CSOTimePointIndex->setIntValue(0); - f_CSOVoxelWriteMode->setEnumValue(VOXEL_VALUE_MODULE); - f_CSOVoxelWriteValue->setFloatValue(1024); - f_CSOShowState->setBoolValue(true); - f_CSOVoxelizeState->setBoolValue(true); - f_CSOEditableState->setBoolValue(true); - f_CSOMarkerMode->setEnumValue(MARKER_DISPLAY_MODE_RECT); - f_CSOMarkerColor->setColorValue(0,1,0); - f_CSOMarkerAlpha->setFloatValue(1); - f_CSOMarkerSize->setFloatValue(3); - - f_GroupLabel->setStringValue(""); - f_GroupDescription->setStringValue(""); - f_GroupIsSelected->setBoolValue( false ); - f_GroupClearSelection->setBoolValue( false ); - f_GroupLineWidth->setFloatValue(1.0f); - f_GroupLineStyle->setEnumValue(LINE_STYLE_SOLID); - f_GroupColor->setColorValue(1,1,1); - f_GroupAlpha->setFloatValue(1); - f_GroupAlpha->setFloatMinValue(0); - f_GroupAlpha->setFloatMaxValue(1); - f_GroupTimePointIndex->setIntValue(0); - f_GroupVoxelWriteMode->setEnumValue(VOXEL_VALUE_MODULE); - f_GroupVoxelWriteValue->setFloatValue(1024); - f_GroupShowState->setBoolValue(true); - f_GroupVoxelizeState->setBoolValue(true); - f_GroupEditableState->setBoolValue(true); - f_GroupMarkerMode->setEnumValue(MARKER_DISPLAY_MODE_RECT); - f_GroupMarkerColor->setColorValue(0,1,0); - f_GroupMarkerAlpha->setFloatValue(1); - f_GroupMarkerSize->setFloatValue(3); - f_GroupUseVisuals->setBoolValue(false); - f_GroupUseShowState->setBoolValue(false); - f_GroupUseVoxelizeState->setBoolValue(false); - f_GroupUseEditableState->setBoolValue(false); - f_GroupUseVoxelWrite->setBoolValue(false); - f_GroupUseTimePointIndex ->setBoolValue(false); - f_GroupUseMarkerSettings ->setBoolValue(false); - f_GroupMaximumNumCSOs->setIntValue(0); - f_GroupOverflowHandling->setEnumValue( CSOGroupRules::getDefaultOverflowHandling() ); - f_GroupRemoveFromGroupHandling->setEnumValue( CSOGroupRules::getDefaultRemoveFromGroupHandling() ); - f_GroupDeleteGroupCSOHandling->setEnumValue( CSOGroupRules::getDefaultDeleteGroupCSOHandling() ); - - - //! Property selection - (f_SetCSOComputeNormal = fieldC->addBool( "setCSOComputeNormal" ))->setBoolValue( false ); - (f_SetCSOLabel = fieldC->addBool( "setCSOLabel" ))->setBoolValue( false ); - (f_SetCSODescription = fieldC->addBool( "setCSODescription" ))->setBoolValue( false ); - (f_SetCSOCreatorId = fieldC->addBool( "setCSOCreatorId" ))->setBoolValue( false ); - (f_SetCSOIsSelected = fieldC->addBool( "setCSOIsSelected" ))->setBoolValue( false ); - (f_SetCSOLineWidth = fieldC->addBool( "setCSOLineWidth" ))->setBoolValue( false ); - (f_SetCSOLineStyle = fieldC->addBool( "setCSOLineStyle" ))->setBoolValue( false ); - (f_SetCSOColor = fieldC->addBool( "setCSOColor" ))->setBoolValue( false ); - (f_SetCSOAlpha = fieldC->addBool( "setCSOAlpha" ))->setBoolValue( false ); - (f_SetCSOTimePointIndex = fieldC->addBool( "setCSOTimePointIndex" ))->setBoolValue( false ); - (f_SetCSOVoxelWriteMode = fieldC->addBool( "setCSOVoxelWriteMode" ))->setBoolValue( false ); - (f_SetCSOVoxelWriteValue = fieldC->addBool( "setCSOVoxelWriteValue" ))->setBoolValue( false ); - (f_SetCSOShowState = fieldC->addBool( "setCSOShowState" ))->setBoolValue( false ); - (f_SetCSOVoxelizeState = fieldC->addBool( "setCSOVoxelizeState" ))->setBoolValue( false ); - (f_SetCSOEditableState = fieldC->addBool( "setCSOEditableState" ))->setBoolValue( false ); - (f_SetCSOMarkerMode = fieldC->addBool( "setCSOMarkerMode" ))->setBoolValue( false ); - (f_SetCSOMarkerColor = fieldC->addBool( "setCSOMarkerColor" ))->setBoolValue( false ); - (f_SetCSOMarkerAlpha = fieldC->addBool( "setCSOMarkerAlpha" ))->setBoolValue( false ); - (f_SetCSOMarkerSize = fieldC->addBool( "setCSOMarkerSize" ))->setBoolValue( false ); - - (f_SetGroupLabel = fieldC->addBool( "setGroupLabel" ))->setBoolValue( false ); - (f_SetGroupDescription = fieldC->addBool( "setGroupDescription" ))->setBoolValue( false ); - (f_SetGroupIsSelected = fieldC->addBool( "setGroupIsSelected" ))->setBoolValue( false ); - (f_SetGroupLineWidth = fieldC->addBool( "setGroupLineWidth" ))->setBoolValue( false ); - (f_SetGroupLineStyle = fieldC->addBool( "setGroupLineStyle" ))->setBoolValue( false ); - (f_SetGroupColor = fieldC->addBool( "setGroupColor" ))->setBoolValue( false ); - (f_SetGroupAlpha = fieldC->addBool( "setGroupAlpha" ))->setBoolValue( false ); - (f_SetGroupTimePointIndex = fieldC->addBool( "setGroupTimePointIndex" ))->setBoolValue( false ); - (f_SetGroupVoxelWriteMode = fieldC->addBool( "setGroupVoxelWriteMode" ))->setBoolValue( false ); - (f_SetGroupVoxelWriteValue = fieldC->addBool( "setGroupVoxelWriteValue" ))->setBoolValue( false ); - (f_SetGroupShowState = fieldC->addBool( "setGroupShowState" ))->setBoolValue( false ); - (f_SetGroupVoxelizeState = fieldC->addBool( "setGroupVoxelizeState" ))->setBoolValue( false ); - (f_SetGroupEditableState = fieldC->addBool( "setGroupEditableState" ))->setBoolValue( false ); - (f_SetGroupMarkerMode = fieldC->addBool( "setGroupMarkerMode" ))->setBoolValue( false ); - (f_SetGroupMarkerColor = fieldC->addBool( "setGroupMarkerColor" ))->setBoolValue( false ); - (f_SetGroupMarkerAlpha = fieldC->addBool( "setGroupMarkerAlpha" ))->setBoolValue( false ); - (f_SetGroupMarkerSize = fieldC->addBool( "setGroupMarkerSize" ))->setBoolValue( false ); - (f_SetGroupUseVisuals = fieldC->addBool( "setGroupUseVisuals" ))->setBoolValue( false ); - (f_SetGroupUseShowState = fieldC->addBool( "setGroupUseShowState" ))->setBoolValue( false ); - (f_SetGroupUseVoxelizeState = fieldC->addBool( "setGroupUseVoxelizeState" ))->setBoolValue( false ); - (f_SetGroupUseEditableState = fieldC->addBool( "setGroupUseEditableState" ))->setBoolValue( false ); - (f_SetGroupUseTimePointIndex = fieldC->addBool( "setGroupUseTimePointIndex" ))->setBoolValue( false ); - (f_SetGroupUseVoxelWrite = fieldC->addBool( "setGroupUseVoxelWrite" ))->setBoolValue( false ); - (f_SetGroupUseMarkerSettings = fieldC->addBool( "setGroupUseMarkerSettings" ))->setBoolValue( false ); - (f_SetGroupMaximumNumCSOs = fieldC->addBool( "setGroupMaximumNumCSOs" ))->setBoolValue( false ); - (f_SetGroupOverflowHandling = fieldC->addBool( "setGroupOverflowHandling" ))->setBoolValue( false ); - (f_SetGroupRemoveFromGroupHandling = fieldC->addBool( "setGroupRemoveFromGroupHandling" ))->setBoolValue( false ); - (f_SetGroupDeleteGroupCSOHandling = fieldC->addBool( "setGroupDeleteGroupCSOHandling" ))->setBoolValue( false ); - - handleNotificationOn(); - -} -CSOSetProperties::~CSOSetProperties() -{ - ML_TRACE_IN("CSOSetProperties::~CSOSetProperties()"); - - if (m_InputCSOList != NULL){ - m_InputCSOList->removeNotificationObserver(CSOListNotifyObserverCB, this); - } - if (!f_WorkDirectlyOnInputList->getBoolValue()){ - ML_DELETE(m_OutputCSOList); - } -} - - -//---------------------------------------------------------------------------------- -//! Handle field changes of the field \c field. -//---------------------------------------------------------------------------------- -void CSOSetProperties::handleNotification (Field *field) -{ - ML_TRACE_IN("CSOSetProperties::handleNotification()"); - - // f_InputCSOList - if ( field == f_InputCSOList ){ - if ( f_AutoUpdate->getBoolValue() ){ - SetProperties(true); - } - } else - - // f_InputCSOString - if (field == f_InputCSOString){ - if ( f_AutoUpdate->getBoolValue() ){ - SetProperties(true); - } - } else - - //f_WorkDirectlyOnInputList - if (field == f_WorkDirectlyOnInputList){ - if ( f_AutoUpdate->getBoolValue() ){ - bool hasChangedToOn = f_WorkDirectlyOnInputList->getBoolValue(); - if (m_InputCSOList != NULL){ - if (hasChangedToOn){ - ML_DELETE(m_OutputCSOList); - m_OutputCSOList = m_InputCSOList; - } else { - ML_CHECK_NEW(m_OutputCSOList, CSOList(*m_InputCSOList)); - } - } else { // no input, nothing to put out - if (hasChangedToOn){ - if (m_OutputCSOList != NULL){ - ML_DELETE(m_OutputCSOList); - } - } - m_OutputCSOList = NULL; - } - f_OutputCSOList->setBaseValue(m_OutputCSOList); - SetProperties(false); - } - } else - - // f_Update - if (field == f_Update || f_AutoUpdate->getBoolValue() ){ - SetProperties(true); - } - - if (field == f_GetPorperties ){ - GetProperties(); - } -} - - -void CSOSetProperties::SetupInternalCSOList() -{ - ML_TRACE_IN("void CSOSetProperties::_setupInternalCSOList()"); - - bool workDirectlyOnInputCSOList = f_WorkDirectlyOnInputList->getBoolValue(); - - if (!m_IsInNotificationCB) { CSOList::removeNotificationObserverFromAllCSOLists(CSOListNotifyObserverCB, this); } - - if (BASE_IS_A((static_cast<Base*>(f_InputCSOList->getBaseValue())), CSOList)){ - m_InputCSOList = static_cast<CSOList*>(f_InputCSOList->getBaseValue()); - } else { - m_InputCSOList = NULL; - if (workDirectlyOnInputCSOList){ - m_OutputCSOList = NULL; - } else { - ML_DELETE(m_OutputCSOList); - m_OutputCSOList = NULL; - } - } - if (m_InputCSOList != NULL){ - if (!workDirectlyOnInputCSOList){ // make copy - ML_DELETE(m_OutputCSOList); - ML_CHECK_NEW(m_OutputCSOList, CSOList(*m_InputCSOList)); - } else { // use pointer - m_OutputCSOList = m_InputCSOList; - } - if (!m_IsInNotificationCB) { m_InputCSOList->addNotificationObserver(CSOListNotifyObserverCB, this); } - } - f_OutputCSOList->setBaseValue(m_OutputCSOList); -} - - - -void CSOSetProperties::ParseInputCSOString() -{ - ML_TRACE_IN("void CSOSetProperties::_parseInputCSOString()"); - - m_selectedCSOIds.clear(); - - if (m_OutputCSOList != NULL){ - std::string inputString = f_InputCSOString->getStringValue(); - if (inputString.length() > 0){ - int spaceSeparatorIndex = static_cast<int>(inputString.find(" ")); - - while (spaceSeparatorIndex != static_cast<int>(std::string::npos)){ - std::string currentItem = inputString.substr(0, spaceSeparatorIndex); - inputString = inputString.substr(spaceSeparatorIndex+1, inputString.length()-spaceSeparatorIndex); - spaceSeparatorIndex = static_cast<int>(inputString.find(" ")); - AddCSOId(currentItem); - } - AddCSOId(inputString); // adds the rest of the string (last element) - } - } -} - - -void CSOSetProperties::ParseInputGroupString() -{ - ML_TRACE_IN("void CSOSetProperties::_parseInputCSOString()"); - - m_selectedGroupIds.clear(); - - if (m_OutputCSOList != NULL){ - std::string inputString = f_InputGroupString->getStringValue(); - if (inputString.length() > 0){ - int spaceSeparatorIndex = static_cast<int>(inputString.find(" ")); - - while (spaceSeparatorIndex != static_cast<int>(std::string::npos)){ - std::string currentItem = inputString.substr(0, spaceSeparatorIndex); - inputString = inputString.substr(spaceSeparatorIndex+1, inputString.length()-spaceSeparatorIndex); - spaceSeparatorIndex = static_cast<int>(inputString.find(" ")); - AddGroupId(currentItem); - } - AddGroupId(inputString); // adds the rest of the string (last element) - } - } -} - - - -void CSOSetProperties::AddCSOId(const std::string& idString) -{ - ML_TRACE_IN_TC("void CSOSetProperties::AddCSOId(const std::string& idString)"); - - if (m_OutputCSOList != NULL){ - int currentId = 0; - std::stringstream strstream; - strstream << idString; - strstream >> currentId; - if ( currentId == -1 ) { - m_selectedCSOIds.clear(); - unsigned int nCSO = m_OutputCSOList->numCSO(); - for ( unsigned int iCSO=0; iCSO < nCSO; ++iCSO ){ - m_selectedCSOIds.push_back( m_OutputCSOList->getCSOAt( iCSO )->getId() ); - } - } else { - CSO* testCSOPointer = m_OutputCSOList->getCSOById(currentId); - if (testCSOPointer != NULL){ - m_selectedCSOIds.push_back(currentId); - } - } - } -} - - -void CSOSetProperties::AddGroupId(const std::string& idString) -{ - ML_TRACE_IN_TC("void CSOSetProperties::AddGroupId(const std::string& idString)"); - - if (m_OutputCSOList != NULL){ - int currentId = 0; - std::stringstream strstream; - strstream << idString; - strstream >> currentId; - if ( currentId == -1 ) { - m_selectedGroupIds.clear(); - unsigned int nGroups = m_OutputCSOList->numGroups(); - for ( unsigned int iGroup=0; iGroup < nGroups; ++iGroup ){ - m_selectedGroupIds.push_back( m_OutputCSOList->getGroupAt( iGroup )->getId() ); - } - } else { - CSOGroup* testGroupPointer = m_OutputCSOList->getGroupById(currentId); - if (testGroupPointer != NULL){ - m_selectedGroupIds.push_back(currentId); - } - } - } -} - -void CSOSetProperties::SetProperties(bool shouldSetupInternalCSOList) -{ - this->SetProperties(shouldSetupInternalCSOList, 0 ); -} - -void CSOSetProperties::SetProperties(bool shouldSetupInternalCSOList, int notificationFlag) -{ - if (shouldSetupInternalCSOList){ - SetupInternalCSOList(); - } - if (m_OutputCSOList != NULL){ - - switch ( f_InputMode->getEnumValue() ){ - case CSOINPUT: - { - ParseInputCSOString(); - if ( f_CSOClearSelection->getBoolValue() && f_SetCSOIsSelected->getBoolValue() ){ - m_OutputCSOList->clearSelectedCSOs(); - notificationFlag |= CSOList::NOTIFICATION_CSO_SELECTION; - } - - for (unsigned int i = 0; i < m_selectedCSOIds.size(); i++){ - const unsigned int currentId = m_selectedCSOIds[i]; - CSO* currentCSO = m_OutputCSOList->getCSOById(currentId); - - // Common - if ( f_SetCSOLabel->getBoolValue() ) { currentCSO->setLabel( f_CSOLabel->getStringValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } - if ( f_SetCSODescription->getBoolValue() ) { currentCSO->setDescription( f_CSODescription->getStringValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } - if ( f_SetCSOCreatorId->getBoolValue() ) { currentCSO->setCreatorId( f_CSOCreatorId->getIntValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } - if ( f_SetCSOTimePointIndex->getBoolValue() ) { currentCSO->setTimePointIndex( f_CSOTimePointIndex->getIntValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } - - if ( f_SetCSOIsSelected->getBoolValue() ) { - CSOList *currentList = currentCSO->getCSOList(); - if (currentList->isSelected(currentCSO) != f_CSOIsSelected->getBoolValue() ){ - notificationFlag |= CSOList::NOTIFICATION_CSO_SELECTION; - } - if ( f_CSOIsSelected->getBoolValue() ){ - currentCSO->getCSOList()->addSelected(currentCSO); - } else { - currentCSO->getCSOList()->removeFromSelection( currentCSO ); - } - } - if ( f_SetCSOShowState->getBoolValue() ) { currentCSO->setShowState( f_CSOShowState->getBoolValue() ); notificationFlag |= CSOList::NOTIFICATION_REPAINT; } - if ( f_SetCSOVoxelizeState->getBoolValue() ) { currentCSO->setVoxelizeState( f_CSOVoxelizeState->getBoolValue() ); notificationFlag |= CSOList::NOTIFICATION_REPAINT; } - if ( f_SetCSOEditableState->getBoolValue() ) { currentCSO->setEditableState( f_CSOEditableState->getBoolValue() ); notificationFlag |= CSOList::NOTIFICATION_REPAINT; } - - if ( f_SetCSOComputeNormal->getBoolValue() && - f_CSOComputeNormal->getBoolValue() ){ - currentCSO->pathChanged(); - currentCSO->invalidatePlaneNormal(); - currentCSO->computePlaneNormal(); - notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; - } - - // PathPoints - if ( f_SetCSOLineStyle->getBoolValue() ) { currentCSO->setLineStyle( static_cast<CSOLineStyle>(f_CSOLineStyle->getEnumValue()) ); notificationFlag |= CSOList::NOTIFICATION_REPAINT; } - if ( f_SetCSOLineWidth->getBoolValue() ) { currentCSO->setLineWidth( f_CSOLineWidth->getFloatValue() ); notificationFlag |= CSOList::NOTIFICATION_REPAINT; } - if ( f_SetCSOColor->getBoolValue() ) { currentCSO->setColor( f_CSOColor->getVec3fValue() ); notificationFlag |= CSOList::NOTIFICATION_REPAINT; } - if ( f_SetCSOAlpha->getBoolValue() ) { currentCSO->setAlpha( f_CSOAlpha->getFloatValue() ); notificationFlag |= CSOList::NOTIFICATION_REPAINT; } - - // Markers - if... [truncated message content] |
From: <ehj...@us...> - 2011-06-03 11:54:35
|
Revision: 353 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=353&view=rev Author: ehjvoormolen Date: 2011-06-03 11:54:30 +0000 (Fri, 03 Jun 2011) Log Message: ----------- Added Paths: ----------- trun/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-04-01 09:53:15
|
Revision: 352 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=352&view=rev Author: rhameeteman Date: 2011-04-01 09:53:08 +0000 (Fri, 01 Apr 2011) Log Message: ----------- KH. * Added sync of the position and voxel value annotations Modified Paths: -------------- trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.mlab trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script Added Paths: ----------- trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.js trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.mlab trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.script Added: trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.js =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.js (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.js 2011-04-01 09:53:08 UTC (rev 352) @@ -0,0 +1,60 @@ +/* +// ----------------------------------------------------------------------- +// +// Copyright (c) 2001-2010, MeVis Medical Solutions AG, Bremen, Germany +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of MeVis Medical Solutions AG nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY MEVIS MEDICAL SOLUTIONS AG ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL MEVIS MEDICAL SOLUTIONS AG BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +//---------------------------------------------------------------------------------- +//! OrthoView2D +/*! +// \file OrthoView2D.js +// \date 04/2005 +*/ +//---------------------------------------------------------------------------------- + +function inventorInputOnChanged(field) +{ + var flag = !field.boolValue(); + ctx.field("inInvPreLUT").setHidden(flag); + ctx.field("inInvPostLUT").setHidden(flag); + ctx.field("inInvPostViewer").setHidden(flag); + ctx.updateLayout(); +} + +function toggleSynchPosition() +{ + var synchPosOn = ctx.field("synchronizePosition").value; + if (synchPosOn){ + ctx.field("view.worldPosition").connectFrom(ctx.field("pos.worldPosition")); + } else { + ctx.field("view.worldPosition").disconnect(); + } +} +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBANEfsmYse2e1dRhkQ9AQbreCq9uxwzWLoGom13MNYmyfwoJqQOEXljLFAgw2eEjaT12G4CdqKWhRxh9ANP6n7GMCARE=:VI/mB8bT4u+mRtf/ru8yUQi8BzpaS3UeL2x62YxsUYnVqCWuLrVNLiukIIjnJMKQXlc8ezmgOIcVAV7pgvgKpQ== +//# owner: MeVis +//# date: 2010-06-22T21:02:14 +//# hash: UuHPkd9Wz80h3TyHswq8XUQA7AVUjgFRVfpFDDK1hecJryxvL8zGvve+d2aaRLZ9qlFdsxbH9BOeHTWRPip82w== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.mlab 2011-04-01 09:53:08 UTC (rev 352) @@ -0,0 +1,707 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoToggle { + internal { + frame = "313 -271 128 64" + moduleGroupName = "" + windows { + window _default { + geometry = "939 618 116 22" + sizeHint = "56 22" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ShowAnnotations + whichChild = -3 + on = TRUE + } +} +module Arithmetic0 { + internal { + frame = "417 -107 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "1092 123 390 241" + sizeHint = "390 241" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Arithmetic0 + debugLevel = 0 + arg1 = "0 0 0" + arg1X = 0 + arg1XAsVec = FALSE + operation = Add + arg2 = "0 0 0" + arg2X = 0 + arg2XAsVec = FALSE + resultsAsPercent = FALSE + formatString = %.3f + resultY = 0 + resultZ = 0 + } +} +module BoolString { + internal { + frame = "437 -267 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "917 727 200 194" + sizeHint = "200 194" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = BoolString + boolValue = FALSE + stringValue = World + offValue = World + onValue = Voxel + defaultBool = Unchanged + } + internalFields = "" +} +module FieldBypass { + internal { + frame = "557 -107 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "789 717 190 288" + sizeHint = "190 288" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FieldBypass + inputString0 = 0.000 + inputString1 = "0 0 0" + inputString2 = "" + inputString3 = "" + inputString4 = "" + inputNumber = 0 + outputString = 0.000 + noBypass = FALSE + onlyIfChanged = TRUE + } +} +module WorldVoxelConvert { + internal { + frame = "709 -203 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "1384 430 414 234" + sizeHint = "414 234" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WorldVoxelConvert + voxelX = 0 + voxelY = 0 + voxelZ = 0 + worldX = 0 + worldY = 0 + worldZ = 0 + voxelPos = "0 0 0" + worldPos = "0 0 0" + voxelMode = FALSE + worldMode = TRUE + intVoxelCoords = TRUE + keepConstant = World + } +} +module StringUtils { + internal { + frame = "553 13 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "1154 461 370 331" + sizeHint = "234 174" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StringUtils1 + operationType = FormatFloat + string1 = 0 + string2 = "" + string3 = "" + string4 = "" + string5 = "" + string6 = "" + stringPrefix = [ + stringPostfix = ] + toggle1 = TRUE + toggle2 = TRUE + toggle3 = FALSE + toggle4 = FALSE + toggle5 = FALSE + toggle6 = FALSE + togglePrefix = FALSE + togglePostfix = FALSE + separator = "" + selectSeparator = 0 + toggleIgnoreCase = FALSE + inPos1 = 3 + inPos2 = 0 + } +} +module StringUtils { + internal { + frame = "557 -43 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "1154 461 370 331" + sizeHint = "234 174" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StringUtils + operationType = FormatFloat + string1 = 0 + string2 = "" + string3 = "" + string4 = "" + string5 = "" + string6 = "" + stringPrefix = [ + stringPostfix = ] + toggle1 = TRUE + toggle2 = TRUE + toggle3 = FALSE + toggle4 = FALSE + toggle5 = FALSE + toggle6 = FALSE + togglePrefix = FALSE + togglePostfix = FALSE + separator = "" + selectSeparator = 0 + toggleIgnoreCase = FALSE + inPos1 = 3 + inPos2 = 0 + } +} +module GetVoxelValue { + internal { + frame = "729 -19 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "345 553 296 278" + sizeHint = "296 278" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = GetVoxelValue + position = "0 0 0 0 0 0" + updateMode = AutoClear + coordinateType = World + } +} +module SoView2DAnnotation { + internal { + frame = "301 -23 152 64" + moduleGroupName = "" + windows { + window _default { + geometry = "748 66 595 517" + sizeHint = "595 517" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = Annotations + drawingOn = TRUE + editingOn = TRUE + maskValid = TRUE + fixZOn = TRUE + color = "0.899999976158142 0.899999976158142 0.899999976158142" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + annotationMode = ANNO_MODE_AUTO + showOrientation = ANNO_ORIENTATION_SIZE_WEIGHTED + drawNegativeOrientation = TRUE + drawPositiveOrientation = FALSE + verticalRuler = TRUE + horizontalRuler = FALSE + verticalRulerMarginRight = 8 + horizontalRulerMarginBottom = 8 + showTechnicalInfo = FALSE + showAnnotation = ANNO_SHOW_SHORT + annotationFontSize = ANNO_SIZE_SMALL + minDetailFontSize = 10 + maxDetailFontSize = 18 + minShortFontSize = 8 + maxShortFontSize = 12 + userDetailFontSize = 12 + userShortFontSize = 10 + textShadow = TRUE + annotationUserTopLeft = "$(PatientsName) +$(PatientID) $(PatientsSex) +$(PatientsBirthDate) +($(input00)): $(input01) GV" + annotationUserTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality)" + annotationUserBottomLeft = "slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription)" + annotationUserBottomRight = "User Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input03) / $(input04)" + annotationCTTopLeft = "$(PatientsName) +$(PatientsBirthDate) $(PatientsSex) +$(PatientID) +($(input00)): +$(input02) $(input09)" + annotationCTTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality) " + annotationCTBottomLeft = "Slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription) +$(ImageComments)" + annotationCTBottomRight = "CT Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input05) / $(input06)" + annotationMRTopLeft = "$(PatientsName) +$(PatientsBirthDate) $(PatientsSex) +$(PatientID) +($(input00)): +$(input01) GV" + annotationMRTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality)" + annotationMRBottomLeft = "Slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription) +$(ImageComments)" + annotationMRBottomRight = "MR Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input03) / $(input04)" + shortTopLeft = "$(PatientsName) +($(input00)): + $(input01) GV" + shortTopRight = $(Modality) + shortBottomLeft = "Slice: $(slice)" + shortBottomRight = "LUT C/W: $(input03) / $(input04)" + abreviateChars = -1 + abreviateShortChars = 16 + input00 = 0.000 + input01 = 0.000 + input02 = 0.000 + input03 = 1145.00012207 + input04 = 3671.00024414 + input05 = 1145.00012207 + input06 = 3671.00024414 + input07 = 1145.00012207 + input08 = 3671.00024414 + input09 = HU + fontWidthDummyString = "" + targetWidth = 0 + targetHeight = 0 + drawBackgroundBox = FALSE + backgroundColor = "0.200000002980232 0.200000002980232 0.699999988079071" + backgroundOpacity = 0.5 + backgroundEdgeColor = "0.200000002980232 0.200000002980232 0.699999988079071" + backgroundEdgeOpacity = 0.5 + } +} +module SoGroup { + internal { + frame = "717 -311 120 64" + moduleGroupName = "" + } + fields { + instanceName = invPostViewerIn + } +} +module SoGroup { + internal { + frame = "181 -207 104 64" + moduleGroupName = "" + } + fields { + instanceName = invPostLUTIn + } +} +module SoGroup { + internal { + frame = "-43 -311 104 64" + moduleGroupName = "" + } + fields { + instanceName = invPreLUTIn + } +} +module SoOrthoView2D { + internal { + frame = "581 -271 120 64" + moduleGroupName = "" + windows { + window _default { + geometry = "789 321 357 616" + sizeHint = "357 616" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = view + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + worldPosition = "0 0 0" + blendMode = BLEND_REPLACE + filterMode = FILTER_LINEAR + lutMode = LUT_BEST + slab = 1 + layoutMode = LAYOUT_CUBE_EQUAL + worldPosSticky = FALSE + snapToCenter = FALSE + drawImageData = TRUE + alphaFactor = 1 + baseColor = "1 1 1" + synchronizeZoom = TRUE + sliceZoom = 1 + minSliceZoomKeyboard = 1 + sliceOrigin1 = "0 0" + sliceOrigin2 = "0 0" + sliceOrigin3 = "0 0" + synchronizePanning = FALSE + keepSlicesInView = FALSE + viewingCenter = "-1 -1 -1" + viewingCenter1 = "0 0 0" + viewingCenter2 = "0 0 0" + viewingCenter3 = "0 0 0" + invertKeyPanningDirections = FALSE + extraViewSpace = TRUE + extraViewLowerLeft = "0 0.5" + extraViewUpperRight = "0.5 1" + extraViewSize = "0.666000008583069 0.666000008583069" + margin = "2 2" + alternCubeLayout = FALSE + cacheMode = SLICE_CACHING_OFF + timePoint = 0 + maxTimePoint = 0 + status = "Nothing active" + zoomMode = VIEW2D_AUTO_ZOOM + zoomModeParameter = 1 + sliceStep1 = 1 + sliceStep2 = 1 + sliceStep3 = 1 + numSlices1 = 1 + numSlices2 = 1 + numSlices3 = 1 + numXSlices1 = 1 + numXSlices2 = 1 + numXSlices3 = 1 + synchronizeFilterMode = TRUE + cineCenterT = 0 + cineIntervalT = 0 + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1 + cineFullRangeT = TRUE + cineAlwaysReset = TRUE + useGlobalInputImage = TRUE + } +} +module SoView2DPosition { + internal { + frame = "405 -207 136 64" + moduleGroupName = "" + windows { + window _default { + geometry = "114 175 446 713" + sizeHint = "446 713" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = pos + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 0.866728007793427 0.291404008865356" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = FALSE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + worldPosition = "0 0 0" + firstSliceWorldPosition = "-1 -1 -1" + drawingModel = DRAWINGMODEL_CROSSHAIRS + drawingModelSize = -1 + crossHairSpacing = 0 + drawEditingRect = TRUE + blendOnto = 1 + blendOutside = 0 + lineWidth = 1 + colorAxes = FALSE + sagittalColor = "1 0 0" + coronalColor = "0.172548994421959 0.886274993419647 0.011765000410378" + axialColor = "0.00784299988299608 0.952941000461578 0.968626976013184" + updateOnPress = TRUE + updateOnMotion = TRUE + updateOnRelease = TRUE + cooperative = FALSE + colorBorder = FALSE + colorBorderWidth = 2 + } +} +module SoSeparator { + internal { + frame = "257 -415 240 64" + moduleGroupName = "" + windows { + window _viewer { + geometry = "92 146 848 598" + sizeHint = "400 402" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = scene + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module View2DExtensions { + internal { + frame = "77 -271 136 64" + moduleGroupName = "" + windows { + window _default { + geometry = "92 146 666 711" + sizeHint = "666 711" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ext + slicerOn = TRUE + zoomOn = TRUE + panOn = TRUE + autoCenterOn = TRUE + position = "4.90752983093262 -60.5802993774414 30.5750999450684" + positionMode = Off + lutOn = TRUE + lutMouseOn = TRUE + lutMouseButton1 = RELEASED + lutMouseButton2 = RELEASED + lutMouseButton3 = PRESSED + lutMouseShift = RELEASED + lutMouseCtrl = RELEASED + lutRangeMin = 0 + lutRangeMax = 1 + lutAlphaSync = TRUE + lutGreyCenter = 0.39250001 + lutGreyWidth = 0.80250001 + lutAlphaCenter = 0.39250001 + lutAlphaWidth = 0.80250001 + lutColorFactor = "1 1 1" + lutAlphaFactor = 1 + lutAutoDefault = TRUE + lutSetInputMinMax = TRUE + lutUseTraceColors = FALSE + lutEnableNegWidth = FALSE + lutSetDefaultOnce = TRUE + lutTrCol0 = "1 1 1" + lutTrCol1 = "0.50196099281311 0.50196099281311 0.50196099281311" + lutTrCol2 = "0.862744987010956 0 0.172548994421959" + lutTrCol3 = "1 0.462745010852814 0.490195989608765" + lutTrCol4 = "0 0.819607973098755 0.160784006118774" + lutTrCol5 = "0.560783982276917 1 0.43529400229454" + lutTrCol6 = "0.184313997626305 0.23921599984169 0.929412007331848" + lutTrCol7 = "0.490195989608765 0.541176021099091 1" + lutTrCol8 = "0.63137298822403 0 0.67843097448349" + lutTrCol9 = "0.894118010997772 0.380391985177994 1" + lutTrColA = "0 0.682353019714355 0.756862998008728" + lutTrColB = "0.50196099281311 1 0.980391979217529" + lutTrColC = "0.615685999393463 0.600000023841858 0.19607800245285" + lutTrColD = "1 0.97647100687027 0.36862701177597" + lutTrColE = "1 1 1" + lutTrColF = "1 1 1" + annotationOn = FALSE + annoCoords = World + annoCTValue = ToHounsfield + valueHighPrecision = TRUE + maxPrecision = 4 + annotFontSize = ANNO_SIZE_AUTO + annotShowOrientation = ANNO_ORIENTATION_SIZE_WEIGHTED + annotVerticalRuler = TRUE + annotHorizontalRuler = FALSE + annotationCol = "0.899999976158142 0.899999976158142 0.899999976158142" + annotationMode = ANNO_MODE_AUTO + annotShowAnnot = ANNO_SHOW_DETAILED + annotUserTopLeft = "$(PatientsName) +$(PatientID) $(PatientsSex) +$(PatientsBirthDate) +($(input00)): $(input01) GV" + annotUserTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality)" + annotUserBottomLeft = "slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription)" + annotUserBottomRight = "User Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input03) / $(input04)" + annotShortTopLeft = "$(PatientsName) +($(input00)): + $(input01) GV" + annotShortTopRight = $(Modality) + annotShortBottomLeft = "Slice: $(slice)" + annotShortBottomRight = "LUT C/W: $(input03) / $(input04)" + annotMRTopLeft = "$(PatientsName) +$(PatientsBirthDate) $(PatientsSex) +$(PatientID) +($(input00)): +$(input01) GV" + annotMRTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality)" + annotMRBottomLeft = "Slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription) +$(ImageComments)" + annotMRBottomRight = "MR Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input03) / $(input04)" + annotCTTopLeft = "$(PatientsName) +$(PatientsBirthDate) $(PatientsSex) +$(PatientID) +($(input00)): +$(input02) $(input09)" + annotCTTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality) " + annotCTBottomLeft = "Slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription) +$(ImageComments)" + annotCTBottomRight = "CT Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input07) / $(input08)" + annoInput03 = 0.3925 + annoInput04 = 0.8025 + annoInput05 = 0.392500013113022 + annoInput06 = 0.802500009536743 + annoInput07 = 0.392500013113022 + annoInput08 = 0.802500009536743 + annoInput09 = HU + annoMouseOn = TRUE + annoReadPixFloorPos = "212 1 72" + annoReadPixVoxelPos = "122.371002197266 73.1424026489258 24.5" + annoReadPixWorldPos = "56.5396995544434 -53.665699005127 43.5141983032227" + borderOn = TRUE + borderColor = "0.899999976158142 0.899999976158142 0.899999976158142" + borderWidth = 1 + borderEvaluateFocus = FALSE + borderFocusColor = "1 1 1" + borderFocusWidth = 2 + mouseGrabberMode = FALSE + } + internalFields = "" +} +connections { + ShowAnnotations.children = Annotations.self + Arithmetic0.arg1 = pos.worldPosition + BoolString.stringValue = ext.annoCoords + FieldBypass.inputString0 = Arithmetic0.resultString + FieldBypass.inputString1 = WorldVoxelConvert.voxelPos + FieldBypass.inputNumber = BoolString.boolValue + WorldVoxelConvert.worldPos = pos.worldPosition + StringUtils1.string1 = GetVoxelValue.outputValue + StringUtils.string1 = GetVoxelValue.storedValue + GetVoxelValue.position = pos.worldPosition + Annotations.input00 = FieldBypass.outputString + Annotations.input01 = StringUtils.result + Annotations.input02 = StringUtils1.result + view.worldPosition = pos.worldPosition + pos.worldPosition = view.worldPosition + pos.colorAxes = pos.colorBorder + scene.children = "invPreLUTIn.self ext.outNode invPostLUTIn.self ShowAnnotations.self pos.self view.self invPostViewerIn.self" +} +networkModel = "" Added: trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.script =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.script (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/CustomOrthoView2D.script 2011-04-01 09:53:08 UTC (rev 352) @@ -0,0 +1,191 @@ +/* +// ----------------------------------------------------------------------- +// +// Copyright (c) 2001-2010, MeVis Medical Solutions AG, Bremen, Germany +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of MeVis Medical Solutions AG nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY MEVIS MEDICAL SOLUTIONS AG ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL MEVIS MEDICAL SOLUTIONS AG BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +//---------------------------------------------------------------------------------- +//! CustomOrthoView2D +/*! +// \file CustomOrthoView2D.script +// \author Jan Rexilius, Reinhard Hameeteman +// \date 04/2004 +*/ +//---------------------------------------------------------------------------------- + +Interface { + Inputs { + Field image { internalName = view.inputImage } + Field image { internalName = ext.inLUT } + Field image { internalName = GetVoxelValue.input0 } + Field image { internalName = WorldVoxelConvert.input0 } + Field inInvPreLUT { + internalName = invPreLUTIn.child + hidden = yes + comment = "Before LUT and viewer inventor input, +e.g. for overlays independent of LUT settings" + } + Field inInvPostLUT { + internalName = invPostLUTIn.child + hidden = yes + comment = "Between LUT and viewer inventor input" + } + Field inInvPostViewer { + internalName = invPostViewerIn.child + hidden = yes + comment = "Behind viewer inventor input, +e.g. for diagram overlays" + } + } + Outputs { + Field self { internalName = scene.self hidden = yes } + } + Parameters { + Field inventorInputOn { type = bool value = false } + Field layout { internalName = view.layoutMode } + Field filterMode { internalName = view.filterMode } + Field synchronizeZoom { internalName = view.synchronizeZoom } + Field synchronizePanning { internalName = view.synchronizePanning } + Field synchronizePosition { type = bool value = true } + Field useGlobalInputImage { internalName = view.useGlobalInputImage } + Field snapToCenter { internalName = view.snapToCenter } + Field alternCubeLayout { internalName = view.alternCubeLayout } + Field timePoint { internalName = view.timePoint } + + Field borderOn { internalName = ext.borderOn } + Field borderColor { internalName = ext.borderColor } + Field greyWidth { internalName = ext.lutGreyWidth } + Field greyCenter { internalName = ext.lutGreyCenter } + Field annotationOn { internalName = ShowAnnotations.on } + Field annotationSizeMode { internalName = Annotations.showAnnotation } + Field annotationFontSize { internalName = Annotations.annotationFontSize } + Field valueHighPrecision { internalName = ext.valueHighPrecision } + Field annoCoords { internalName = ext.annoCoords } + + Field unzoom { internalName = view.unzoom } + Field showCurrentPos { internalName = pos.drawingOn } + Field worldPosition { internalName = pos.worldPosition } + Field coloredMode { internalName = pos.colorBorder } + } // Parameters +} // Interface + +Commands { + source = $(LOCAL)/CustomOrthoView2D.js + + FieldListener inventorInputOn { + init = yes + command = inventorInputOnChanged + } + + FieldListener synchronizePosition { + init = Yes + command = toggleSynchPosition + } + + ContextMenu { + MenuItem "Show Inventor Inputs" { field = inventorInputOn } + MenuItem "Show Position Cursor" { field = showCurrentPos } + } // context menu +} // commands + + +Window "Viewer" { + Vertical { + expandX = yes + expandY = yes + Viewer self { + border = No + type = SoRenderArea + clone = no + } // viewer + } // Vertical +} // Window viewer + +Window "Settings" { + Category "Main" { + Box "Inventor Input" { + CheckBox inventorInputOn { title = "Inventor Input Fields" } + } // box inventor input + Box "Display" { + Field layout { title = "Layout:" } + CheckBox alternCubeLayout { title = "Altern. Cube Layout" } + } // box display + Box "Filter" { + Field filterMode { title = "Mode:" } + } // box filter + Box "LUT" { + Field greyCenter { title = "Center:" expandX = yes step = 16 } + Field greyWidth { title = "Width:" expandX = yes step = 16 } + } // box lut + Box "Synchronizing" { + Horizontal { + CheckBox synchronizeZoom { title = "Zoom" } + CheckBox synchronizePanning { title = "Pan." } + CheckBox synchronizePosition { title = "Pos." } + } // horizontal + } // box synchronizing + Box "Position" { + Field worldPosition { title = "Pos.:" } + CheckBox showCurrentPos { title = "Show" } + Field timePoint { title = "Time Point:" step = 1 } + + } // box position + } // category main + + Category "Misc." { + Box "Annotations" { + Horizontal { + alignX = left + expandX = NO + CheckBox annotationOn { title = "On" } + Field annotationSizeMode { title = "Mode:" dependsOn = annotationOn } + Field annotationFontSize { title = "Size:" dependsOn = annotationOn } + } // horizontal + Field annoCoords { title = "Current Pos. in:" } + } // box annotations + Box "Border" { + Horizontal { + alignX = left + expandX = NO + CheckBox borderOn { title = "On" } + Field borderColor { title = "Color:" dependsOn = borderOn } + } // horizontal + } // box annotations + Box "Misc." { + CheckBox useGlobalInputImage { title = "Use Global Input Image" } + CheckBox snapToCenter { title = "Snap To Center" } + CheckBox coloredMode { title = "Colored Mode" } + CheckBox valueHighPrecision { title = "Display value with high precision" } + } // box misc + + } // category misc +} // window settings + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBANEfsmYse2e1dRhkQ9AQbreCq9uxwzWLoGom13MNYmyfwoJqQOEXljLFAgw2eEjaT12G4CdqKWhRxh9ANP6n7GMCARE=:VI/mB8bT4u+mRtf/ru8yUQi8BzpaS3UeL2x62YxsUYnVqCWuLrVNLiukIIjnJMKQXlc8ezmgOIcVAV7pgvgKpQ== +//# owner: MeVis +//# date: 2010-06-22T21:02:14 +//# hash: kWgS+arVfhVsbcvyKgWj3kQhJrkM7w2Mq4g1h23eNg0Q4n7GAu0GIZHS6btBpzO1SRWzY+fGRHfVNiSWaZv90A== +//# MeVis end Modified: trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.mlab 2011-03-31 10:14:49 UTC (rev 351) +++ trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.mlab 2011-04-01 09:53:08 UTC (rev 352) @@ -2,6 +2,39 @@ network { watchlist = "" } +module CustomOrthoView2D { + internal { + frame = "21 341 152 56" + moduleGroupName = "" + localMacro = 1 + } + fields { + instanceName = CustomOrthoView2D0 + inventorInputOn = FALSE + layout = LAYOUT_CUBE_EQUAL + filterMode = FILTER_LINEAR + synchronizeZoom = TRUE + synchronizePanning = FALSE + synchronizePosition = TRUE + useGlobalInputImage = TRUE + snapToCenter = FALSE + alternCubeLayout = FALSE + timePoint = 0 + borderOn = TRUE + borderColor = "0.899999976158142 0.899999976158142 0.899999976158142" + greyWidth = 0.80250001 + greyCenter = 0.39250001 + annotationOn = TRUE + annotationSizeMode = ANNO_SHOW_SHORT + annotationFontSize = ANNO_SIZE_SMALL + valueHighPrecision = TRUE + annoCoords = World + showCurrentPos = TRUE + worldPosition = "0 0 0" + coloredMode = FALSE + } + internalFields = "" +} module SyncFields { internal { frame = "89 257 112 64" @@ -449,16 +482,16 @@ moduleGroupName = "" windows { window _default { - geometry = "618 170 183 201" - sizeHint = "183 201" - wasOpen = no + geometry = "455 147 183 434" + sizeHint = "183 434" + wasOpen = yes wasActive = no } } } fields { instanceName = SyncPos - mode = Vector + mode = MultiVector on = TRUE precision = 0.001000000047 float0 = 0 @@ -616,59 +649,8 @@ pickCulling = AUTO } } -module OrthoView2D { - internal { - frame = "29 341 120 56" - moduleGroupName = "" - windows { - window _automatic { - geometry = "968 229 292 440" - sizeHint = "292 440" - wasOpen = no - wasActive = no - } - window _default { - geometry = "28 28 400 431" - sizeHint = "400 431" - wasOpen = no - wasActive = no - } - window Settings { - geometry = "461 298 365 473" - sizeHint = "365 473" - wasOpen = no - wasActive = no - } - } - } - fields { - instanceName = OrthoView2D0 - inventorInputOn = TRUE - layout = LAYOUT_AXIAL - filterMode = FILTER_LINEAR - synchronizeZoom = TRUE - synchronizePanning = TRUE - synchronizePosition = TRUE - useGlobalInputImage = TRUE - snapToCenter = FALSE - alternCubeLayout = FALSE - timePoint = 0 - borderOn = TRUE - borderColor = "0.899999976158142 0.899999976158142 0.899999976158142" - greyWidth = 1 - greyCenter = 1 - annotationOn = TRUE - annotationSizeMode = ANNO_SHOW_DETAILED - annotationFontSize = ANNO_SIZE_AUTO - valueHighPrecision = FALSE - annoCoords = Voxel - showCurrentPos = TRUE - worldPosition = "0 0 0" - coloredMode = FALSE - } - internalFields = "" -} connections { + CustomOrthoView2D0.worldPosition = SyncPos.vector1 Switch.input0 = In0.output0 Switch.input1 = In1.output0 Switch.input2 = In2.output0 @@ -708,7 +690,5 @@ In3.noBypass = In2.noBypass In2.noBypass = In1.noBypass In1.noBypass = In0.noBypass - OrthoView2D0.image = In0.output0 - OrthoView2D0.worldPosition = SyncPos.vector2 } networkModel = "" Modified: trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py 2011-03-31 10:14:49 UTC (rev 351) +++ trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py 2011-04-01 09:53:08 UTC (rev 352) @@ -48,16 +48,16 @@ m_win = None #layoutTable = {1:[1,1],2:[1,2],3:[1,3],4:[2,2],5:[2,3]} - +#Viewer CustomOrthoView2D%nr%.self { preferredWidth = 400 preferredHeight = 400 border = No type = SoRenderArea expandY = Yes name = Viewer%nr%} \ viewerUnit = '\ Box { \ expandY = Yes\ %title% \ - Viewer OrthoView2D%nr%.self { border = No type = SoRenderArea expandY = Yes name = Viewer%nr%} \ + Panel { module = CustomOrthoView2D%nr% expandY = Yes name = Viewer%nr%} \ EventFilter { \ filter = KeyPress \ control = Viewer%nr% \ - command = @@py:if args[0][\'key\']==\'F\' : ctx.module(\'OrthoView2D%nr%\').showWindow(\'Settings\')@@ \ + command = @@py:if args[0][\'key\']==\'F\' : ctx.module(\'CustomOrthoView2D%nr%\').showWindow(\'Settings\')@@ \ } \ } \ ' @@ -73,8 +73,8 @@ def Init( arg = None ) : '''Because the numberOfInputs is presistent the GUI needs updating when the module is copied''' ctx.addMacroModuleFromString('Window{ Vertical {expandY = yes expandX = yes Vertical { Label { title = "" } } Box {pw = 400 ph = 400}}}') - ctx.field('OrthoView2D0.ext.borderOn').value = False - ctx.field('OrthoView2D0.ext.annotVerticalRuler').value = False + ctx.field('CustomOrthoView2D0.ext.borderOn').value = False + ctx.field('CustomOrthoView2D0.ext.annotVerticalRuler').value = False NumberOfInputChanged() return @@ -89,17 +89,17 @@ # turn off viewers ctx.field('In0.noBypass').value = True ctx.field('invInput0').disconnectOutputs() - ctx.field( 'OrthoView2D0.'+ ctx.field('singleInvInput').stringValue() ).connectFrom(ctx.field('invInput0') ) + ctx.field( 'CustomOrthoView2D0.'+ 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 + ctx.field("CustomOrthoView2D0.useGlobalInputImage").value = ctx.field("useGlobalInputImages").value + ctx.field("CustomOrthoView2D0.layout").value = ctx.field("viewerLayout").value # create the appropriate modules for iInput in range(1,nInputs) : - viewerModuleName = 'OrthoView2D'+str(iInput) + viewerModuleName = 'CustomOrthoView2D'+str(iInput) reformatModuleName = 'Reformat'+str(iInput) if ( not ctx.hasModule( viewerModuleName ) ) : - newViewerModule = ctx.addModule( 'OrthoView2D' ) + newViewerModule = ctx.addModule( 'CustomOrthoView2D' ) newViewerModule.field('instanceName').value = viewerModuleName if ( not ctx.hasModule( reformatModuleName ) ) : newReformatModule = ctx.addModule( 'Reformat' ) @@ -107,7 +107,7 @@ # Show the connectors and connect the Inventor inputs ctx.field( 'input'+str(iInput) ).setHidden( False ) ctx.field('invInput' + str(iInput)).disconnectOutputs() - ctx.field( 'OrthoView2D'+ str( iInput ) + '.' + ctx.field('singleInvInput').stringValue() ).connectFrom(ctx.field('invInput' + str(iInput))) + ctx.field( 'CustomOrthoView2D'+ str( iInput ) + '.' + ctx.field('singleInvInput').stringValue() ).connectFrom(ctx.field('invInput' + str(iInput))) # Set global input image option globalOption = viewerModuleName + ".useGlobalInputImage" @@ -118,13 +118,13 @@ 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+'.worldPosition' ).connectFrom( ctx.field('CustomOrthoView2D'+str(iInput-1)+'.worldPosition' )) + ctx.field( viewerModuleName+'.pos.blendOnto' ).connectFrom( ctx.field('CustomOrthoView2D'+str(iInput-1)+'.pos.blendOnto' )) + ctx.field( viewerModuleName+'.ext.annoCoords').connectFrom( ctx.field('CustomOrthoView2D'+str(iInput-1)+'.ext.annoCoords')) 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' ) ) - ctx.field( 'OrthoView2D0.worldPosition' ).connectFrom( ctx.field( 'SyncPos.vector1' ) ) + ctx.field( 'SyncPos.vector0' ).connectFrom( ctx.field( 'CustomOrthoView2D'+ str( nInputs-1 ) + '.worldPosition' ) ) + ctx.field( 'CustomOrthoView2D0.worldPosition' ).connectFrom( ctx.field( 'SyncPos.vector1' ) ) # remove unused modules and hide connections for iInput in range(nInputs,MaxInputs): @@ -132,7 +132,7 @@ ctx.field( 'input'+str(iInput) ).setHidden( True ) ctx.field( 'invInput'+str(iInput) ).disconnect() ctx.field( 'invInput'+str(iInput) ).setHidden( True ) - mod = ctx.module( 'OrthoView2D'+ str( iInput ) ) + mod = ctx.module( 'CustomOrthoView2D'+ str( iInput ) ) if mod is not None : ctx.network().removeModule( mod ) mod = ctx.module( 'Reformat'+ str( iInput ) ) @@ -160,6 +160,8 @@ for iInput in range(20) : if (iInput >= nInputs ): hide = True ctx.field( 'invInput'+str(iInput) ).setHidden( hide ) + #Not implemented yet + #ctx.field( 'globalInvInput').setHidden( hide ) ctx.updateLayout() return @@ -172,11 +174,11 @@ for i in range(nInputs) : input = 'input' + str(i) if ctx.field('reformat').value : - ctx.field( 'OrthoView2D'+ str( i ) + '.image').connectFrom(ctx.field('Reformat'+str(i)+'.output0') ) + ctx.field( 'CustomOrthoView2D'+ str( i ) + '.image').connectFrom(ctx.field('Reformat'+str(i)+'.output0') ) ctx.field( 'Reformat'+str(i)+'.input1').connectFrom( ctx.field('Switch.output0') ) ctx.field( 'Reformat'+str(i)+'.input0').connectFrom( ctx.field('In' + str(i) + '.output0') ) else : - ctx.field( 'OrthoView2D'+ str( i ) + '.image').connectFrom(ctx.field('In' + str(i) + '.output0')) + ctx.field( 'CustomOrthoView2D'+ str( i ) + '.image').connectFrom(ctx.field('In' + str(i) + '.output0')) if ctx.field('reformat').value : ctx.field('Switch.currentInput').value = ctx.field("referenceGrid").value ctx.field('In0.noBypass').value = False @@ -190,22 +192,22 @@ nInputs = ctx.field('numberOfInputs').value for i in range(1,nInputs) : if ( syncZoom ) : - ctx.field( 'OrthoView2D'+ str( i )+'.view.sliceZoom' ).connectFrom( ctx.field('OrthoView2D'+ str( i-1 ) + '.view.sliceZoom') ) + ctx.field( 'CustomOrthoView2D'+ str( i )+'.view.sliceZoom' ).connectFrom( ctx.field('CustomOrthoView2D'+ str( i-1 ) + '.view.sliceZoom') ) else : - ctx.field( 'OrthoView2D'+ str( i ) + '.view.sliceZoom').disconnectAll() + ctx.field( 'CustomOrthoView2D'+ str( i ) + '.view.sliceZoom').disconnectAll() if syncZoom : - ctx.field( 'SyncZoom.float0' ).connectFrom(ctx.field('OrthoView2D'+ str( nInputs-1 ) + '.view.sliceZoom')) - ctx.field( 'OrthoView2D0.view.sliceZoom').connectFrom( ctx.field('SyncZoom.float1') ) + ctx.field( 'SyncZoom.float0' ).connectFrom(ctx.field('CustomOrthoView2D'+ str( nInputs-1 ) + '.view.sliceZoom')) + ctx.field( 'CustomOrthoView2D0.view.sliceZoom').connectFrom( ctx.field('SyncZoom.float1') ) else : ctx.field( 'SyncZoom.float0' ).disconnectAll() - ctx.field( 'OrthoView2D0.view.sliceZoom').disconnectAll() + ctx.field( 'CustomOrthoView2D0.view.sliceZoom').disconnectAll() return def UnZoom(): nInputs = ctx.field('numberOfInputs').value for i in range(nInputs) : - ctx.field( 'OrthoView2D'+ str( i )+'.view.unzoom' ).touch() + ctx.field( 'CustomOrthoView2D'+ str( i )+'.view.unzoom' ).touch() return def SyncPanning( arg = None ) : @@ -216,18 +218,18 @@ for i in range(1,nInputs) : if ( syncZoom ) : for j in range(1,4) : - ctx.field( 'OrthoView2D'+ str( i )+'.view.viewingCenter' + str( j ) ).connectFrom( ctx.field('OrthoView2D'+ str( i-1 ) + '.view.viewingCenter' + str( j )) ) + ctx.field( 'CustomOrthoView2D'+ str( i )+'.view.viewingCenter' + str( j ) ).connectFrom( ctx.field('CustomOrthoView2D'+ str( i-1 ) + '.view.viewingCenter' + str( j )) ) else : for j in range(1,4) : - ctx.field( 'OrthoView2D'+ str( i ) + '.view.viewingCenter' + str( j ) ).disconnectAll() + ctx.field( 'CustomOrthoView2D'+ str( i ) + '.view.viewingCenter' + str( j ) ).disconnectAll() if syncZoom : for j in range(1,4) : - ctx.field( 'SyncPanning' + str( j ) + '.vector0' ).connectFrom(ctx.field('OrthoView2D'+ str( nInputs-1 ) + '.view.viewingCenter' + str( j ) )) - ctx.field( 'OrthoView2D0.view.viewingCenter' + str( j )).connectFrom( ctx.field('SyncPanning' + str( j ) +'.vector1') ) + ctx.field( 'SyncPanning' + str( j ) + '.vector0' ).connectFrom(ctx.field('CustomOrthoView2D'+ str( nInputs-1 ) + '.view.viewingCenter' + str( j ) )) + ctx.field( 'CustomOrthoView2D0.view.viewingCenter' + str( j )).connectFrom( ctx.field('SyncPanning' + str( j ) +'.vector1') ) else : for j in range(1,4) : ctx.field( 'SyncPanning' + str( j ) + '.vector0' ).disconnectAll() - ctx.field( 'OrthoView2D0.view.viewingCenter' + str( j ) ).disconnectAll() + ctx.field( 'CustomOrthoView2D0.view.viewingCenter' + str( j ) ).disconnectAll() return @@ -237,21 +239,21 @@ nInputs = ctx.field('numberOfInputs').value for i in range(1, nInputs ) : if ( syncLUT ) : - ctx.field( 'OrthoView2D'+str(i)+'.greyCenter' ).connectFrom( ctx.field('OrthoView2D'+str(i-1)+'.greyCenter' )) - ctx.field( 'OrthoView2D'+str(i)+'.greyWidth' ).connectFrom( ctx.field('OrthoView2D'+str(i-1)+'.greyWidth' )) + ctx.field( 'CustomOrthoView2D'+str(i)+'.greyCenter' ).connectFrom( ctx.field('CustomOrthoView2D'+str(i-1)+'.greyCenter' )) + ctx.field( 'CustomOrthoView2D'+str(i)+'.greyWidth' ).connectFrom( ctx.field('CustomOrthoView2D'+str(i-1)+'.greyWidth' )) else : - ctx.field( 'OrthoView2D'+str(i)+'.greyCenter').disconnectAll() - ctx.field( 'OrthoView2D'+str(i)+'.greyWidth' ).disconnectAll() + ctx.field( 'CustomOrthoView2D'+str(i)+'.greyCenter').disconnectAll() + ctx.field( 'CustomOrthoView2D'+str(i)+'.greyWidth' ).disconnectAll() if syncLUT : - ctx.field( 'SyncLUTCenter.float0' ).connectFrom( ctx.field('OrthoView2D'+str(nInputs-1)+'.greyCenter' )) - ctx.field( 'OrthoView2D0.greyCenter' ).connectFrom( ctx.field('SyncLUTCenter.float1' )) - ctx.field( 'SyncLUTWidth.float0' ).connectFrom( ctx.field('OrthoView2D'+str(nInputs-1)+'.greyWidth' )) - ctx.field( 'OrthoView2D0.greyWidth' ).connectFrom( ctx.field('SyncLUTWidth.float1' )) + ctx.field( 'SyncLUTCenter.float0' ).connectFrom( ctx.field('CustomOrthoView2D'+str(nInputs-1)+'.greyCenter' )) + ctx.field( 'CustomOrthoView2D0.greyCenter' ).connectFrom( ctx.field('SyncLUTCenter.float1' )) + ctx.field( 'SyncLUTWidth.float0' ).connectFrom( ctx.field('CustomOrthoView2D'+str(nInputs-1)+'.greyWidth' )) + ctx.field( 'CustomOrthoView2D0.greyWidth' ).connectFrom( ctx.field('SyncLUTWidth.float1' )) else : ctx.field( 'SyncLUTCenter.float0' ).disconnectAll() - ctx.field( 'OrthoView2D0.greyCenter' ).disconnectAll() + ctx.field( 'CustomOrthoView2D0.greyCenter' ).disconnectAll() ctx.field( 'SyncLUTWidth.float0' ).disconnectAll() - ctx.field( 'OrthoView2D0.greyWidth' ).disconnectAll() + ctx.field( 'CustomOrthoView2D0.greyWidth' ).disconnectAll() return @@ -261,15 +263,15 @@ nInputs = ctx.field('numberOfInputs').value for i in range(1,nInputs) : if ( syncTimepoints ) : - ctx.field( 'OrthoView2D'+ str( i )+'.view.timePoint' ).connectFrom( ctx.field('OrthoView2D'+str(i-1)+'.view.timePoint') ) + ctx.field( 'CustomOrthoView2D'+ str( i )+'.view.timePoint' ).connectFrom( ctx.field('CustomOrthoView2D'+str(i-1)+'.view.timePoint') ) else : - ctx.field( 'OrthoView2D'+ str( i ) + '.view.timePoint').disconnectAll() + ctx.field( 'CustomOrthoView2D'+ str( i ) + '.view.timePoint').disconnectAll() if ( syncTimepoints ) : - ctx.field( 'SyncTimepoints.float0' ).connectFrom( ctx.field('OrthoView2D'+str(nInputs-1)+'.view.timePoint') ) - ctx.field( 'OrthoView2D0.view.timePoint').connectFrom( ctx.field('SyncTimepoints.float1') ) + ctx.field( 'SyncTimepoints.float0' ).connectFrom( ctx.field('CustomOrthoView2D'+str(nInputs-1)+'.view.timePoint') ) + ctx.field( 'CustomOrthoView2D0.view.timePoint').connectFrom( ctx.field('SyncTimepoints.float1') ) else : ctx.field( 'SyncTimepoints.float0' ).disconnectAll() - ctx.field( 'OrthoView2D0.view.timePoint').disconnectAll() + ctx.field( 'CustomOrthoView2D0.view.timePoint').disconnectAll() return @@ -418,15 +420,15 @@ '''Toggle all annotations on and off''' #MLAB.log('ToggleAnnotation()') nInputs = ctx.field('numberOfInputs').value - currentValue = ctx.field('OrthoView2D0.annotationSizeMode').value - values = list( ctx.field('OrthoView2D0.annotationSizeMode').items() ) + currentValue = ctx.field('CustomOrthoView2D0.annotationSizeMode').value + values = list( ctx.field('CustomOrthoView2D0.annotationSizeMode').items() ) newValue = '' if ( currentValue == values[-1] ) : newValue = values[0] else : newValue = values[ values.index( currentValue)+1 ] for i in range( nInputs ) : - ctx.field('OrthoView2D' + str(i) + '.annotationSizeMode').value = newValue + ctx.field('CustomOrthoView2D' + str(i) + '.annotationSizeMode').value = newValue return # MeVis signature v1 Modified: trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script 2011-03-31 10:14:49 UTC (rev 351) +++ trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script 2011-04-01 09:53:08 UTC (rev 352) @@ -118,10 +118,10 @@ Field syncTimepoints { type = bool value = false } Field reformat { type = bool value = False } Field referenceGrid { type = int value = 0 } - Field worldPos { internalName = OrthoView2D0.worldPosition } - Field coordSystem { internalName = OrthoView2D0.ext.annoCoords } + Field worldPos { internalName = CustomOrthoView2D0.worldPosition } + Field coordSystem { internalName = CustomOrthoView2D0.ext.annoCoords } Field interpolationMethod { internalName = Reformat0.interpolation } - Field cursorAlpha { internalName = OrthoView2D0.pos.blendOnto } + Field cursorAlpha { internalName = CustomOrthoView2D0.pos.blendOnto } Field useGlobalInputImages { type = bool value = True } //Field titleString { type = string value = "input0,input1" } @@ -204,7 +204,8 @@ {nInputs:[rows,cols],nInputs:[rows,cols]}, e.g. {5:[3,2],10:[2,5]}*"} Field viewerLayout {} Field showInventorInputs {} - Field singleInvInput { dependsOn = showInventorInputs } + //Not implemented yet + //Field singleInvInput { dependsOn = showInventorInputs } Horizontal { alignX = Left Field syncZoom { alignGroup = g1 } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-03-31 10:14:58
|
Revision: 351 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=351&view=rev Author: rhameeteman Date: 2011-03-31 10:14:49 +0000 (Thu, 31 Mar 2011) Log Message: ----------- KH. * Added an option to reset all parameters of the selected module to their default values. * Fixed bug in update of module list Modified Paths: -------------- trunk/Community/General/Modules/Macros/Fields/CompareModules.py trunk/Community/General/Modules/Macros/Fields/CompareModules.script Modified: trunk/Community/General/Modules/Macros/Fields/CompareModules.py =================================================================== --- trunk/Community/General/Modules/Macros/Fields/CompareModules.py 2011-03-31 08:58:47 UTC (rev 350) +++ trunk/Community/General/Modules/Macros/Fields/CompareModules.py 2011-03-31 10:14:49 UTC (rev 351) @@ -112,6 +112,26 @@ if selection1Default and module1: module1.remove() return +def ResetToDefaults(): + selection0 = ctx.field("module0").value + selection1 = ctx.field("module1").value + selection0Default = (selection0 == "Defaults" ) + selection1Default = (selection1 == "Defaults" ) + if ( not( selection0Default ^ selection1Default)) : return + module = None + default = None + if not selection0Default : module = ctx.parent().module( selection0 ) + if not selection1Default : module = ctx.parent().module( selection1 ) + if module : + default = ctx.addModule( module.type() ) + if default : + pars = module.parameters() + for par in pars : + if TestField( module.field(par) ) : + module.field(par).setStringValue( default.field(par).stringValue() ) + Compare() + return + #//# MeVis signature v1 #//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== #//# owner: EMC Modified: trunk/Community/General/Modules/Macros/Fields/CompareModules.script =================================================================== --- trunk/Community/General/Modules/Macros/Fields/CompareModules.script 2011-03-31 08:58:47 UTC (rev 350) +++ trunk/Community/General/Modules/Macros/Fields/CompareModules.script 2011-03-31 10:14:49 UTC (rev 351) @@ -19,6 +19,7 @@ Field module1 { type = string value = "" } Field fields0 { type = string value = "" } Field fields1 { type = string value = "" } + Field reset { type = Trigger } } } @@ -40,9 +41,14 @@ } Button { title = "Update module list" - command = UpdateSelections + command = UpdateModuleList alignX = Left } + Button reset { + title = "Reset to defaults" + command = ResetToDefaults + alignX = Left + } } // Update Box Fields { @@ -61,6 +67,7 @@ activatedCommand = Compare } ListView fields0 { + name = listView0 rowSeparator = "@" columnSeparator = "&" selectionMode = NoSelection @@ -78,6 +85,7 @@ activatedCommand = Compare } ListView fields1 { + name = listView1 rowSeparator = "@" columnSeparator = "&" richText = Yes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-03-31 08:58:53
|
Revision: 350 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=350&view=rev Author: rhameeteman Date: 2011-03-31 08:58:47 +0000 (Thu, 31 Mar 2011) Log Message: ----------- KH. * Added the option to pass on incoming notifications. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-03-31 08:49:31 UTC (rev 349) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-03-31 08:58:47 UTC (rev 350) @@ -82,6 +82,7 @@ expandY = No CheckBox listenToFinishingNotifications { title = "Finishing" } CheckBox listenToSelectionNotifications { title = "Selection" } + CheckBox passOnNotifications {} } Box "Operation Mode" { Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-03-31 08:49:31 UTC (rev 349) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-03-31 08:58:47 UTC (rev 350) @@ -75,6 +75,8 @@ (f_ListenToFinishingNotifications = fieldC->addBool("listenToFinishingNotifications"))->setBoolValue(true); (f_ListenToSelectionNotifications = fieldC->addBool("listenToSelectionNotifications"))->setBoolValue(true); + (f_PassOnNotifications = fieldC->addBool("passOnNotifications"))->setBoolValue( false ); + (f_AutoUpdate = fieldC->addBool( "autoUpdate"))->setBoolValue( false ); f_Update = fieldC->addNotify("update"); @@ -444,17 +446,18 @@ } } - - void CSOSetProperties::SetProperties(bool shouldSetupInternalCSOList) { + this->SetProperties(shouldSetupInternalCSOList, 0 ); +} + +void CSOSetProperties::SetProperties(bool shouldSetupInternalCSOList, int notificationFlag) +{ if (shouldSetupInternalCSOList){ SetupInternalCSOList(); } if (m_OutputCSOList != NULL){ - int notificationFlag = 0; - switch ( f_InputMode->getEnumValue() ){ case CSOINPUT: { @@ -515,6 +518,7 @@ }// m_selectedCSOIds loop break; } //CSOINPUT + case GROUPINPUT: { ParseInputGroupString(); @@ -655,26 +659,23 @@ CSOSetProperties* thisp = static_cast<CSOSetProperties*>(userData); thisp->m_IsInNotificationCB = true; + int flags = (( thisp->f_PassOnNotifications->getBoolValue() && + !thisp->f_WorkDirectlyOnInputList->getBoolValue() ) ? notificationFlag : 0); if (!thisp->m_IsNotifyingMyself){ if ( thisp->f_AutoUpdate->getBoolValue() ){ - if ((notificationFlag & CSOList::NOTIFICATION_CSO_FINISHED) || - (notificationFlag & CSOList::NOTIFICATION_GROUP_FINISHED)) - { - if (thisp->f_ListenToFinishingNotifications->getBoolValue() == true){ - thisp->SetProperties(true); - } + if ( thisp->f_ListenToFinishingNotifications->getBoolValue() && + ((notificationFlag & CSOList::NOTIFICATION_CSO_FINISHED) || + (notificationFlag & CSOList::NOTIFICATION_GROUP_FINISHED)) ){ + thisp->SetProperties( true, flags ); } - if ((notificationFlag & CSOList::NOTIFICATION_CSO_SELECTION) || - (notificationFlag & CSOList::NOTIFICATION_GROUP_SELECTION)) - { - if (thisp->f_ListenToSelectionNotifications->getBoolValue() == true){ - thisp->SetProperties(true); - } + if ( thisp->f_ListenToSelectionNotifications->getBoolValue() && + ((notificationFlag & CSOList::NOTIFICATION_CSO_SELECTION) || + (notificationFlag & CSOList::NOTIFICATION_GROUP_SELECTION)) ){ + thisp->SetProperties( true, flags ); } } } - thisp->m_IsInNotificationCB = false; } Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-03-31 08:49:31 UTC (rev 349) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-03-31 08:58:47 UTC (rev 350) @@ -64,6 +64,7 @@ //! Handle field changes of the field \c field. virtual void handleNotification (Field *field); void SetProperties(bool shouldSetupInternalCSOList); + void SetProperties(bool shouldSetupInternalCSOList, int notificationFlag); //! Sets up the internal pointer to the input CSOList. void SetupInternalCSOList(); @@ -119,6 +120,9 @@ //! Shall the module listen to selection change notifications? BoolField* f_ListenToSelectionNotifications; + //! Pass on incoming notifications + BoolField* f_PassOnNotifications; + //! Auto update mode. BoolField* f_AutoUpdate; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-03-31 08:49:37
|
Revision: 349 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=349&view=rev Author: rhameeteman Date: 2011-03-31 08:49:31 +0000 (Thu, 31 Mar 2011) Log Message: ----------- KH. * Added min an max statistic for each cso * Fixed update bug * Fixed bug with negative max value * Fixed bug in average calculation Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2011-03-28 08:24:31 UTC (rev 348) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2011-03-31 08:49:31 UTC (rev 349) @@ -217,13 +217,13 @@ } } } else - if (inputImageValid || - ( field == f_Apply || - field == f_AddDescription || - field == f_DescriptionString || - field == f_UseAllPointsInsideCSO || - field == f_Resolution || - field == f_UseVoxelSize ) ){ + if ( (field == f_Apply || f_UpdateMode->getEnumValue() == AUTOUPDATE ) && + (inputImageValid || + ( field == f_AddDescription || + field == f_DescriptionString || + field == f_UseAllPointsInsideCSO || + field == f_Resolution || + field == f_UseVoxelSize ) ) ){ ProcessCSOList(true); } else if ( field == f_OutputAverage || field == f_OutputSum || field == f_OutputCurve ){ @@ -324,7 +324,7 @@ f_Statistics->setStringValue( "" ); std::stringstream outputString; - outputString << "Id;Voxels;Sum;Average" << std::endl; + outputString << "Id;Voxels;Sum;Average;Min;Max" << std::endl; m_SumSeries.clear(); m_AverageSeries.clear(); @@ -342,11 +342,11 @@ if (m_SelectedCSOIds.size() > 0){ - double totalMin = ML_DOUBLE_MAX; - double totalMax = ML_DOUBLE_MIN; + double totalMin = ML_DOUBLE_MAX; + double totalMax = -ML_DOUBLE_MAX; double totalAverage = 0.0; - double totalSum = 0.0; - double totalArea = 0.0; + double totalSum = 0.0; + double totalArea = 0.0; for (unsigned int i = 0; i < m_SelectedCSOIds.size(); i++){ const unsigned int currentId = m_SelectedCSOIds[i]; CSO* currentCSO = m_OutCSOList->getCSOById(currentId); @@ -354,7 +354,7 @@ double sum = 0.0; double average = 0.0; double minimum = ML_DOUBLE_MAX; - double maximum = ML_DOUBLE_MIN; + double maximum = -ML_DOUBLE_MAX; unsigned int iD = currentCSO->getId(); size_t voxelCount; this->GetStatistics( currentCSO, voxelCount, sum, average, minimum, maximum ); @@ -371,7 +371,7 @@ totalMin = ML_MIN(totalMin,minimum); totalMax = ML_MAX(totalMax,maximum); - outputString << iD << ";" << voxelCount << ";" << sum << ";" << average << std::endl; + outputString << iD << ";" << voxelCount << ";" << sum << ";" << average << ";" << minimum << ";" << maximum << std::endl; m_SumSeries.push_back( sum ); m_AverageSeries.push_back( average ); @@ -499,28 +499,13 @@ // Get the CSO voxel bounding box mlField* mprOutput = MLModuleGetField(mpr,"output0"); - float vMatrix[16]; - MLImageGetWorldToVoxelMatrix(mprOutput,vMatrix); - mat4 wTvMatrix = mat4(vMatrix); - CSOBoundingBox csoBB = cso->getVoxelBoundingBox( wTvMatrix ); - const MLint t = cso->getTimePointIndex(); - const MLint x1 = static_cast< MLint >(csoBB.v1[0]); - const MLint y1 = static_cast< MLint >(csoBB.v1[1]); - const MLint z1 = static_cast< MLint >(csoBB.v1[2]); - const MLint x2 = static_cast< MLint >(csoBB.v2[0]); - const MLint y2 = static_cast< MLint >(csoBB.v2[1]); - const MLint z2 = static_cast< MLint >(csoBB.v2[2]); - SubImgBox csoVoxelBox = SubImgBox( Vector(x1,y1,z1,0,t,0), - Vector(x2,y2,z2,0,t,0) ); - // Allocate memory block and fill it with the mpr image. void* tile = NULL; - MLErrorCode err = getTile( static_cast<BaseOp*>(mpr), - 0, - csoVoxelBox, - MLdoubleType, - &tile ); + int nx,ny,nz,nc,nt,nu; + MLImageGetSize6D( mprOutput,&nx,&ny,&nz,&nc,&nt,&nu); + MLErrorCode err = MLImageGetTile6D( mprOutput,&tile,0,0,0,0,0,0,nx,ny,nz,nc,nt,nu, MLdoubleType ); double* inputTile = reinterpret_cast< double* >(tile); + SubImgBox csoVoxelBox = SubImgBox( Vector(0), Vector(nx-1,ny-1,nz-1,nc-1,nt-1,nu-1) ); sum = 0.0; average = 0.0; @@ -538,7 +523,7 @@ std::vector< vec3 > contourPoints; // Convert pathPoints to voxel coordinates - ConvertCoorinateList( pathPoints, mprOutput); + ConvertCoorinateListToVoxel( pathPoints, mprOutput); if ( f_UseAllPointsInsideCSO->getBoolValue() ){ // Fill contourPoints with all points inside the contour GetPointsInsideContour( pathPoints, contourPoints, csoVoxelBox); @@ -548,37 +533,37 @@ } voxelCount = contourPoints.size(); - const Vector strideVector = csoVoxelBox.getExt().getStrides(); + Vector strideVector; + strideVector[0] = 1; + strideVector[1] = strideVector[0]*nx; + strideVector[2] = strideVector[1]*ny; + strideVector[3] = strideVector[2]*nz; + strideVector[4] = strideVector[3]*nc; + strideVector[5] = strideVector[4]*nt; const int currentCSOIndex = cso->getCSOList()->getCSOIndex( cso ); for ( unsigned int iPos = 0; iPos < voxelCount; ++iPos){ - const MLint x0 = static_cast< MLint >(contourPoints[iPos][0]); - const MLint y0 = static_cast< MLint >(contourPoints[iPos][1]); - const MLint z0 = static_cast< MLint >(contourPoints[iPos][2]); - const Vector currentPos( x0,y0,z0,0,0,0 ); - const Vector deltaPos = currentPos-csoVoxelBox.v1; - const MLint offset = deltaPos.dot( strideVector); - double* currentValue = inputTile+offset; - sum += *currentValue; - minimum = ML_MIN(minimum, *currentValue ); - maximum = ML_MAX(maximum, *currentValue ); + Vector currentPos( static_cast< MLint >(contourPoints[iPos][0]), + static_cast< MLint >(contourPoints[iPos][1]), + static_cast< MLint >(contourPoints[iPos][2]),0,0,0 ); float x,y,z; MLImageMapVoxelToWorld(mprOutput, currentPos[0]+0.5,currentPos[1]+0.5,currentPos[2]+0.5,&x,&y,&z); XMarker currentMarker( vec3(x,y,z) ); currentMarker.type = currentCSOIndex; m_OutMarkerList->push_back( currentMarker ); + + currentPos -= csoVoxelBox.v1; + const MLint offset = currentPos.dot( strideVector ); + double* currentValue = inputTile+offset; + sum += *currentValue; + minimum = ML_MIN(minimum, *currentValue ); + maximum = ML_MAX(maximum, *currentValue ); } - - const double csoArea = cso->getArea(); - const double csoLength = cso->getLength(); - if ( csoLength != 0 && csoArea != 0){ - if ( f_UseVoxelSize->getBoolValue() ){ - average = sum/csoArea; - } else { - average = sum/csoLength; - } + const double csoArea = ( f_UseAllPointsInsideCSO->getBoolValue() ? cso->getArea():cso->getLength() ); + if ( f_UseVoxelSize->getBoolValue() ){ + average = (csoArea == 0 ? 0: sum/csoArea); } else { - average = 0; + average = (voxelCount == 0 ? 0 : sum/voxelCount); } } freeTile( inputTile ); @@ -612,23 +597,20 @@ } -void CSOImageStatistics::ConvertCoorinateList( std::vector< vec3 > &coordinateList, mlField* image) +void CSOImageStatistics::ConvertCoorinateListToVoxel( std::vector< vec3 > &coordinateList, mlField* image) { std::vector< vec3 >::iterator it = coordinateList.begin(); for (;it != coordinateList.end(); ++ it ) { - float x0 = (*it)[0]; - float y0 = (*it)[1]; - float z0 = (*it)[2]; float x1,y1,z1; - MLImageMapWorldToVoxel(image, x0,y0,z0,&x1,&y1,&z1); + MLImageMapWorldToVoxel(image, (*it)[0], (*it)[1],(*it)[2], &x1,&y1,&z1); *it = vec3(x1,y1,z1); } } void CSOImageStatistics::GetPointsInsideContour( std::vector< vec3 > const &pathPoints, - std::vector< vec3 > &contourPoints, - SubImgBox const &box) + std::vector< vec3 > &contourPoints, + SubImgBox const &box) { contourPoints.clear(); // Traverse all voxels in box @@ -637,10 +619,10 @@ for (p.z = box.v1.z; p.z <= box.v2.z; ++p.z) { for (p.y = box.v1.y; p.y <= box.v2.y; ++p.y) { for (p.x = box.v1.x; p.x <= box.v2.x; ++p.x) { - vec3 currentPos = vec3(p.x,p.y,p.z); + vec3 currentPos = vec3(p.x+0.5,p.y+0.5,p.z+0.5); // Since all points should be in a axis aligned plane we can use - // CSOMath::isPointInsidePolygon - if ( CSOMath::isPointInsidePolygon(pathPoints, currentPos ) ) { + // CSOGeometry::isPointInsidePolygon + if ( CSOGeometry::isPointInsidePolygon(pathPoints, currentPos ) ) { contourPoints.push_back( currentPos ); } } Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h 2011-03-28 08:24:31 UTC (rev 348) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h 2011-03-31 08:49:31 UTC (rev 349) @@ -65,30 +65,46 @@ ~CSOImageStatistics(); + //! Enumerator for memory handling + enum MemoryAccess { + PAGES = 0, + MEMIMAGE, + VIRTUALVOLUME + }; + + //! Enumerator for update mode + enum UpdateMode { + OFF = 0, + AUTOUPDATE + }; + //! Handle field changes of the field \c field. virtual void handleNotification (Field *field); + + //! Callback member for CSO notifications static void CsoListNotifyObserverCB(void* userData, int notificationFlag); private: - enum MemoryAccess { - PAGES = 0, - MEMIMAGE, - VIRTUALVOLUME - }; - //! Implements interface for the runtime type system of the ML. ML_BASEOP_CLASS_HEADER(CSOImageStatistics); + //! Setup the internal CSOList: private list or pointer to input list void SetupInternalCSOList(); + + //! Parse the given Id string void ParseInputCSOString(); + + //! Add CSO Id to the list that needs to be processed void AddCSOId(const std::string& idString); + + //! Process the determined Id list void ProcessCSOList(bool shouldSetupInternalCSOList); //! Get image statistics of cso - void GetStatistics( CSO* cso, + void GetStatistics( CSO *cso, size_t &voxelCount, double &sum, double &average, @@ -102,7 +118,7 @@ SubImgBox const &voxelBB); //! Convert the coordinates in the list from wold to voxel coordinates using the supplied image - void ConvertCoorinateList( std::vector< vec3 > &coordinateList, mlField* image); + void ConvertCoorinateListToVoxel( std::vector< vec3 > &coordinateList, mlField* image); //! Set the output curves void SetCurves(); @@ -111,24 +127,17 @@ //! return the new string. std::string ReplaceString(std::string sourceString, std::string findString, std::string replaceString ); + //! \name Module Fields + //@{ //! The input CSOList. BaseField* f_InputCSOList; //! The output CSOList. This may contain additional description strings for each CSO BaseField* f_OutputCSOList; - //! A pointer to the input CSOList. - CSOList* m_InCSOList; - - //! A pointer to the output CSOList. - CSOList* m_OutCSOList; - //! Input string for determining the CSOs that are to be processed. StringField* f_InputCSOString; - //! The ids of the selected CSOs. - std::vector<unsigned int> m_SelectedCSOIds; - //! Shall the module work directly on the input CSOList? //! Otherwise, it would work on a copy which is set at the output field. BoolField* f_WorkDirectlyOnInputList; @@ -145,25 +154,12 @@ //! Output curve field BaseField *f_OutCurveList; - //! The actual curveList - CurveList *m_OutCurveList; - - //! The CurveData for the average - std::vector< float > m_AverageSeries; - - //! The CurveData for the sum - std::vector< float > m_SumSeries; - //! Select which statistics to add as curve BoolField *f_OutputAverage; //! Select which statistics to add as curve BoolField *f_OutputSum; - //! Output a MarkerList containing all positions that are used to calculate the statistics - //! The type of each marker is set to the corresponding CSO Id - XMarkerList *m_OutMarkerList; - //! Output MarkerList field BaseField *f_OutMarkerList; @@ -179,12 +175,6 @@ //! Applies changes. NotifyField* f_Apply; - //! Locking variable for removing/adding a notification observer. - bool m_IsInNotificationCB; - - //! Is this module notifying itself? Locking variable to avoid infinite loops. - bool m_IsNotifyingMyself; - //! Calculate statistics on every point inside the CSO BoolField *f_UseAllPointsInsideCSO; @@ -208,7 +198,39 @@ //! defines how to access the input image, ("Paged", "Global" , "VirtualVolume") EnumField *f_MemoryAccessMode; + //@} + //! \name module member variables + //@{ + //! A pointer to the input CSOList. + CSOList* m_InCSOList; + + //! A pointer to the output CSOList. + CSOList* m_OutCSOList; + + //! The ids of the selected CSOs. + std::vector<unsigned int> m_SelectedCSOIds; + + //! The actual curveList + CurveList *m_OutCurveList; + + //! The CurveData for the average + std::vector< float > m_AverageSeries; + + //! The CurveData for the sum + std::vector< float > m_SumSeries; + + //! Output a MarkerList containing all positions that are used to calculate the statistics + //! The type of each marker is set to the corresponding CSO Id + XMarkerList *m_OutMarkerList; + + //! Locking variable for removing/adding a notification observer. + bool m_IsInNotificationCB; + + //! Is this module notifying itself? Locking variable to avoid infinite loops. + bool m_IsNotifyingMyself; + + //@} }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2011-03-28 08:24:37
|
Revision: 348 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=348&view=rev Author: coertmetz Date: 2011-03-28 08:24:31 +0000 (Mon, 28 Mar 2011) Log Message: ----------- CM: Added functionality for other patch types. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp Modified: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp 2011-03-11 13:53:30 UTC (rev 347) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp 2011-03-28 08:24:31 UTC (rev 348) @@ -173,30 +173,74 @@ _patchEndIndexFld->setIntValue(patchEndIndex); } - // Check if input patch is of right type - if (_inWEM->getWEMPatchAt(0)->getPatchType()!=WEM_PATCH_TRIANGLES) { - std::cout << "Input WEMPatch should be of type WEM_PATCH_TRIANGLES!" << std::endl; - return; + if ( _inWEM->getWEMPatchAt(0)->getPatchType() == WEM_PATCH_TRIANGLES ) + { + // Output selected WEM patches + for (int i=patchStartIndex; i<=patchEndIndex; ++i) { + int index = i; + // Circular behaviour + while (index<0) { + index = index + numPatches; + } + + // Get input patch + WEMTrianglePatch * inPatch = (WEMTrianglePatch*) _inWEM->getWEMPatchAt(index % numPatches); + + // Create new output patch + WEMTrianglePatch * outTrianglePatch = NULL; + ML_CHECK_NEW(outTrianglePatch, WEMTrianglePatch(*inPatch)); + + _finish(outTrianglePatch); + _addWEMPatch(outTrianglePatch); + } } + else if ( _inWEM->getWEMPatchAt(0)->getPatchType() == WEM_PATCH_POLYGONS ) + { + // Output selected WEM patches + for (int i=patchStartIndex; i<=patchEndIndex; ++i) { + int index = i; + // Circular behaviour + while (index<0) { + index = index + numPatches; + } - // Output selected WEM patches - for (int i=patchStartIndex; i<=patchEndIndex; ++i) { - int index = i; - // Circular behaviour - while (index<0) { - index = index + numPatches; + // Get input patch + WEMPolygonPatch * inPatch = (WEMPolygonPatch*) _inWEM->getWEMPatchAt(index % numPatches); + + // Create new output patch + WEMPolygonPatch * outTrianglePatch = NULL; + ML_CHECK_NEW(outTrianglePatch, WEMPolygonPatch(*inPatch)); + + _finish(outTrianglePatch); + _addWEMPatch(outTrianglePatch); } - - // Get input patch - WEMTrianglePatch * inPatch = (WEMTrianglePatch*) _inWEM->getWEMPatchAt(index % numPatches); + } + else if ( _inWEM->getWEMPatchAt(0)->getPatchType() == WEM_PATCH_QUADS ) + { + // Output selected WEM patches + for (int i=patchStartIndex; i<=patchEndIndex; ++i) { + int index = i; + // Circular behaviour + while (index<0) { + index = index + numPatches; + } - // Create new output patch - WEMTrianglePatch * outTrianglePatch = NULL; - ML_CHECK_NEW(outTrianglePatch, WEMTrianglePatch(*inPatch)); - - _finish(outTrianglePatch); - _addWEMPatch(outTrianglePatch); + // Get input patch + WEMQuadPatch * inPatch = (WEMQuadPatch*) _inWEM->getWEMPatchAt(index % numPatches); + + // Create new output patch + WEMQuadPatch * outTrianglePatch = NULL; + ML_CHECK_NEW(outTrianglePatch, WEMQuadPatch(*inPatch)); + + _finish(outTrianglePatch); + _addWEMPatch(outTrianglePatch); + } } + else + { + std::cout << "Input WEMPatch type not supported!" << std::endl; + return; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2011-03-11 13:53:36
|
Revision: 347 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=347&view=rev Author: coertmetz Date: 2011-03-11 13:53:30 +0000 (Fri, 11 Mar 2011) Log Message: ----------- CM: Fixed slice zoom for vector display. Modified Paths: -------------- trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab Modified: trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab 2011-02-18 15:12:24 UTC (rev 346) +++ trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab 2011-03-11 13:53:30 UTC (rev 347) @@ -21,6 +21,8 @@ parameterX = 0 parameterY = 0 value = -1 + intList = "" + dblList = "" } } module Negation { @@ -108,7 +110,7 @@ zoomOn = TRUE panOn = TRUE autoCenterOn = TRUE - position = "-3.984270095825195 -7.729000091552734 32.68109893798828" + position = "-3.9842700958252 -7.72900009155273 32.6810989379883" positionMode = Off lutOn = TRUE lutMouseOn = TRUE @@ -118,46 +120,47 @@ lutMouseShift = RELEASED lutMouseCtrl = RELEASED lutRangeMin = 0 - lutRangeMax = 1 + lutRangeMax = 255 lutAlphaSync = TRUE - lutGreyCenter = 1 - lutGreyWidth = 1 - lutAlphaCenter = 1 - lutAlphaWidth = 1 + lutGreyCenter = 115.10001 + lutGreyWidth = 135.40001 + lutAlphaCenter = 115.10001 + lutAlphaWidth = 135.40001 lutColorFactor = "1 1 1" lutAlphaFactor = 1 - lutAutoDefault = TRUE + lutAutoDefault = FALSE lutSetInputMinMax = TRUE lutUseTraceColors = FALSE lutEnableNegWidth = FALSE lutSetDefaultOnce = TRUE lutTrCol0 = "1 1 1" - lutTrCol1 = "0.5019609928131104 0.5019609928131104 0.5019609928131104" - lutTrCol2 = "0.8627449870109558 0 0.1725489944219589" - lutTrCol3 = "1 0.4627450108528137 0.4901959896087646" - lutTrCol4 = "0 0.8196079730987549 0.1607840061187744" - lutTrCol5 = "0.5607839822769165 1 0.4352940022945404" - lutTrCol6 = "0.1843139976263046 0.2392159998416901 0.9294120073318481" - lutTrCol7 = "0.4901959896087646 0.5411760210990906 1" - lutTrCol8 = "0.6313729882240295 0 0.67843097448349" - lutTrCol9 = "0.8941180109977722 0.3803919851779938 1" - lutTrColA = "0 0.6823530197143555 0.756862998008728" - lutTrColB = "0.5019609928131104 1 0.9803919792175293" - lutTrColC = "0.6156859993934631 0.6000000238418579 0.1960780024528503" - lutTrColD = "1 0.9764710068702698 0.3686270117759705" + lutTrCol1 = "0.50196099281311 0.50196099281311 0.50196099281311" + lutTrCol2 = "0.862744987010956 0 0.172548994421959" + lutTrCol3 = "1 0.462745010852814 0.490195989608765" + lutTrCol4 = "0 0.819607973098755 0.160784006118774" + lutTrCol5 = "0.560783982276917 1 0.43529400229454" + lutTrCol6 = "0.184313997626305 0.23921599984169 0.929412007331848" + lutTrCol7 = "0.490195989608765 0.541176021099091 1" + lutTrCol8 = "0.63137298822403 0 0.67843097448349" + lutTrCol9 = "0.894118010997772 0.380391985177994 1" + lutTrColA = "0 0.682353019714355 0.756862998008728" + lutTrColB = "0.50196099281311 1 0.980391979217529" + lutTrColC = "0.615685999393463 0.600000023841858 0.19607800245285" + lutTrColD = "1 0.97647100687027 0.36862701177597" lutTrColE = "1 1 1" lutTrColF = "1 1 1" annotationOn = TRUE annoCoords = Voxel annoCTValue = AsIs valueHighPrecision = FALSE + maxPrecision = 4 annotFontSize = ANNO_SIZE_AUTO annotShowOrientation = ANNO_ORIENTATION_SIZE_WEIGHTED annotVerticalRuler = TRUE annotHorizontalRuler = FALSE - annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationCol = "0.899999976158142 0.899999976158142 0.899999976158142" annotationMode = ANNO_MODE_AUTO - annotShowAnnot = ANNO_SHOW_DETAILED + annotShowAnnot = ANNO_SHOW_HIDE annotUserTopLeft = "$(PatientsName) $(PatientID) $(PatientsSex) $(PatientsBirthDate) @@ -179,19 +182,53 @@ annotShortTopRight = $(Modality) annotShortBottomLeft = "Slice: $(slice)" annotShortBottomRight = "LUT C/W: $(input03) / $(input04)" - annoInput03 = 1 - annoInput04 = 1 - annoInput05 = 1 - annoInput06 = 1 - annoInput07 = 1 - annoInput08 = 1 + annotMRTopLeft = "$(PatientsName) +$(PatientsBirthDate) $(PatientsSex) +$(PatientID) +($(input00)): +$(input01) GV" + annotMRTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality)" + annotMRBottomLeft = "Slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription) +$(ImageComments)" + annotMRBottomRight = "MR Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input03) / $(input04)" + annotCTTopLeft = "$(PatientsName) +$(PatientsBirthDate) $(PatientsSex) +$(PatientID) +($(input00)): +$(input02) $(input09)" + annotCTTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality) " + annotCTBottomLeft = "Slice: $(slice) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription) +$(ImageComments)" + annotCTBottomRight = "CT Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input07) / $(input08)" + annoInput03 = 115.1 + annoInput04 = 135.4 + annoInput05 = "00.85 00.53 " + annoInput06 = 135.400009155273 + annoInput07 = 115.1 + annoInput08 = 135.4 annoInput09 = GV annoMouseOn = TRUE - annoReadPixFloorPos = "1025 764 0" - annoReadPixVoxelPos = "1025.339965820312 764.1619873046875 0.5" - annoReadPixWorldPos = "1025.339965820312 764.1619873046875 0.5" + annoReadPixFloorPos = "212 156 0" + annoReadPixVoxelPos = "212.339263916016 156.385467529297 0.5" + annoReadPixWorldPos = "45.6778450012207 33.6128044128418 77" borderOn = TRUE - borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + borderColor = "0.899999976158142 0.899999976158142 0.899999976158142" borderWidth = 1 borderEvaluateFocus = FALSE borderFocusColor = "1 1 1" @@ -216,8 +253,8 @@ fields { instanceName = FormatFloat format = %05.2f - value = "" - output = "" + value = "0.84535456 0.53420562" + output = "00.85 00.53 " } internalFields = "" } @@ -238,7 +275,7 @@ instanceName = SoView2DPosition drawingOn = FALSE editingOn = TRUE - maskValid = FALSE + maskValid = TRUE fixZOn = TRUE color = "1 1 1" selectionTolerance = 4 @@ -258,17 +295,19 @@ renderOnSlab = FALSE clipToSlice = FALSE cursorShape = UNDEFINED_CURSOR - worldPosition = "-1 -1 -1" - firstSliceWorldPosition = "-1 -1 -1" + worldPosition = "40.018482208252 43.7289199829102 77" + firstSliceWorldPosition = "40.018482208252 43.7289199829102 77" drawingModel = DRAWINGMODEL_CROSSHAIRS drawingModelSize = -1 + crossHairSpacing = 0 + drawEditingRect = TRUE blendOnto = 1 blendOutside = 0 lineWidth = 1 colorAxes = FALSE sagittalColor = "1 0 0" - coronalColor = "0.1725490242242813 0.886274516582489 0.0117647061124444" - axialColor = "0.007843137718737125 0.9529411792755127 0.9686274528503418" + coronalColor = "0.172549024224281 0.886274516582489 0.0117647061124444" + axialColor = "0.00784313771873713 0.952941179275513 0.968627452850342" updateOnPress = TRUE updateOnMotion = TRUE updateOnRelease = FALSE @@ -296,6 +335,8 @@ parameterX = 0 parameterY = 0 value = 0 + intList = "" + dblList = "" } } module SoGroup { @@ -374,7 +415,7 @@ cineMode = CINE_Z cineDirection = CINE_PINGPONG cineRepeat = CINE_ONCE - cineSpeed = 0.1000000015 + cineSpeed = 0.1 cineFullRangeZ = TRUE cineFullRangeT = TRUE cineAlwaysReset = TRUE @@ -434,7 +475,7 @@ } fields { instanceName = GetVoxelValue - position = "-1 -1 -1 0 0 0" + position = "40.018482208252 43.7289199829102 77 0 0 0" updateMode = AutoClear coordinateType = World } @@ -485,8 +526,8 @@ moduleGroupName = Vectors windows { window _default { - geometry = "410 193 466 687" - sizeHint = "466 687" + geometry = "964 454 439 502" + sizeHint = "439 502" wasOpen = no wasActive = no } @@ -505,11 +546,11 @@ upperRight = "1 1" margin = "2 2" spacing = "4 4" - plane = "0 0 1 0" - sliceZoom = 1 - sliceZoomSynchronized = 1 + plane = "0 0 1 77" + sliceZoom = 2.6999996 + sliceZoomSynchronized = 2.6999996 minSliceZoomKeyboard = 1 - sliceOrigin = "0 0" + sliceOrigin = "100.174102783203 89.9873275756836" viewingCenter = "0 0 0" enableViewingCenter = FALSE unzoomOnImageChange = FALSE @@ -546,7 +587,7 @@ cineMode = CINE_Z cineDirection = CINE_PINGPONG cineRepeat = CINE_ONCE - cineSpeed = 0.1000000015 + cineSpeed = 0.1 cineFullRangeZ = TRUE cineFullRangeT = TRUE cineAlwaysReset = TRUE @@ -563,11 +604,19 @@ internal { frame = "189 153 104 64" moduleGroupName = Vectors + windows { + window _default { + geometry = "939 618 116 22" + sizeHint = "56 22" + wasOpen = no + wasActive = no + } + } } fields { instanceName = ViewVectors - whichChild = -1 - on = FALSE + whichChild = -3 + on = TRUE } } module SoToggle { @@ -585,8 +634,8 @@ } fields { instanceName = ViewMesh - whichChild = -3 - on = TRUE + whichChild = -1 + on = FALSE } } module SoMouseGrabber { @@ -626,9 +675,9 @@ x = 1 y = 1 xmin = 0 - xmax = 1 + xmax = 255 ymin = 0 - ymax = 1 + ymax = 255 cursorPresent = FALSE checkCursorPresent = FALSE maskValid = FALSE @@ -661,29 +710,29 @@ fields { instanceName = overlayLut _channelEditorState = "" - alphaCenter = 1 - alphaWidth = 1 - greyCenter = 1 - greyWidth = 1 - redCenter = 0.5 - redWidth = 1 - blueCenter = 0.5 - blueWidth = 1 + alphaCenter = 131 + alphaWidth = 143 + greyCenter = 131 + greyWidth = 143 + redCenter = 131 + redWidth = 143 + blueCenter = 131 + blueWidth = 143 useColorRamps = FALSE invertGrey = FALSE invertAlpha = FALSE colorFactor = "1 1 1" alphaFactor = 1 - autoSetDefaultRamp = TRUE + autoSetDefaultRamp = FALSE setDefaultRampOnce = TRUE - inputImageValid = FALSE + inputImageValid = TRUE rangeMin = 0 - rangeMax = 1 + rangeMax = 255 widthMin = 0 enableNegWidth = FALSE - widthMax = 1 - rangeStep = 0.004999999888 - rangeStepStep = 0.05000000075 + widthMax = 255 + rangeStep = 1.0000001 + rangeStepStep = 10.000001 selectorX = 0 selectorY = 0 setInputMinMax = TRUE @@ -692,48 +741,48 @@ trCol0 = "1 1 1" trCol0Name = White trCol0Alpha = 1 - trCol1 = "0.5019609928131104 0.5019609928131104 0.5019609928131104" + trCol1 = "0.50196099281311 0.50196099281311 0.50196099281311" trCol1Name = Grey trCol1Alpha = 1 - trCol2 = "0.8627449870109558 0 0.1725489944219589" + trCol2 = "0.862744987010956 0 0.172548994421959" trCol2Name = Red trCol2Alpha = 1 - trCol3 = "1 0.4627450108528137 0.4901959896087646" + trCol3 = "1 0.462745010852814 0.490195989608765" trCol3Name = "Light Red" trCol3Alpha = 1 - trCol4 = "0 0.8196079730987549 0.1607840061187744" + trCol4 = "0 0.819607973098755 0.160784006118774" trCol4Name = Green trCol4Alpha = 1 - trCol5 = "0.5607839822769165 1 0.4352940022945404" + trCol5 = "0.560783982276917 1 0.43529400229454" trCol5Name = "Light Green" trCol5Alpha = 1 - trCol6 = "0.1843139976263046 0.2392159998416901 0.9294120073318481" + trCol6 = "0.184313997626305 0.23921599984169 0.929412007331848" trCol6Name = Blue trCol6Alpha = 1 - trCol7 = "0.4901959896087646 0.5411760210990906 1" + trCol7 = "0.490195989608765 0.541176021099091 1" trCol7Name = "Light Blue" trCol7Alpha = 1 - trCol8 = "0.6313729882240295 0 0.67843097448349" + trCol8 = "0.63137298822403 0 0.67843097448349" trCol8Name = "Dark Magenta" trCol8Alpha = 1 - trCol9 = "0.8941180109977722 0.3803919851779938 1" + trCol9 = "0.894118010997772 0.380391985177994 1" trCol9Name = Magenta trCol9Alpha = 1 - trColA = "0 0.6823530197143555 0.756862998008728" + trColA = "0 0.682353019714355 0.756862998008728" trColAName = "Dark Cyan" trColAAlpha = 1 - trColB = "0.5019609928131104 1 0.9803919792175293" + trColB = "0.50196099281311 1 0.980391979217529" trColBName = Cyan trColBAlpha = 1 - trColC = "0.6156859993934631 0.6000000238418579 0.1960780024528503" + trColC = "0.615685999393463 0.600000023841858 0.19607800245285" trColCName = "Dark Yellow" trColCAlpha = 1 - trColD = "1 0.9764710068702698 0.3686270117759705" + trColD = "1 0.97647100687027 0.36862701177597" trColDName = Yellow trColDAlpha = 1 trColE = "1 1 1" trColEName = "Half Transparent" - trColEAlpha = 0.06274499744 + trColEAlpha = 0.062744997 trColF = "1 1 1" trColFName = Transparent trColFAlpha = 0 @@ -797,8 +846,8 @@ moduleGroupName = Vectors windows { window _default { - geometry = "521 318 232 596" - sizeHint = "232 596" + geometry = "521 318 232 584" + sizeHint = "232 584" wasOpen = no wasActive = no } @@ -808,7 +857,7 @@ instanceName = SoView2DVectorFieldView drawingOn = TRUE editingOn = TRUE - maskValid = FALSE + maskValid = TRUE fixZOn = TRUE color = "1 1 1" selectionTolerance = 4 @@ -828,20 +877,20 @@ renderOnSlab = FALSE clipToSlice = FALSE cursorShape = UNDEFINED_CURSOR - midpointSize = 0.05999999866 - vectorWidth = 0.1000000015 - vectorLength = 1 + midpointSize = 0.059999999 + vectorWidth = 0.1 + vectorLength = 10 vectorMinLength = 0 midpointSegments = 10 midpointAbsoluteSize = FALSE vectorAbsoluteSize = TRUE - vectorColor = "1 0 0" + vectorColor = "0.666666686534882 0 0" midpointColor = "1 1 0" - stepWidth = 10 + stepWidth = 5 drawArrowTips = FALSE arrowTipColor = "0 1 0" - arrowTipWidth = 0.200000003 - arrowTipHeight = 0.200000003 + arrowTipWidth = 1 + arrowTipHeight = 1 normalizeVectors = FALSE useComps2And3 = FALSE } @@ -863,7 +912,7 @@ instanceName = SoView2DDeformationGridView drawingOn = TRUE editingOn = TRUE - maskValid = FALSE + maskValid = TRUE fixZOn = TRUE color = "1 1 1" selectionTolerance = 4 @@ -883,13 +932,13 @@ renderOnSlab = FALSE clipToSlice = FALSE cursorShape = UNDEFINED_CURSOR - stepWidth = 10 - gridColor = "0 0.6666666865348816 1" + stepWidth = 5 + gridColor = "0 0.666666686534882 1" gridPointColor = "1 1 1" drawGridPoints = FALSE gridPointSegments = 10 gridPointAbsoluteSize = FALSE - gridPointSize = 0.05000000075 + gridPointSize = 0.050000001 } } module View2D { @@ -909,13 +958,19 @@ wasOpen = no wasActive = no } + window _automatic { + geometry = "1286 266 500 600" + sizeHint = "260 223" + wasOpen = no + wasActive = no + } } } fields { instanceName = View2D inventorInputOn = TRUE view2DExtensionsOn = FALSE - startSlice = -1 + startSlice = 0 numSlices = 1 numXSlices = 1 sliceStep = 1 @@ -928,29 +983,30 @@ cineMode = CINE_Z cineDirection = CINE_PINGPONG cineRepeat = CINE_ONCE - cineSpeed = 0.1000000015 + cineSpeed = 0.1 snapToCenter = FALSE zoomMode = VIEW2D_AUTO_ZOOM unzoomOnImageChange = FALSE - sliceZoom = 1 - sliceZoomSynced = 1 + sliceZoom = 2.6999996 + sliceZoomSynced = 2.6999996 baseColor = "1 1 1" margin = "2 2" - sliceOrigin = "0 0" - lutCenter = 1 - lutWidth = 1 + sliceOrigin = "96.5273818969727 86.3406066894531" + lutCenter = 131 + lutWidth = 143 lutUseTraceColors = FALSE annotationOn = TRUE annotationMode = ANNO_MODE_AUTO annotationSizeMode = ANNO_SHOW_DETAILED - annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationCol = "0.899999976158142 0.899999976158142 0.899999976158142" annotationFontSize = ANNO_SIZE_AUTO annoCoords = Voxel annoCTValue = AsIs borderOn = TRUE - borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + borderColor = "0.899999976158142 0.899999976158142 0.899999976158142" valueHighPrecision = FALSE - plane = "0 0 1 0" + maxPrecision = 4 + plane = "0 0 1 77" } internalFields = "" } @@ -975,6 +1031,8 @@ ShowMagnitude.children = "SoGroup2.self SoSeparator2.self" SoView2D.image = Vector.output0 SoView2D.startSlice = View2D.startSlice + SoView2D.sliceZoomSynchronized = View2D.sliceZoom + SoView2D.sliceOrigin = View2D.sliceOrigin SoView2D.timePoint = View2D.timePoint ViewVectors.children = SoView2DVectorFieldView.self ViewMesh.children = SoView2DDeformationGridView.self This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2011-02-18 15:12:30
|
Revision: 346 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=346&view=rev Author: broersen Date: 2011-02-18 15:12:24 +0000 (Fri, 18 Feb 2011) Log Message: ----------- - Updated parts of the documentation Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 2011-02-18 15:11:24 UTC (rev 345) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 2011-02-18 15:12:24 UTC (rev 346) @@ -1,3 +1,5 @@ + + <!DOCTYPE html> <html> <head> @@ -6,32 +8,33 @@ <body> <center> -<a href="#Purpose">Purpose</a> -<a href="#Usage">Usage</a> -<a href="#Details">Details</a> -<a href="#Inputs">Inputs</a> -<a href="#Outputs">Outputs</a> -<a href="#Parameters">Parameters</a> -<a href="#Events%20And%20Interaction">Events And Interaction</a> -<a href="#Example">Example</a> -<a href="#Tips%20And%20Tricks">Tips And Tricks</a> -<a href="#Known%20Bugs">Known Bugs</a> +<a href="#purpose">Purpose</a> +<a href="#usage">Usage</a> +<a href="#details">Details</a> +<a href="#inputs">Inputs</a> +<a href="#outputs">Outputs</a> +<a href="#parameters">Parameters</a> +<a href="#events%20and%20interaction">Events And Interaction</a> +<a href="#example">Example</a> +<a href="#tips%20and%20tricks">Tips And Tricks</a> +<a href="#known%20bugs">Known Bugs</a> <hr width="100%"> </center> <h2>MatlabScriptWrapper</h2> -<h3><a name="Purpose"></a>Purpose</h3> +<h3><a name="purpose"></a>Purpose</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -The <b>MatlabScriptWrapper</b> module offers the possibility to execute Matlab scripts within -MevisLab and establish a link to a Matlab console, for example to transfer data between MeVisLab -and Matlab. Note that Matlab must be installed for this module to function. +The <b>MatlabScriptWrapper</b> module offers the possibility to execute +<a href="http://www.mathworks.com/products/matlab/">Matlab</a> scripts within MeVisLab and establish a link to a +Matlab console, for example to transfer data between MeVisLab and Matlab. Note that Matlab must be +installed for this module to function. </blockquote> -<h3><a name="Usage"></a>Usage</h3> +<h3><a name="usage"></a>Usage</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> Currently, three types of data structures can be transferred between MeVisLab and Matlab:<br> @@ -42,11 +45,11 @@ Note that MeVisLab and Matlab use different coordinate systems, see below for further information. </li> <li><span style="font-weight: bold;">CurveData (input only) and CurveLists:</span> - A CurveData is an object consisting of zero or one X- and any number of Y-data series. A CurveList - is an array of CurveData objects. - In Matlab, a CurveList is represented as a cell array with in each cell a matrix with the points of - each series of a curve. The first column in the matrix contains the X-values, the second column - contains the first serie of Y-values, the third column the second serie of Y-values etc.. + A <a href="http://www.mevislab.de/docs/2.0/MeVisLab/Resources/Documentation/Publish/SDK/ToolBoxReference/MLBasePage.html">CurveData</a> + is an object consisting of zero or one X- and any number of Y-data series. A CurveList is an array + of CurveData objects. In Matlab, a CurveList is represented as a cell array with in each cell a matrix + with the points of each series of a curve. The first column in the matrix contains the X-values, the + second column contains the first serie of Y-values, the third column the second serie of Y-values etc.. </li> <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). @@ -103,8 +106,8 @@ The variable names for the above data structures in the Matlab workspace can be set. <br> The Matlab script can be written directly in the module GUI, or an external script file (.m) can be called. -If you choose to use existing script, the script in script field will disappear and -there is no posibility to edit a Matlab script file from MevisLab. +If you choose to use an 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, set "Auto update" to update on input value change, or set "Auto apply" to update on parameter value change. @@ -115,7 +118,7 @@ </blockquote> -<h3><a name="Details"></a>Details</h3> +<h3><a name="details"></a>Details</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <span style="font-weight: bold;">Coordinate systems in MeVisLab and Matlab</span> @@ -139,7 +142,7 @@ </blockquote> -<h3><a name="Inputs"></a>Inputs</h3> +<h3><a name="inputs"></a>Inputs</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> Up to three input images and one CurveData, CurveList, XMarkerList , or WEM can be attached to the module. @@ -148,14 +151,14 @@ </blockquote> -<h3><a name="Outputs"></a>Outputs</h3> +<h3><a name="outputs"></a>Outputs</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> Up to three output images and one CurveList, one XMarkerList, or one WEM. </blockquote> -<h3><a name="Parameters"></a>Parameters</h3> +<h3><a name="parameters"></a>Parameters</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <b>Matlab Script</b> @@ -170,7 +173,6 @@ Enables the possibility to use an external Matlab script file (.m).<br> </blockquote> - <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <b>Auto update</b> <br> @@ -178,7 +180,6 @@ XMarkerList, and WEM, not for changes in the names).<br> </blockquote> - <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <b>Auto apply</b> <br> @@ -188,23 +189,23 @@ <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -<b>Show Matlab session window</b> +<b>Restart Matlab</b> <br> -Show or hide the Matlab session window.<br> +Restarts the Matlab engine.<br> </blockquote> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -<b>Restart Matlab</b> +<b>Status</b> <br> -Restarts the Matlab engine.<br> +This field gives information whether the Matlab script was executed correctly or not.<br> </blockquote> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -<b>Status</b> +<b>Show Matlab session window</b> <br> -This field gives information whether the Matlab script was executed correctly or not.<br> +Show or hide the Matlab session window.<br> </blockquote> @@ -238,20 +239,20 @@ </blockquote> -<h3><a name="Example"></a>Example</h3> +<h3><a name="example"></a>Example</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> The example network shows a number of different uses of the <b>MatlabScriptWrapper</b> module.<br> </blockquote> -<h3><a name="Tips And Tricks"></a>Tips And Tricks</h3> +<h3><a name="tips%20and%20tricks"></a>Tips And Tricks</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <span style="color: rgb(0, 0, 0);">-</span> </blockquote> -<h3><a name="Known Bugs"></a>Known Bugs</h3> +<h3><a name="known%20bugs"></a>Known Bugs</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <span style="color: rgb(0, 0, 0);">-</span> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2011-02-18 15:11:30
|
Revision: 345 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=345&view=rev Author: broersen Date: 2011-02-18 15:11:24 +0000 (Fri, 18 Feb 2011) Log Message: ----------- - Added WEM callback for the AutoUpdate and fixed several bugs 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 2011-02-08 09:46:25 UTC (rev 344) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2011-02-18 15:11:24 UTC (rev 345) @@ -76,6 +76,7 @@ _outputXMarkerListFld = fields->addBase("outputXMarkerList"); _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); + _isInWEMNotificationCB = false; ML_CHECK_NEW(_outWEM,WEM()); (_inputWEMFld = fields->addBase("inputWEM"))->setBaseValue(NULL); (_outputWEMFld = fields->addBase("outputWEM"))->setBaseValue(_outWEM); @@ -88,7 +89,6 @@ //! Use external Matlab script. (_useExternalScriptFld = fields->addBool("useExternalScript"))->setBoolValue(false); - //! Where will Matlab script be dumped. (_matlabScriptPathFld = fields->addString("matlabScriptPath"))->setStringValue(""); @@ -119,8 +119,8 @@ (_autoApplyFld = fields->addBool("autoApply"))->setBoolValue(false); //! Add restart Matlab button. _restartMatlabFld = fields->addNotify("restartMatlab"); - // Error message. - (_statusFld = fields->addString("status"))->setStringValue("Ready."); + //! Add status field. + (_stdReportFld = fields->addString("status"))->setStringValue("Ready."); // Set scalar name and value fields. (_scalarNameFld[0] = fields->addString("scalarName0"))->setStringValue("scalar0"); @@ -206,7 +206,7 @@ } if (! m_startCmd.empty()) { - std::cout << "Found matlab binary at: " << m_startCmd.c_str() << std::endl; + std::cout << "Found Matlab binary at: " << m_startCmd.c_str() << std::endl; } #endif @@ -224,7 +224,7 @@ std::cerr << " MeVisLab is started." << std::endl; (_showSessionWindowFld = fields->addBool("showSessionWindow"))->setBoolValue(false); - _statusFld->setStringValue("Cannot find Matlab engine!"); + _stdReportFld->setStringValue("Cannot find Matlab engine!"); } else { //! Show the Matlab session window. bool vis; @@ -268,10 +268,10 @@ if(_checkMatlabIsStarted()) { engSetVisible(m_pEngine,_showSessionWindowFld->getBoolValue()); } else { - _statusFld->setStringValue("Cannot find Matlab engine!"); + _stdReportFld->setStringValue("Cannot find Matlab engine!"); } } else { - _statusFld->setStringValue("Matlab is already started"); + _stdReportFld->setStringValue("Matlab is already started"); } } @@ -296,175 +296,186 @@ (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!"); - return; - } + _process(); + } +} - // Get script to evaluate - std::string evaluateString = ""; - bool validScriptString = true; - if(_useExternalScriptFld->isOn()) { // Get script from .m-file - validScriptString = _loadMatlabScriptFromFile(evaluateString); - } else { - evaluateString = _matlabScriptFld->getStringValue(); - } - // Execute Matlab script only when the string is valid - if(validScriptString) { - if (_inputCurveFld->getBaseValue() != NULL) { - // Check if a valid CurveData or CurveList is attached to the input - if (_inputCurveFld->isValidValue() && (ML_BASE_IS_A(_inputCurveFld,CurveData)||ML_BASE_IS_A(_inputCurveFld,CurveList)) ) { - // Copy input CurveData or CurveList to Matlab. - _copyInputWEMToMatlab(); - } +//---------------------------------------------------------------------------------- +//! The process method is called by the parent class. +//---------------------------------------------------------------------------------- +void MatlabScriptWrapper::_process() +{ + ML_TRACE_IN("MatlabScriptWrapper::process()") + + // Check if Matlab is started. + if (!_checkMatlabIsStarted()) { + _stdReportFld->setStringValue("Cannot find Matlab engine!"); + return; + } + + // Get script to evaluate. + std::string evaluateString = ""; + bool validScriptString = true; + if(_useExternalScriptFld->isOn()) { // Get script from .m-file + validScriptString = _loadMatlabScriptFromFile(evaluateString); + } else { + evaluateString = _matlabScriptFld->getStringValue(); + } + + // Execute Matlab script only when the string is valid + if(validScriptString) { + if (_inputCurveFld->getBaseValue() != NULL) { + // Check if a valid CurveData or CurveList is attached to the input + if (_inputCurveFld->isValidValue() && (ML_BASE_IS_A(_inputCurveFld,CurveData)||ML_BASE_IS_A(_inputCurveFld,CurveList)) ) { + // Copy input CurveData or CurveList to Matlab. + _copyInputWEMToMatlab(); } - if( _inputXMarkerListFld->getBaseValue() != NULL ) { - // Check if a valid XMarkerList is attached to the input. - if( _inputXMarkerListFld->isValidValue() && ML_BASE_IS_A(_inputXMarkerListFld->getBaseValue(), XMarkerList) ) { - // Copy input XMarkerList to Matlab. - _copyInputXMarkerToMatlab(); - } + } + if( _inputXMarkerListFld->getBaseValue() != NULL ) { + // Check if a valid XMarkerList is attached to the input. + if( _inputXMarkerListFld->isValidValue() && ML_BASE_IS_A(_inputXMarkerListFld->getBaseValue(), XMarkerList) ) { + // Copy input XMarkerList to Matlab. + _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(); - } + } + 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(); - // Copy scalar values to matlab. - _copyInputScalarsToMatlab(); - // Copy string values to matlab. - _copyInputStringsToMatlab(); - // Copy vector values to matlab. - _copyInputVectorsToMatlab(); - // Copy matrix values to matlab. - _copyInputMatricesToMatlab(); + // Copy input image data to matlab. + _copyInputImageDataToMatlab(); + // Copy scalar values to matlab. + _copyInputScalarsToMatlab(); + // Copy string values to matlab. + _copyInputStringsToMatlab(); + // Copy vector values to matlab. + _copyInputVectorsToMatlab(); + // Copy matrix values to matlab. + _copyInputMatricesToMatlab(); - // Insert at the end of the script variable to proof execution status - // and run the script in Matlab - 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); + // Insert at the end of the script variable to proof execution status + // and run the script in Matlab + evaluateString += "\nmevmatscr=1;"; // Added ';' to prevent unnecessary output + _stdReportFld->setStringValue("Matlab script is executing...."); - // and run the script in Matlab - engEvalString(m_pEngine, evaluateString.c_str()); + // Buffer to capture Matlab output + #define BUFSIZE 5120 + char buffer[BUFSIZE+1]; + buffer[BUFSIZE] = '\0'; + // Start logging Matlab output + engOutputBuffer(m_pEngine, buffer, BUFSIZE); - // 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); + // and run the script in Matlab + engEvalString(m_pEngine, evaluateString.c_str()); - // If variable mevmatscr exist it means the whole Matlab script was executed. - mxArray *mtmp = engGetVariable(m_pEngine,"mevmatscr"); - if(mtmp!=NULL) { - _statusFld->setStringValue("Matlab execution successful!"); - engEvalString(m_pEngine, "clear mevmatscr"); - } else { - _statusFld->setStringValue("Matlab script contains errors!"); - //_clearAllVariables(); - } - mxDestroyArray(mtmp); mtmp = NULL; + // 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) { + _stdReportFld->setStringValue("Matlab execution successful!"); + engEvalString(m_pEngine, "clear mevmatscr"); + } else { + _stdReportFld->setStringValue("Matlab script contains errors!"); + //_clearAllVariables(); } - // If the script string was not valid, clear all data so that - // the user notes this. - else { - _matlabOutputBufferFld->setStringValue(""); - _clearAllVariables(); - } + mxDestroyArray(mtmp); mtmp = NULL; + } + // If the script string was not valid, clear all data so that + // the user notes this. + else { + _matlabOutputBufferFld->setStringValue(""); + _clearAllVariables(); + } - // Get CurveList from Matlab and copy results into output CurveList - _getCurveDataBackFromMatlab(); - - // Get XMarkerList from Matlab and copy results into output XMarkerList - _getXMarkerBackFromMatlab(); - - // Get WEM from Matlab and copy results into output WEM - _getWEMBackFromMatlab(); + // Get CurveList from Matlab and copy results into output CurveList + _getCurveDataBackFromMatlab(); - // 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. - double tmpScalars[6]; - for(int k=0; k<6; ++k) { - tmpScalars[k] = _scalarFld[k]->getDoubleValue(); + // 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. + double tmpScalars[6]; + for(int k=0; k<6; ++k) { + tmpScalars[k] = _scalarFld[k]->getDoubleValue(); + } + _getScalarsBackFromMatlab(); + for(int k=0; k<6; ++k) { + if(tmpScalars[k] != _scalarFld[k]->getDoubleValue()) { + _scalarFld[k]->notifyAttachments(); } - _getScalarsBackFromMatlab(); - for(int k=0; k<6; ++k) { - if(tmpScalars[k] == _scalarFld[k]->getDoubleValue()) { - _scalarFld[k]->notifyAttachments(); - } + } + // Get strings back from Matlab. First store the current strings so that + // we can check if they change. A notification is only sent upon change. + std::string tmpstrings[6]; + for(int k=0; k<6; ++k) { + tmpstrings[k] = _stringFld[k]->getStringValue(); + } + _getStringsBackFromMatlab(); + for(int k=0; k<6; ++k) { + if(tmpstrings[k] != _stringFld[k]->getStringValue()) { + _stringFld[k]->notifyAttachments(); } - // Get strings back from Matlab. First store the current strings so that - // we can check if they change. A notification is only sent upon change. - std::string tmpstrings[6]; - for(int k=0; k<6; ++k) { - tmpstrings[k] = _stringFld[k]->getStringValue(); - } - _getStringsBackFromMatlab(); - for(int k=0; k<6; ++k) { - if(tmpstrings[k] == _stringFld[k]->getStringValue()) { - _stringFld[k]->notifyAttachments(); - } - } + } - // Get vectors back from Matlab. First store the current vectors so that - // we can check if they change. A notification is only sent upon change. - for(int k=0; k<6; ++k) { - tmpstrings[k] = _vectorFld[k]->getStringValue(); + // Get vectors back from Matlab. First store the current vectors so that + // we can check if they change. A notification is only sent upon change. + for(int k=0; k<6; ++k) { + tmpstrings[k] = _vectorFld[k]->getStringValue(); + } + _getVectorsBackFromMatlab(); + for(int k=0; k<6; ++k) { + if(tmpstrings[k] != _vectorFld[k]->getStringValue()) { + _vectorFld[k]->notifyAttachments(); } - _getVectorsBackFromMatlab(); - for(int k=0; k<6; ++k) { - if(tmpstrings[k] == _vectorFld[k]->getStringValue()) { - _vectorFld[k]->notifyAttachments(); - } - } + } - // Get matrices back from Matlab. First store the current matrices so that - // we can check if they change. A notification is only sent upon change. - for(int k=0; k<3; ++k) { - tmpstrings[k] = _matrixFld[k]->getStringValue(); + // Get matrices back from Matlab. First store the current matrices so that + // we can check if they change. A notification is only sent upon change. + for(int k=0; k<3; ++k) { + tmpstrings[k] = _matrixFld[k]->getStringValue(); + } + _getMatricesBackFromMatlab(); + for(int k=0; k<3; ++k) { + if(tmpstrings[k] != _matrixFld[k]->getStringValue()) { + _matrixFld[k]->notifyAttachments(); } - _getMatricesBackFromMatlab(); - for(int k=0; k<3; ++k) { - if(tmpstrings[k] == _matrixFld[k]->getStringValue()) { - _matrixFld[k]->notifyAttachments(); - } - } + } - // Notify image attachments that are new images calculated so that they - // update themselves and call the calcOutSubImage() - getOutField(0)->notifyAttachments(); - getOutField(1)->notifyAttachments(); - getOutField(2)->notifyAttachments(); + // Notify image attachments that are new images calculated so that they + // update themselves and call the calcOutSubImage() + getOutField(0)->notifyAttachments(); + getOutField(1)->notifyAttachments(); + getOutField(2)->notifyAttachments(); - // Notify the XMarkerList output - _outputXMarkerListFld->notifyAttachments(); - // Notify the CurveList output - _outputCurveListFld->notifyAttachments(); + // Notify the XMarkerList output + _outputXMarkerListFld->notifyAttachments(); + // Notify the CurveList output + _outputCurveListFld->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); - } + // 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); } @@ -499,8 +510,7 @@ ML_TRACE_IN("MatlabScriptWrapper::calcOutImageProps ()"); // Proof if Matlab is started. - if (!_checkMatlabIsStarted()) - { + if(!_checkMatlabIsStarted()) { std::cerr << "calcOutImageProps(): Cannot find Matlab engine!" << std::endl << std::flush; #if ML_MAJOR_VERSION >= 2 getOutImg(outIndex)->setOutOfDate(); @@ -530,7 +540,7 @@ getOutImg(outIndex)->setPageExt(outExt); // Set output image size. getOutImg(outIndex)->setImgExt(outExt); - // Set output image datatype. + // Set output image datatypes. switch (mxGetClassID(m_pImage)) { case mxDOUBLE_CLASS: getOutImg(outIndex)->setDataType(MLdoubleType); __setInSubImageDataType(MLdoubleType); break; case mxSINGLE_CLASS: getOutImg(outIndex)->setDataType(MLfloatType); __setInSubImageDataType(MLdoubleType); break; @@ -654,6 +664,24 @@ // Internal (private) methods. ////////////////////////////////////////////////////////////////////// + +//! Callback the input WEM is changed. +void MatlabScriptWrapper::_wemNeedsNotificationCB( void* userData, std::vector<WEMEventContainer> ecList ) +{ + MatlabScriptWrapper* thisp = static_cast<MatlabScriptWrapper*>(userData); + + thisp->_isInWEMNotificationCB = true; + WEMEventContainer wemEC = ecList.back(); + if(wemEC.notificationType & WEM_NOTIFICATION_FINISHED) { + if(thisp->_autoCalculationFld->isOn()) { + thisp->handleNotificationOff(); + thisp->_process(); + thisp->handleNotificationOn(); + } + } + thisp->_isInWEMNotificationCB = false; +} + //! Loads matlab script from a file, pastes it into script field and saves user written script. bool MatlabScriptWrapper::_loadMatlabScriptFromFile(std::string& evaluateString) { @@ -668,7 +696,7 @@ ML_TRY { if(pathString.empty()) { - _statusFld->setStringValue("Script path is empty."); + _stdReportFld->setStringValue("Script path is empty."); return false; } else @@ -678,7 +706,7 @@ dat.open(pathString.c_str()); if(dat.fail()) { // Throw error message if file couldn't be opened. - _statusFld->setStringValue("Cannot find .m-file!"); + _stdReportFld->setStringValue("Cannot find .m-file!"); return false; } @@ -881,7 +909,7 @@ CurveData* inputCurveData = NULL; CurveList* inputCurveList = NULL; - std::size_t numCurves = -1; + std::size_t numCurves = 0; // Get input data. if( ML_BASE_IS_A(_inputCurveFld->getBaseValue(), CurveList) ) { @@ -952,11 +980,11 @@ if((m_curveList!=NULL && mxGetClassID(m_curveList)==mxCELL_CLASS)) { CurveData* curve = NULL; const size_t curves = mxGetN(m_curveList); // Number of matrices in Matlab cell - for(size_t i=0; i<=curves; i++) { + for(size_t i=0; i<curves; i++) { ML_CHECK_NEW(curve,CurveData); mxArray *m_curve = mxGetCell(m_curveList,i); - if((m_curve && !mxIsEmpty(m_curve) && mxGetClassID(m_curve)==mxDOUBLE_CLASS)) { + if(m_curve && !mxIsEmpty(m_curve) && mxGetClassID(m_curve)==mxDOUBLE_CLASS) { const size_t points = mxGetM(m_curve); // Number of rows in Matlab matrix const size_t series = mxGetN(m_curve); // Number of columns in Matlab matrix curve->resizeX(points); // Initialize the X - values with zeros @@ -1026,6 +1054,7 @@ setVec<<"]"; setType<<"]"; + // Put XMarkerList into Matlab structure. std::ostringstream all; all << setPos.str() << "\n" << setVec.str() << "\n" << setType.str() << "\n"; @@ -1076,6 +1105,7 @@ engEvalString(m_pEngine, executeStr.str().c_str()); mxArray *m_type = engGetVariable(m_pEngine, "tmpOutXMarkerListType"); engEvalString(m_pEngine, "clear tmpOutXMarkerListType"); + executeStr.str(""); // Get data from Matlab array. if((m_pos && !mxIsEmpty(m_pos) && mxGetClassID(m_pos) ==mxDOUBLE_CLASS) && @@ -1144,10 +1174,16 @@ std::cerr << "_copyInputWEMToMatlab(): Cannot find Matlab engine!" << std::endl << std::flush; return; } - + + if(!_isInWEMNotificationCB){ + WEM::removeNotificationObserverFromAllWEMs(_wemNeedsNotificationCB, this); + } // Get input WEM. WEM *inputWEM = mlbase_cast<WEM*>(_inputWEMFld->getBaseValue()); - + if(!_isInWEMNotificationCB) { + inputWEM->addNotificationObserver(_wemNeedsNotificationCB, this); + } + // Internal loop. unsigned int i = 0, j = 0, k = 0, m = 0; unsigned int totalNumNodes = 0, numTriangulatedNodes = 0; @@ -1171,7 +1207,7 @@ // Loop over all patches -> flatten WEM for (i = 0; i < inputWEM->getNumWEMPatches(); i ++) { patch = inputWEM->getWEMPatchAt(i); - + // Loop over all nodes const unsigned int numNodes = patch->getNumNodes(); for (j = 0; j < numNodes; j ++) { @@ -1368,15 +1404,16 @@ // Internal loop. mxArray *temp = NULL; // Get only output scalars. - for(MLint i=0; i<6; i++) - { + for(MLint i=0; i<6; i++) { temp = engGetVariable(m_pEngine, (_scalarNameFld[i]->getStringValue()).c_str()); if(temp!=NULL) { if(mxGetClassID(temp)==mxDOUBLE_CLASS) { double *fieldVal = static_cast<double*>(mxGetPr(temp)); + _scalarFld[i]->disableNotifications(); _scalarFld[i]->setDoubleValue(fieldVal[0]); + _scalarFld[i]->enableNotifications(); } else { - std::cerr << "_getVectorsBackFromMatlab(): Output type from Matlab not supported" << std::endl << std::flush; + std::cerr << "_getScalarsBackFromMatlab(): Output type from Matlab not supported" << std::endl << std::flush; } } } @@ -1396,9 +1433,8 @@ MLint i = 0; // Compose string that contains input scalars. std::ostringstream execute; - // Put only input scalars into matlab. - for(i=0; i<6; i++) - { + // Put only input scalars into Matlab. + for(i=0; i<6; i++) { execute<<_stringNameFld[i]->getStringValue()<<"='"<<(_stringFld[i]->getStringValue())<<"'\n"; } // Execute string and write input scalars into Matlab. @@ -1424,10 +1460,12 @@ { temp = engGetVariable(m_pEngine, (_stringNameFld[i]->getStringValue()).c_str()); if(temp!=NULL) { - tempsize = mxGetN(temp)+1; + tempsize = (int)mxGetN(temp)+1; ML_CHECK_NEW(fieldVal,char[tempsize]); mxGetString(temp,fieldVal,tempsize); + _stringFld[i]->disableNotifications(); _stringFld[i]->setStringValue(fieldVal); + _stringFld[i]->enableNotifications(); ML_DELETE(fieldVal); } } @@ -1480,7 +1518,9 @@ if(mxGetClassID(temp)==mxDOUBLE_CLASS) { double *fieldVal = static_cast<double*>(mxGetPr(temp)); if(mxGetM(temp)==1 && mxGetN(temp)==4) { + _vectorFld[i]->disableNotifications(); _vectorFld[i]->setVec4fValue(vec4(fieldVal[0],fieldVal[1],fieldVal[2],fieldVal[3])); + _vectorFld[i]->enableNotifications(); } else { std::cerr << "_getVectorsBackFromMatlab(): Incorrect vector size" << std::endl << std::flush; } @@ -1534,17 +1574,18 @@ // Internal loop. mxArray *temp = NULL; // Get only output matrices. - for(MLint i=0; i<3; i++) - { + for(MLint i=0; i<3; i++) { temp = engGetVariable(m_pEngine, (_matrixNameFld[i]->getStringValue()).c_str()); if(temp!=NULL) { if(mxGetClassID(temp)==mxDOUBLE_CLASS) { double *fieldVal = static_cast<double*>(mxGetPr(temp)); if(mxGetM(temp)==4 && mxGetN(temp)==4) { + _matrixFld[i]->disableNotifications(); _matrixFld[i]->setMatrixValue(mat4(fieldVal[0],fieldVal[4], fieldVal[8],fieldVal[12], fieldVal[1],fieldVal[5], fieldVal[9],fieldVal[13], fieldVal[2],fieldVal[6],fieldVal[10],fieldVal[14], fieldVal[3],fieldVal[7],fieldVal[11],fieldVal[15])); + _matrixFld[i]->enableNotifications(); } else { std::cerr << "_getMatricesBackFromMatlab(): Incorrect matrix size" << std::endl << std::flush; } Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2011-02-08 09:46:25 UTC (rev 344) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2011-02-18 15:11:24 UTC (rev 345) @@ -73,6 +73,9 @@ //! Configures (in)validation handling of inputs which are not connected or up to date. virtual INPUT_HANDLE handleInput(int inIndex, INPUT_STATE state) const; + //! Triggers the computation. + virtual void _process(); + // ---------------------------------------------------------- //@{ \name Image processing methods. // ---------------------------------------------------------- @@ -115,6 +118,10 @@ //@} private: + + //! Can be called by any WEM processing module to trigger a notification. + static void _wemNeedsNotificationCB(void* userData, std::vector<WEMEventContainer> ecList); + // ---------------------------------------------------------- //@{ \name Module internal methods declarations // ---------------------------------------------------------- @@ -175,6 +182,8 @@ //! The WEM input field. BaseField *_inputWEMFld; + //! Locking for observer, so that no adding or removing is done on an invalid observer list. + bool _isInWEMNotificationCB; //! The WEM output field. BaseField *_outputWEMFld; //! The output WEM. @@ -216,7 +225,7 @@ BoolField* _autoCalculationFld; //! Status messages. - StringField* _statusFld; + StringField* _stdReportFld; //! Restart Matlab button. NotifyField* _restartMatlabFld; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-02-08 09:46:31
|
Revision: 344 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=344&view=rev Author: rhameeteman Date: 2011-02-08 09:46:25 +0000 (Tue, 08 Feb 2011) Log Message: ----------- KH. * Renamed CurveFilter class to CMCurveFilter to avoid class clashes with another CurveFilter module. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp Removed Paths: ------------- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/ Modified: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro 2011-02-08 09:44:25 UTC (rev 343) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro 2011-02-08 09:46:25 UTC (rev 344) @@ -31,12 +31,12 @@ HEADERS += \ MLCMCurveListInit.h \ MLCMCurveListSystem.h \ - CurveFilter/mlCurveFilter.h \ + CMCurveFilter/mlCMCurveFilter.h \ StringToCurve/mlStringToCurve.h \ SOURCES += \ MLCMCurveListInit.cpp \ - CurveFilter/mlCurveFilter.cpp \ + CMCurveFilter/mlCMCurveFilter.cpp \ StringToCurve/mlStringToCurve.cpp \ # additional files that are NOT compiled Modified: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp 2011-02-08 09:44:25 UTC (rev 343) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp 2011-02-08 09:46:25 UTC (rev 344) @@ -17,7 +17,7 @@ // Include all module headers ... -#include "CurveFilter/mlCurveFilter.h" +#include "CMCurveFilter/mlCMCurveFilter.h" #include "StringToCurve/mlStringToCurve.h" ML_START_NAMESPACE @@ -32,7 +32,7 @@ // Add initClass calls from all other modules here... - CurveFilter::initClass(); + CMCurveFilter::initClass(); StringToCurve::initClass(); return 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-02-08 09:44:32
|
Revision: 343 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=343&view=rev Author: rhameeteman Date: 2011-02-08 09:44:25 +0000 (Tue, 08 Feb 2011) Log Message: ----------- KH. * Renamed CurveFilter class to CMCurveFilter to avoid class clashes with another CurveFilter module. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def Added Paths: ----------- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h Removed Paths: ------------- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.h Modified: trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2011-02-08 09:38:27 UTC (rev 342) +++ trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2011-02-08 09:44:25 UTC (rev 343) @@ -9,11 +9,11 @@ //---------------------------------------------------------------------------------- -// MLModule CurveFilter +// MLModule CMCurveFilter //---------------------------------------------------------------------------------- MLModule CMCurveFilter { DLL = "MLCMCurveList" - class = "CurveFilter" + class = "CMCurveFilter" group = "BIGR" genre = "Diagram" author = "Reinhard Hameeteman" @@ -21,8 +21,8 @@ comment = "Select a curve from the curveList or curveSet" keywords = "curveList curveData curve filter" seeAlso = "CurveArithmetic CatCurves" - documentation = "$(LOCAL)/CurveFilter/CurveFilter.html" - exampleNetwork = "$(LOCAL)/CurveFilter/CurveFilterExample.mlab" + documentation = "$(LOCAL)/CMCurveFilter/CMCurveFilter.html" + exampleNetwork = "$(LOCAL)/CMCurveFilter/CMCurveFilterExample.mlab" Description { Field minCurveSet { @@ -86,7 +86,7 @@ } } } -} // MLModule CurveFilter +} // MLModule CMCurveFilter //---------------------------------------------------------------------------------- Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2011-02-08 09:38:27 UTC (rev 342) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2011-02-08 09:44:25 UTC (rev 343) @@ -117,6 +117,7 @@ Vertical Statistics { expandY = Yes + style { Prototype Field {expandX = Yes}} Box Totals { layout = Horizontal Vertical { Copied: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp (from rev 342, trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.cpp) =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.cpp 2011-02-08 09:44:25 UTC (rev 343) @@ -0,0 +1,232 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CMCurveFilter. +/*! +// \file mlCMCurveFilter.cpp +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "mlCMCurveFilter.h" +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(CMCurveFilter, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +CMCurveFilter::CMCurveFilter (void) + : BaseOp(0, 0), m_InCurveList(0) +{ + ML_TRACE_IN("CMCurveFilter::CMCurveFilter()"); + + handleNotificationOff(); + + FieldContainer *fields = getFieldContainer(); + + m_InCurveList = NULL; + f_InCurveList = fields->addBase( "inCurveList" ); + f_InCurveList->setBaseValue( m_InCurveList ); + + m_OutCurveList = new CurveList; + f_OutCurveList = fields->addBase( "outCurveList" ); + f_OutCurveList->setBaseValue( m_OutCurveList ); + + f_Update = fields->addNotify( "update" ); + f_AutoUpdate = fields->addBool( "autoUpdate" ); + f_AutoUpdate->setBoolValue( false ); + + f_MinCurveSet = fields->addInt( "minCurveSet" ); + f_MinCurveSet->setIntValue( 0 ); + + f_MaxCurveSet = fields->addInt( "maxCurveSet" ); + f_MaxCurveSet->setIntValue( 0 ); + + f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); + f_NumberOfCurveSets->setIntValue( 0 ); + + f_MinCurve = fields->addInt("minCurve"); + f_MinCurve->setIntValue( 0 ); + + f_MaxCurve = fields->addInt("maxCurve"); + f_MaxCurve->setIntValue( 0 ); + + f_NumberOfCurves = fields->addInt( "numberOfCurves" ); + f_NumberOfCurves->setIntValue( 0 ); + + f_CropCurve = fields->addBool( "cropCurve" ); + f_CropCurve->setBoolValue( false ); + + f_XStart = fields->addFloat( "start" ); + f_XStart->setFloatValue( 0.0f ); + + f_XEnd = fields->addFloat( "end" ); + f_XEnd->setFloatValue( 0.0f ); + + handleNotificationOn(); +} + + +CMCurveFilter::~CMCurveFilter(void) +{ + ResetOutput(); + delete m_OutCurveList; +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void CMCurveFilter::handleNotification (Field *field) +{ + ML_TRACE_IN("CMCurveFilter::handleNotification()"); + + if ( field == f_InCurveList ) { + m_SingleCurveList.clear(); + m_InCurveList = NULL; + Base* baseInput = f_InCurveList->getBaseValue(); + m_InCurveList = mlbase_cast<CurveList*>(baseInput); + CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); + if (inCurve){ + m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( baseInput ) ); + m_InCurveList = &m_SingleCurveList; + } + + if ( m_InCurveList != NULL ) { + if ( f_AutoUpdate->getBoolValue() ){ + SetMaxValues(); + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } else { + ResetOutput(); + f_OutCurveList->notifyAttachments(); + } + + } else + if ( field == f_Update || + (f_AutoUpdate->getBoolValue() && + (field == f_AutoUpdate || + field == f_MinCurveSet || + field == f_MaxCurveSet || + field == f_MinCurve || + field == f_MaxCurve || + field == f_CropCurve || + (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) + ))){ + if ( m_InCurveList != NULL ){ + if ( m_InCurveList->getNumCurves() > 0 ){ + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } + } +} + + +void CMCurveFilter::ResetOutput() +{ + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } +} + + +void CMCurveFilter::SetMaxValues() +{ + int nCurveSets = 0; + int nCurves = 0; + if ( m_InCurveList != NULL ){ + nCurveSets = m_InCurveList->getNumCurves(); + for (int iSet = 0; iSet < nCurveSets; ++iSet ) { + nCurves = mlMax( static_cast<MLssize_t>(nCurves), m_InCurveList->getCurveData( iSet )->getNumSeries() ); + } + } + f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); + f_NumberOfCurves->setIntValue( nCurves-1 ); +} + + +void CMCurveFilter::SetOutputCurve(){ + + ResetOutput(); + + // Check for valid field values + // Curves are numbered from 0 + int nCurveSets = m_InCurveList->getNumCurves(); + if ( nCurveSets == 0 ) {return;} + int minSet = mlMax( static_cast<MLint>(0), f_MinCurveSet->getIntValue() ); + int maxSet = mlMax( static_cast<MLint>(minSet), f_MaxCurveSet->getIntValue() ); + maxSet = mlMin( maxSet, nCurveSets-1 ); + for (int iSet = minSet; iSet <= maxSet; ++iSet ) { + + int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); + if (nCurves == 0 ) {continue;} + int minCurve = mlMax(static_cast<MLint>(0),f_MinCurve->getIntValue() ); + int maxCurve = mlMax(static_cast<MLint>(minCurve), f_MaxCurve->getIntValue() ); + maxCurve = mlMin(maxCurve, nCurves-1 ); + for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { + + CurveData *curveSet = m_InCurveList->getCurveData( iSet ); + CurveData *outputCurve = new CurveData( *curveSet ); + outputCurve->clearData(); + std::vector< float > xSeries; + std::vector< float > ySeries; + + // Copy/Crop curve values + bool crop = f_CropCurve->getBoolValue(); + float minX = f_XStart->getFloatValue(); + float maxX = f_XEnd->getFloatValue(); + minX = mlMin(minX,maxX); + for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ + float xValue = curveSet->getXValue( iX ); + if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { + ySeries.push_back( curveSet->getYValue( minCurve, iX) ); + xSeries.push_back( xValue ); + } + } + outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); + outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); + + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } +} + + +ML_END_NAMESPACE + Copied: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h (from rev 342, trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.h) =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCMCurveFilter.h 2011-02-08 09:44:25 UTC (rev 343) @@ -0,0 +1,123 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CMCurveFilter. +/*! +// \file mlCMCurveFilter.h +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlCMCurveFilter_H +#define __mlCMCurveFilter_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Select a curve from the curveList or curveSet +class MLCMCURVELIST_EXPORT CMCurveFilter : public BaseOp +{ +public: + + //! Constructor. + CMCurveFilter (void); + + //! Destructor + ~CMCurveFilter(void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + void SetOutputCurve(); + + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(CMCurveFilter); + + //! Remove any existing output curves + void ResetOutput(); + + //! Set the maximum values allowed for curves and series. + void SetMaxValues(); + + //! Input curve data + CurveList *m_InCurveList; + BaseField *f_InCurveList; + CurveList m_SingleCurveList; + + //! Output curve data + CurveList *m_OutCurveList; + BaseField *f_OutCurveList; + + //! Update modes + NotifyField *f_Update; + BoolField *f_AutoUpdate; + + //! Curve set range + IntField *f_MinCurveSet; + IntField *f_MaxCurveSet; + + //! Curve series range + IntField *f_MinCurve; + IntField *f_MaxCurve; + + //! Number of curves present in input + IntField *f_NumberOfCurveSets; + + //! Number of series present in input + IntField *f_NumberOfCurves; + + //! Crop the curve? + BoolField *f_CropCurve; + FloatField *f_XStart; + FloatField *f_XEnd; + +}; + + +ML_END_NAMESPACE + +#endif // __mlCMCurveFilter_H + + Deleted: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2011-01-28 10:42:48 UTC (rev 339) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.cpp 2011-02-08 09:44:25 UTC (rev 343) @@ -1,232 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), -// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of BIGR nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- -//! The ML module class CurveFilter. -/*! -// \file mlCurveFilter.cpp -// \author Reinhard Hameeteman -// \date 2008-03-03 -// -// Select a curve from the curveList or curveSet -*/ -//---------------------------------------------------------------------------------- - - -// Local includes -#include "mlCurveFilter.h" -ML_START_NAMESPACE - - -//! Implements code for the runtime type system of the ML -ML_BASEOP_CLASS_SOURCE(CurveFilter, BaseOp); - -//---------------------------------------------------------------------------------- -//! Constructor -//---------------------------------------------------------------------------------- -CurveFilter::CurveFilter (void) - : BaseOp(0, 0), m_InCurveList(0) -{ - ML_TRACE_IN("CurveFilter::CurveFilter()"); - - handleNotificationOff(); - - FieldContainer *fields = getFieldContainer(); - - m_InCurveList = NULL; - f_InCurveList = fields->addBase( "inCurveList" ); - f_InCurveList->setBaseValue( m_InCurveList ); - - m_OutCurveList = new CurveList; - f_OutCurveList = fields->addBase( "outCurveList" ); - f_OutCurveList->setBaseValue( m_OutCurveList ); - - f_Update = fields->addNotify( "update" ); - f_AutoUpdate = fields->addBool( "autoUpdate" ); - f_AutoUpdate->setBoolValue( false ); - - f_MinCurveSet = fields->addInt( "minCurveSet" ); - f_MinCurveSet->setIntValue( 0 ); - - f_MaxCurveSet = fields->addInt( "maxCurveSet" ); - f_MaxCurveSet->setIntValue( 0 ); - - f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); - f_NumberOfCurveSets->setIntValue( 0 ); - - f_MinCurve = fields->addInt("minCurve"); - f_MinCurve->setIntValue( 0 ); - - f_MaxCurve = fields->addInt("maxCurve"); - f_MaxCurve->setIntValue( 0 ); - - f_NumberOfCurves = fields->addInt( "numberOfCurves" ); - f_NumberOfCurves->setIntValue( 0 ); - - f_CropCurve = fields->addBool( "cropCurve" ); - f_CropCurve->setBoolValue( false ); - - f_XStart = fields->addFloat( "start" ); - f_XStart->setFloatValue( 0.0f ); - - f_XEnd = fields->addFloat( "end" ); - f_XEnd->setFloatValue( 0.0f ); - - handleNotificationOn(); -} - - -CurveFilter::~CurveFilter(void) -{ - ResetOutput(); - delete m_OutCurveList; -} - - -//---------------------------------------------------------------------------------- -//! Handle field changes of the field \c field. -//---------------------------------------------------------------------------------- -void CurveFilter::handleNotification (Field *field) -{ - ML_TRACE_IN("CurveFilter::handleNotification()"); - - if ( field == f_InCurveList ) { - m_SingleCurveList.clear(); - m_InCurveList = NULL; - Base* baseInput = f_InCurveList->getBaseValue(); - m_InCurveList = mlbase_cast<CurveList*>(baseInput); - CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); - if (inCurve){ - m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( baseInput ) ); - m_InCurveList = &m_SingleCurveList; - } - - if ( m_InCurveList != NULL ) { - if ( f_AutoUpdate->getBoolValue() ){ - SetMaxValues(); - SetOutputCurve(); - f_OutCurveList->notifyAttachments(); - } - } else { - ResetOutput(); - f_OutCurveList->notifyAttachments(); - } - - } else - if ( field == f_Update || - (f_AutoUpdate->getBoolValue() && - (field == f_AutoUpdate || - field == f_MinCurveSet || - field == f_MaxCurveSet || - field == f_MinCurve || - field == f_MaxCurve || - field == f_CropCurve || - (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) - ))){ - if ( m_InCurveList != NULL ){ - if ( m_InCurveList->getNumCurves() > 0 ){ - SetOutputCurve(); - f_OutCurveList->notifyAttachments(); - } - } - } -} - - -void CurveFilter::ResetOutput() -{ - while ( !m_OutCurveList->getCurveList().empty() ) { - delete m_OutCurveList->getCurveList().back(); - m_OutCurveList->getCurveList().pop_back(); - } -} - - -void CurveFilter::SetMaxValues() -{ - int nCurveSets = 0; - int nCurves = 0; - if ( m_InCurveList != NULL ){ - nCurveSets = m_InCurveList->getNumCurves(); - for (int iSet = 0; iSet < nCurveSets; ++iSet ) { - nCurves = mlMax( static_cast<MLssize_t>(nCurves), m_InCurveList->getCurveData( iSet )->getNumSeries() ); - } - } - f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); - f_NumberOfCurves->setIntValue( nCurves-1 ); -} - - -void CurveFilter::SetOutputCurve(){ - - ResetOutput(); - - // Check for valid field values - // Curves are numbered from 0 - int nCurveSets = m_InCurveList->getNumCurves(); - if ( nCurveSets == 0 ) {return;} - int minSet = mlMax( static_cast<MLint>(0), f_MinCurveSet->getIntValue() ); - int maxSet = mlMax( static_cast<MLint>(minSet), f_MaxCurveSet->getIntValue() ); - maxSet = mlMin( maxSet, nCurveSets-1 ); - for (int iSet = minSet; iSet <= maxSet; ++iSet ) { - - int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); - if (nCurves == 0 ) {continue;} - int minCurve = mlMax(static_cast<MLint>(0),f_MinCurve->getIntValue() ); - int maxCurve = mlMax(static_cast<MLint>(minCurve), f_MaxCurve->getIntValue() ); - maxCurve = mlMin(maxCurve, nCurves-1 ); - for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { - - CurveData *curveSet = m_InCurveList->getCurveData( iSet ); - CurveData *outputCurve = new CurveData( *curveSet ); - outputCurve->clearData(); - std::vector< float > xSeries; - std::vector< float > ySeries; - - // Copy/Crop curve values - bool crop = f_CropCurve->getBoolValue(); - float minX = f_XStart->getFloatValue(); - float maxX = f_XEnd->getFloatValue(); - minX = mlMin(minX,maxX); - for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ - float xValue = curveSet->getXValue( iX ); - if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { - ySeries.push_back( curveSet->getYValue( minCurve, iX) ); - xSeries.push_back( xValue ); - } - } - outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); - outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); - - m_OutCurveList->getCurveList().push_back( outputCurve ); - } - } -} - - -ML_END_NAMESPACE - Deleted: trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h 2011-01-28 10:42:48 UTC (rev 339) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CMCurveFilter/mlCurveFilter.h 2011-02-08 09:44:25 UTC (rev 343) @@ -1,123 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), -// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of BIGR nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- -//! The ML module class CurveFilter. -/*! -// \file mlCurveFilter.h -// \author Reinhard Hameeteman -// \date 2008-03-03 -// -// Select a curve from the curveList or curveSet -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __mlCurveFilter_H -#define __mlCurveFilter_H - - -// Local includes -#include "../MLCMCurveListSystem.h" - -// ML includes -#include "mlOperatorIncludes.h" - -#include <mlDiagramData.h> - -ML_START_NAMESPACE - - -//! Select a curve from the curveList or curveSet -class MLCMCURVELIST_EXPORT CurveFilter : public BaseOp -{ -public: - - //! Constructor. - CurveFilter (void); - - //! Destructor - ~CurveFilter(void); - - //! Handle field changes of the field \c field. - virtual void handleNotification (Field *field); - - void SetOutputCurve(); - - -private: - - - //! Implements interface for the runtime type system of the ML. - ML_BASEOP_CLASS_HEADER(CurveFilter); - - //! Remove any existing output curves - void ResetOutput(); - - //! Set the maximum values allowed for curves and series. - void SetMaxValues(); - - //! Input curve data - CurveList *m_InCurveList; - BaseField *f_InCurveList; - CurveList m_SingleCurveList; - - //! Output curve data - CurveList *m_OutCurveList; - BaseField *f_OutCurveList; - - //! Update modes - NotifyField *f_Update; - BoolField *f_AutoUpdate; - - //! Curve set range - IntField *f_MinCurveSet; - IntField *f_MaxCurveSet; - - //! Curve series range - IntField *f_MinCurve; - IntField *f_MaxCurve; - - //! Number of curves present in input - IntField *f_NumberOfCurveSets; - - //! Number of series present in input - IntField *f_NumberOfCurves; - - //! Crop the curve? - BoolField *f_CropCurve; - FloatField *f_XStart; - FloatField *f_XEnd; - -}; - - -ML_END_NAMESPACE - -#endif // __mlCurveFilter_H - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-02-08 09:38:34
|
Revision: 342 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=342&view=rev Author: rhameeteman Date: 2011-02-08 09:38:27 +0000 (Tue, 08 Feb 2011) Log Message: ----------- KH. * File rename Added Paths: ----------- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.h Removed Paths: ------------- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h Copied: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.cpp (from rev 339, trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp) =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.cpp 2011-02-08 09:38:27 UTC (rev 342) @@ -0,0 +1,232 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CMCurveFilter. +/*! +// \file mlCMCurveFilter.cpp +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "mlCMCurveFilter.h" +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(CMCurveFilter, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +CMCurveFilter::CMCurveFilter (void) + : BaseOp(0, 0), m_InCurveList(0) +{ + ML_TRACE_IN("CMCurveFilter::CMCurveFilter()"); + + handleNotificationOff(); + + FieldContainer *fields = getFieldContainer(); + + m_InCurveList = NULL; + f_InCurveList = fields->addBase( "inCurveList" ); + f_InCurveList->setBaseValue( m_InCurveList ); + + m_OutCurveList = new CurveList; + f_OutCurveList = fields->addBase( "outCurveList" ); + f_OutCurveList->setBaseValue( m_OutCurveList ); + + f_Update = fields->addNotify( "update" ); + f_AutoUpdate = fields->addBool( "autoUpdate" ); + f_AutoUpdate->setBoolValue( false ); + + f_MinCurveSet = fields->addInt( "minCurveSet" ); + f_MinCurveSet->setIntValue( 0 ); + + f_MaxCurveSet = fields->addInt( "maxCurveSet" ); + f_MaxCurveSet->setIntValue( 0 ); + + f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); + f_NumberOfCurveSets->setIntValue( 0 ); + + f_MinCurve = fields->addInt("minCurve"); + f_MinCurve->setIntValue( 0 ); + + f_MaxCurve = fields->addInt("maxCurve"); + f_MaxCurve->setIntValue( 0 ); + + f_NumberOfCurves = fields->addInt( "numberOfCurves" ); + f_NumberOfCurves->setIntValue( 0 ); + + f_CropCurve = fields->addBool( "cropCurve" ); + f_CropCurve->setBoolValue( false ); + + f_XStart = fields->addFloat( "start" ); + f_XStart->setFloatValue( 0.0f ); + + f_XEnd = fields->addFloat( "end" ); + f_XEnd->setFloatValue( 0.0f ); + + handleNotificationOn(); +} + + +CMCurveFilter::~CMCurveFilter(void) +{ + ResetOutput(); + delete m_OutCurveList; +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void CMCurveFilter::handleNotification (Field *field) +{ + ML_TRACE_IN("CMCurveFilter::handleNotification()"); + + if ( field == f_InCurveList ) { + m_SingleCurveList.clear(); + m_InCurveList = NULL; + Base* baseInput = f_InCurveList->getBaseValue(); + m_InCurveList = mlbase_cast<CurveList*>(baseInput); + CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); + if (inCurve){ + m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( baseInput ) ); + m_InCurveList = &m_SingleCurveList; + } + + if ( m_InCurveList != NULL ) { + if ( f_AutoUpdate->getBoolValue() ){ + SetMaxValues(); + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } else { + ResetOutput(); + f_OutCurveList->notifyAttachments(); + } + + } else + if ( field == f_Update || + (f_AutoUpdate->getBoolValue() && + (field == f_AutoUpdate || + field == f_MinCurveSet || + field == f_MaxCurveSet || + field == f_MinCurve || + field == f_MaxCurve || + field == f_CropCurve || + (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) + ))){ + if ( m_InCurveList != NULL ){ + if ( m_InCurveList->getNumCurves() > 0 ){ + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } + } +} + + +void CMCurveFilter::ResetOutput() +{ + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } +} + + +void CMCurveFilter::SetMaxValues() +{ + int nCurveSets = 0; + int nCurves = 0; + if ( m_InCurveList != NULL ){ + nCurveSets = m_InCurveList->getNumCurves(); + for (int iSet = 0; iSet < nCurveSets; ++iSet ) { + nCurves = mlMax( static_cast<MLssize_t>(nCurves), m_InCurveList->getCurveData( iSet )->getNumSeries() ); + } + } + f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); + f_NumberOfCurves->setIntValue( nCurves-1 ); +} + + +void CMCurveFilter::SetOutputCurve(){ + + ResetOutput(); + + // Check for valid field values + // Curves are numbered from 0 + int nCurveSets = m_InCurveList->getNumCurves(); + if ( nCurveSets == 0 ) {return;} + int minSet = mlMax( static_cast<MLint>(0), f_MinCurveSet->getIntValue() ); + int maxSet = mlMax( static_cast<MLint>(minSet), f_MaxCurveSet->getIntValue() ); + maxSet = mlMin( maxSet, nCurveSets-1 ); + for (int iSet = minSet; iSet <= maxSet; ++iSet ) { + + int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); + if (nCurves == 0 ) {continue;} + int minCurve = mlMax(static_cast<MLint>(0),f_MinCurve->getIntValue() ); + int maxCurve = mlMax(static_cast<MLint>(minCurve), f_MaxCurve->getIntValue() ); + maxCurve = mlMin(maxCurve, nCurves-1 ); + for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { + + CurveData *curveSet = m_InCurveList->getCurveData( iSet ); + CurveData *outputCurve = new CurveData( *curveSet ); + outputCurve->clearData(); + std::vector< float > xSeries; + std::vector< float > ySeries; + + // Copy/Crop curve values + bool crop = f_CropCurve->getBoolValue(); + float minX = f_XStart->getFloatValue(); + float maxX = f_XEnd->getFloatValue(); + minX = mlMin(minX,maxX); + for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ + float xValue = curveSet->getXValue( iX ); + if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { + ySeries.push_back( curveSet->getYValue( minCurve, iX) ); + xSeries.push_back( xValue ); + } + } + outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); + outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); + + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } +} + + +ML_END_NAMESPACE + Copied: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.h (from rev 339, trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h) =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCMCurveFilter.h 2011-02-08 09:38:27 UTC (rev 342) @@ -0,0 +1,123 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CMCurveFilter. +/*! +// \file mlCMCurveFilter.h +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlCMCurveFilter_H +#define __mlCMCurveFilter_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Select a curve from the curveList or curveSet +class MLCMCURVELIST_EXPORT CMCurveFilter : public BaseOp +{ +public: + + //! Constructor. + CMCurveFilter (void); + + //! Destructor + ~CMCurveFilter(void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + void SetOutputCurve(); + + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(CMCurveFilter); + + //! Remove any existing output curves + void ResetOutput(); + + //! Set the maximum values allowed for curves and series. + void SetMaxValues(); + + //! Input curve data + CurveList *m_InCurveList; + BaseField *f_InCurveList; + CurveList m_SingleCurveList; + + //! Output curve data + CurveList *m_OutCurveList; + BaseField *f_OutCurveList; + + //! Update modes + NotifyField *f_Update; + BoolField *f_AutoUpdate; + + //! Curve set range + IntField *f_MinCurveSet; + IntField *f_MaxCurveSet; + + //! Curve series range + IntField *f_MinCurve; + IntField *f_MaxCurve; + + //! Number of curves present in input + IntField *f_NumberOfCurveSets; + + //! Number of series present in input + IntField *f_NumberOfCurves; + + //! Crop the curve? + BoolField *f_CropCurve; + FloatField *f_XStart; + FloatField *f_XEnd; + +}; + + +ML_END_NAMESPACE + +#endif // __mlCMCurveFilter_H + + Deleted: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2011-02-08 09:31:14 UTC (rev 341) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2011-02-08 09:38:27 UTC (rev 342) @@ -1,232 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), -// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of BIGR nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- -//! The ML module class CurveFilter. -/*! -// \file mlCurveFilter.cpp -// \author Reinhard Hameeteman -// \date 2008-03-03 -// -// Select a curve from the curveList or curveSet -*/ -//---------------------------------------------------------------------------------- - - -// Local includes -#include "mlCurveFilter.h" -ML_START_NAMESPACE - - -//! Implements code for the runtime type system of the ML -ML_BASEOP_CLASS_SOURCE(CurveFilter, BaseOp); - -//---------------------------------------------------------------------------------- -//! Constructor -//---------------------------------------------------------------------------------- -CurveFilter::CurveFilter (void) - : BaseOp(0, 0), m_InCurveList(0) -{ - ML_TRACE_IN("CurveFilter::CurveFilter()"); - - handleNotificationOff(); - - FieldContainer *fields = getFieldContainer(); - - m_InCurveList = NULL; - f_InCurveList = fields->addBase( "inCurveList" ); - f_InCurveList->setBaseValue( m_InCurveList ); - - m_OutCurveList = new CurveList; - f_OutCurveList = fields->addBase( "outCurveList" ); - f_OutCurveList->setBaseValue( m_OutCurveList ); - - f_Update = fields->addNotify( "update" ); - f_AutoUpdate = fields->addBool( "autoUpdate" ); - f_AutoUpdate->setBoolValue( false ); - - f_MinCurveSet = fields->addInt( "minCurveSet" ); - f_MinCurveSet->setIntValue( 0 ); - - f_MaxCurveSet = fields->addInt( "maxCurveSet" ); - f_MaxCurveSet->setIntValue( 0 ); - - f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); - f_NumberOfCurveSets->setIntValue( 0 ); - - f_MinCurve = fields->addInt("minCurve"); - f_MinCurve->setIntValue( 0 ); - - f_MaxCurve = fields->addInt("maxCurve"); - f_MaxCurve->setIntValue( 0 ); - - f_NumberOfCurves = fields->addInt( "numberOfCurves" ); - f_NumberOfCurves->setIntValue( 0 ); - - f_CropCurve = fields->addBool( "cropCurve" ); - f_CropCurve->setBoolValue( false ); - - f_XStart = fields->addFloat( "start" ); - f_XStart->setFloatValue( 0.0f ); - - f_XEnd = fields->addFloat( "end" ); - f_XEnd->setFloatValue( 0.0f ); - - handleNotificationOn(); -} - - -CurveFilter::~CurveFilter(void) -{ - ResetOutput(); - delete m_OutCurveList; -} - - -//---------------------------------------------------------------------------------- -//! Handle field changes of the field \c field. -//---------------------------------------------------------------------------------- -void CurveFilter::handleNotification (Field *field) -{ - ML_TRACE_IN("CurveFilter::handleNotification()"); - - if ( field == f_InCurveList ) { - m_SingleCurveList.clear(); - m_InCurveList = NULL; - Base* baseInput = f_InCurveList->getBaseValue(); - m_InCurveList = mlbase_cast<CurveList*>(baseInput); - CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); - if (inCurve){ - m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( baseInput ) ); - m_InCurveList = &m_SingleCurveList; - } - - if ( m_InCurveList != NULL ) { - if ( f_AutoUpdate->getBoolValue() ){ - SetMaxValues(); - SetOutputCurve(); - f_OutCurveList->notifyAttachments(); - } - } else { - ResetOutput(); - f_OutCurveList->notifyAttachments(); - } - - } else - if ( field == f_Update || - (f_AutoUpdate->getBoolValue() && - (field == f_AutoUpdate || - field == f_MinCurveSet || - field == f_MaxCurveSet || - field == f_MinCurve || - field == f_MaxCurve || - field == f_CropCurve || - (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) - ))){ - if ( m_InCurveList != NULL ){ - if ( m_InCurveList->getNumCurves() > 0 ){ - SetOutputCurve(); - f_OutCurveList->notifyAttachments(); - } - } - } -} - - -void CurveFilter::ResetOutput() -{ - while ( !m_OutCurveList->getCurveList().empty() ) { - delete m_OutCurveList->getCurveList().back(); - m_OutCurveList->getCurveList().pop_back(); - } -} - - -void CurveFilter::SetMaxValues() -{ - int nCurveSets = 0; - int nCurves = 0; - if ( m_InCurveList != NULL ){ - nCurveSets = m_InCurveList->getNumCurves(); - for (int iSet = 0; iSet < nCurveSets; ++iSet ) { - nCurves = mlMax( static_cast<MLssize_t>(nCurves), m_InCurveList->getCurveData( iSet )->getNumSeries() ); - } - } - f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); - f_NumberOfCurves->setIntValue( nCurves-1 ); -} - - -void CurveFilter::SetOutputCurve(){ - - ResetOutput(); - - // Check for valid field values - // Curves are numbered from 0 - int nCurveSets = m_InCurveList->getNumCurves(); - if ( nCurveSets == 0 ) {return;} - int minSet = mlMax( static_cast<MLint>(0), f_MinCurveSet->getIntValue() ); - int maxSet = mlMax( static_cast<MLint>(minSet), f_MaxCurveSet->getIntValue() ); - maxSet = mlMin( maxSet, nCurveSets-1 ); - for (int iSet = minSet; iSet <= maxSet; ++iSet ) { - - int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); - if (nCurves == 0 ) {continue;} - int minCurve = mlMax(static_cast<MLint>(0),f_MinCurve->getIntValue() ); - int maxCurve = mlMax(static_cast<MLint>(minCurve), f_MaxCurve->getIntValue() ); - maxCurve = mlMin(maxCurve, nCurves-1 ); - for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { - - CurveData *curveSet = m_InCurveList->getCurveData( iSet ); - CurveData *outputCurve = new CurveData( *curveSet ); - outputCurve->clearData(); - std::vector< float > xSeries; - std::vector< float > ySeries; - - // Copy/Crop curve values - bool crop = f_CropCurve->getBoolValue(); - float minX = f_XStart->getFloatValue(); - float maxX = f_XEnd->getFloatValue(); - minX = mlMin(minX,maxX); - for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ - float xValue = curveSet->getXValue( iX ); - if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { - ySeries.push_back( curveSet->getYValue( minCurve, iX) ); - xSeries.push_back( xValue ); - } - } - outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); - outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); - - m_OutCurveList->getCurveList().push_back( outputCurve ); - } - } -} - - -ML_END_NAMESPACE - Deleted: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h 2011-02-08 09:31:14 UTC (rev 341) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h 2011-02-08 09:38:27 UTC (rev 342) @@ -1,123 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), -// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of BIGR nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- -//! The ML module class CurveFilter. -/*! -// \file mlCurveFilter.h -// \author Reinhard Hameeteman -// \date 2008-03-03 -// -// Select a curve from the curveList or curveSet -*/ -//---------------------------------------------------------------------------------- - - -#ifndef __mlCurveFilter_H -#define __mlCurveFilter_H - - -// Local includes -#include "../MLCMCurveListSystem.h" - -// ML includes -#include "mlOperatorIncludes.h" - -#include <mlDiagramData.h> - -ML_START_NAMESPACE - - -//! Select a curve from the curveList or curveSet -class MLCMCURVELIST_EXPORT CurveFilter : public BaseOp -{ -public: - - //! Constructor. - CurveFilter (void); - - //! Destructor - ~CurveFilter(void); - - //! Handle field changes of the field \c field. - virtual void handleNotification (Field *field); - - void SetOutputCurve(); - - -private: - - - //! Implements interface for the runtime type system of the ML. - ML_BASEOP_CLASS_HEADER(CurveFilter); - - //! Remove any existing output curves - void ResetOutput(); - - //! Set the maximum values allowed for curves and series. - void SetMaxValues(); - - //! Input curve data - CurveList *m_InCurveList; - BaseField *f_InCurveList; - CurveList m_SingleCurveList; - - //! Output curve data - CurveList *m_OutCurveList; - BaseField *f_OutCurveList; - - //! Update modes - NotifyField *f_Update; - BoolField *f_AutoUpdate; - - //! Curve set range - IntField *f_MinCurveSet; - IntField *f_MaxCurveSet; - - //! Curve series range - IntField *f_MinCurve; - IntField *f_MaxCurve; - - //! Number of curves present in input - IntField *f_NumberOfCurveSets; - - //! Number of series present in input - IntField *f_NumberOfCurves; - - //! Crop the curve? - BoolField *f_CropCurve; - FloatField *f_XStart; - FloatField *f_XEnd; - -}; - - -ML_END_NAMESPACE - -#endif // __mlCurveFilter_H - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-02-08 09:31:20
|
Revision: 341 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=341&view=rev Author: rhameeteman Date: 2011-02-08 09:31:14 +0000 (Tue, 08 Feb 2011) Log Message: ----------- KH. * Added option to get the properties of the first selected cso. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-02-08 08:56:27 UTC (rev 340) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.script 2011-02-08 09:31:14 UTC (rev 341) @@ -71,6 +71,7 @@ } TabViewItem "Main" { Box "Input" { + expandY = No ButtonBar inputMode { show = Radio } tooltip = "Use -1 for all Ids" Field inputCSOString { title = "CSO Ids:" expandX = YES visibleOn = "*inputMode == "CSO" *" } @@ -78,17 +79,20 @@ } Box "Handle Notifications" { + expandY = No CheckBox listenToFinishingNotifications { title = "Finishing" } CheckBox listenToSelectionNotifications { title = "Selection" } } Box "Operation Mode" { + expandY = No Horizontal { alignX = Left CheckBox autoUpdate {} Button update {} } // horizontal CheckBox workDirectlyOnInputList { title = "Work On Input List"} + Button getProperties { title = "Get Properties" } } Box { Label { @@ -109,6 +113,7 @@ Field CSOLabel { name = CSOLabelFld dependsOn = setCSOLabel title = "Label:" alignGroupX = csog1 } Field CSODescription { name = CSODescriptionFld dependsOn = setCSODescription title = "Description:" alignGroupX = csog1 } Field CSOTimePointIndex { name = CSOTimePointIndexFld dependsOn = setCSOTimePointIndex title = "Time Point:" alignGroupX = csog1 step = 1 } + Field CSOCreatorId { name = CSOCreatorIdFld dependsOn = setCSOCreatorId title = "CreatorId:" alignGroupX = csog1 step = 1 } Horizontal { CheckBox CSOIsSelected { name = CSOIsSelectedFld dependsOn = setCSOIsSelected title = "Is selected" alignGroupX = csog1 } CheckBox CSOClearSelection { name = CSOClearSelectionFld dependsOn = setCSOIsSelected title = "Clear first" alignGroupX = csog2 } Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-02-08 08:56:27 UTC (rev 340) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.h 2011-02-08 09:31:14 UTC (rev 341) @@ -82,6 +82,9 @@ static void CSOListNotifyObserverCB(void* userData, int notificationFlag); + //! Get the properties of first selected or first CSO of the connected CSOList + void GetProperties(); + private: @@ -122,6 +125,9 @@ //! Applies changes. NotifyField* f_Update; + //! Get the current properties. + NotifyField* f_GetPorperties; + //! Locking variable for removing/adding a notification observer. bool m_IsInNotificationCB; @@ -140,6 +146,7 @@ BoolField *f_CSOComputeNormal; StringField *f_CSOLabel; StringField *f_CSODescription; + IntField *f_CSOCreatorId; BoolField *f_CSOIsSelected; BoolField *f_CSOClearSelection; FloatField *f_CSOLineWidth; @@ -194,6 +201,7 @@ BoolField *f_SetCSOComputeNormal; BoolField *f_SetCSOLabel; BoolField *f_SetCSODescription; + BoolField *f_SetCSOCreatorId; BoolField *f_SetCSOIsSelected; BoolField *f_SetCSOLineWidth; BoolField *f_SetCSOLineStyle; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-02-08 08:56:33
|
Revision: 340 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=340&view=rev Author: rhameeteman Date: 2011-02-08 08:56:27 +0000 (Tue, 08 Feb 2011) Log Message: ----------- KH. * fixed a bug on Max values which was initialized with ML_DOUBLE_MIN which is positive, so with only negative values this was still the max. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2011-01-28 10:42:48 UTC (rev 339) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2011-02-08 08:56:27 UTC (rev 340) @@ -526,7 +526,7 @@ average = 0.0; voxelCount = 0; minimum = ML_DOUBLE_MAX; - maximum = ML_DOUBLE_MIN; + maximum = -ML_DOUBLE_MAX; // Remove data on error to avoid memory leaks. if (inputTile ) { Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-01-28 10:42:48 UTC (rev 339) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOSetProperties/mlCSOSetProperties.cpp 2011-02-08 08:56:27 UTC (rev 340) @@ -78,6 +78,8 @@ (f_AutoUpdate = fieldC->addBool( "autoUpdate"))->setBoolValue( false ); f_Update = fieldC->addNotify("update"); + f_GetPorperties = fieldC->addNotify("getProperties"); + m_IsInNotificationCB = false; m_IsNotifyingMyself = false; @@ -85,6 +87,7 @@ f_CSOComputeNormal = fieldC->addBool ("CSOComputeNormal"); f_CSOLabel = fieldC->addString("CSOLabel"); f_CSODescription = fieldC->addString("CSODescription"); + f_CSOCreatorId = fieldC->addInt ("CSOCreatorId"); f_CSOIsSelected = fieldC->addBool ("CSOIsSelected"); f_CSOClearSelection = fieldC->addBool ("CSOClearSelection"); f_CSOLineWidth = fieldC->addFloat ("CSOLineWidth"); @@ -137,6 +140,7 @@ f_CSOComputeNormal->setBoolValue( false ); f_CSOLabel->setStringValue(""); f_CSODescription->setStringValue(""); + f_CSOCreatorId->setIntValue( 0 ); f_CSOIsSelected->setBoolValue( false ); f_CSOClearSelection->setBoolValue( false ); f_CSOLineWidth->setFloatValue(1.0f); @@ -193,6 +197,7 @@ (f_SetCSOComputeNormal = fieldC->addBool( "setCSOComputeNormal" ))->setBoolValue( false ); (f_SetCSOLabel = fieldC->addBool( "setCSOLabel" ))->setBoolValue( false ); (f_SetCSODescription = fieldC->addBool( "setCSODescription" ))->setBoolValue( false ); + (f_SetCSOCreatorId = fieldC->addBool( "setCSOCreatorId" ))->setBoolValue( false ); (f_SetCSOIsSelected = fieldC->addBool( "setCSOIsSelected" ))->setBoolValue( false ); (f_SetCSOLineWidth = fieldC->addBool( "setCSOLineWidth" ))->setBoolValue( false ); (f_SetCSOLineStyle = fieldC->addBool( "setCSOLineStyle" ))->setBoolValue( false ); @@ -303,6 +308,10 @@ if (field == f_Update || f_AutoUpdate->getBoolValue() ){ SetProperties(true); } + + if (field == f_GetPorperties ){ + GetProperties(); + } } @@ -462,6 +471,7 @@ // Common if ( f_SetCSOLabel->getBoolValue() ) { currentCSO->setLabel( f_CSOLabel->getStringValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } if ( f_SetCSODescription->getBoolValue() ) { currentCSO->setDescription( f_CSODescription->getStringValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } + if ( f_SetCSOCreatorId->getBoolValue() ) { currentCSO->setCreatorId( f_CSOCreatorId->getIntValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } if ( f_SetCSOTimePointIndex->getBoolValue() ) { currentCSO->setTimePointIndex( f_CSOTimePointIndex->getIntValue() ); notificationFlag |= CSOList::NOTIFICATION_CSO_FINISHED; } if ( f_SetCSOIsSelected->getBoolValue() ) { @@ -602,6 +612,42 @@ } } +void CSOSetProperties::GetProperties() +{ + CSO* cso = m_InputCSOList->getSelectedCSOAt(0); + + if ( !cso ) { + cso = m_InputCSOList->getCSOAt(0); + } + + if (cso) { + // Common + f_CSOLabel->setStringValue( cso->getLabel() ); + f_CSODescription->setStringValue( cso->getDescription() ); + f_CSOCreatorId->setIntValue( cso->getCreatorId() ); + f_CSOTimePointIndex->setIntValue( cso->getTimePointIndex()); + f_CSOShowState->setBoolValue( cso->getShowState() ); + f_CSOVoxelizeState->setBoolValue( cso->getVoxelizeState() ); + f_CSOEditableState->setBoolValue( cso->getEditableState() ); + + // PathPoints + f_CSOLineStyle->setEnumValue( cso->getLineStyle() ); + f_CSOLineWidth->setFloatValue( cso->getLineWidth() ); + f_CSOColor->setVec3fValue( cso->getColor() ); + f_CSOAlpha->setFloatValue( cso->getAlpha() ); + + // Markers + f_CSOMarkerMode->setEnumValue( cso->getMarkerMode() ); + f_CSOMarkerColor->setVec3fValue( cso->getMarkerColor() ); + f_CSOMarkerAlpha->setFloatValue( cso->getMarkerAlpha() ); + f_CSOMarkerSize->setFloatValue( cso->getMarkerSize() ); + + // Voxelize + f_CSOVoxelWriteMode->setEnumValue( cso->getVoxelWriteMode() ); + f_CSOVoxelWriteValue->setFloatValue( cso->getVoxelWriteValue() ); + } +} + void CSOSetProperties::CSOListNotifyObserverCB(void* userData, int notificationFlag) { ML_TRACE_IN("CSOSetProperties::_csoListNotifyObserverCB"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2011-01-28 10:42:54
|
Revision: 339 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=339&view=rev Author: coertmetz Date: 2011-01-28 10:42:48 +0000 (Fri, 28 Jan 2011) Log Message: ----------- CM: Bug caused modules starting with the name of the fieldtrigger to be removed from the list. Modified Paths: -------------- trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py Modified: trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py 2011-01-24 16:35:45 UTC (rev 338) +++ trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py 2011-01-28 10:42:48 UTC (rev 339) @@ -49,7 +49,7 @@ def UpdateModuleList(): '''Get a list of all modules in the network and filter out this module''' network = ctx.parent() - moduleList = filter( lambda x: x.find( ctx.field('instanceName').value ),network.modules() ) + moduleList = filter( lambda x: ( x != ctx.field('instanceName').value ),network.modules() ) ctx.field('moduleList').value = ','.join(moduleList) return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-01-24 16:35:51
|
Revision: 338 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=338&view=rev Author: rhameeteman Date: 2011-01-24 16:35:45 +0000 (Mon, 24 Jan 2011) Log Message: ----------- KH. * Made the script window expandable Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2011-01-24 16:13:59 UTC (rev 337) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2011-01-24 16:35:45 UTC (rev 338) @@ -26,8 +26,10 @@ Window { width = 600 Category Main { + expandY = Yes Vertical { margin = 4 + expandY = Yes TextView matlabScript { dependsOn = !useExternalScript autoApply = Yes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2011-01-24 16:14:07
|
Revision: 337 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=337&view=rev Author: rhameeteman Date: 2011-01-24 16:13:59 +0000 (Mon, 24 Jan 2011) Log Message: ----------- KH. * Added a module to load and save Matlab .mat files from within MeVisLab. Modified Paths: -------------- trunk/Community/General/Modules/Macros/FileIO/FileIterator.script Added Paths: ----------- trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.def trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.mlab trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.py trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.script trunk/Community/General/Modules/Macros/FileIO/html/MatlabReadWrite.html Modified: trunk/Community/General/Modules/Macros/FileIO/FileIterator.script =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/FileIterator.script 2011-01-18 08:51:38 UTC (rev 336) +++ trunk/Community/General/Modules/Macros/FileIO/FileIterator.script 2011-01-24 16:13:59 UTC (rev 337) @@ -209,7 +209,10 @@ Vertical Selection { - Box "File Set Selection" { layout = Vertical + alignY = Top + Box "File Set Selection" { + layout = Vertical + expandY = No droppedFileCommand = "*js: ctx.field("rootPath").value = arguments[0]; *" Field rootPath { title = "Root Path:" @@ -245,7 +248,9 @@ } } // Box "File Set Selection" - Box "Filename Patterns" { layout = Vertical + Box "Filename Patterns" { + layout = Vertical + expandY = No margin = 0 expandX = yes Horizontal { @@ -302,6 +307,7 @@ } } Vertical Name { + expandY = No Box "User String Template Variables" { layout = Vertical Field userStringS { title = "User String $S:" alignGroupX = nameC1 } Added: trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.def =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.def (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.def 2011-01-24 16:13:59 UTC (rev 337) @@ -0,0 +1,22 @@ +//---------------------------------------------------------------------------------- +//! MatlabReadWrite module definition +/*! +// \file MatlabReadWrite.def +// \author Reinhard Hameeteman +// \date 2011-01-24 +*/ +//---------------------------------------------------------------------------------- + +MacroModule MatlabReadWrite { + documentation = "$(LOCAL)/html/MatlabReadWrite.html" + genre = File + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "conversion between a MeVisLab image and Matlab mat files" + keywords = "read write convert matlab mevislab image matrix" + seeAlso = "ImageLoad ImageSave" + exampleNetwork = "$(LOCAL)/networks/MatlabReadWriteExample.mlab" + externalDefinition = "$(LOCAL)/MatlabReadWrite.script" + +} // MacroModule MatlabReadWrite + Added: trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.mlab =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.mlab 2011-01-24 16:13:59 UTC (rev 337) @@ -0,0 +1,112 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module MatlabScriptWrapper { + internal { + frame = "701 461 168 56" + moduleGroupName = "" + windows { + window _default { + geometry = "819 224 600 804" + sizeHint = "600 579" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = MatlabScriptWrapper + matlabScript = "if read == 1 + vars=whos('-file',fileName); + exists=false; + foundNames = []; + for i=1:size(vars,1) + if strcmp(vars(i).name, varName) + exists= true; + end + foundNames=[foundNames ',' vars(i).name]; + end + if exists + load( fileName ); + Output0=Input0; + else + result=['Variable not found; only found: ' foundNames]; + end +else + save(string0,['Input' type]) +end" + useExternalScript = FALSE + matlabScriptPath = "" + inDataName0 = Input0 + inDataName1 = Input1 + inDataName2 = Input2 + outDataName0 = Output0 + outDataName1 = Output1 + outDataName2 = Output2 + inXMarkerName = InputXMarkerList + outXMarkerName = OutputXMarkerList + inWEMName = InputWEM + outWEMName = OutputWEM + inCurveName = InputCurveList + outCurveName = OutputCurveList + autoUpdate = FALSE + autoApply = FALSE + status = Ready. + scalarName0 = scalar0 + scalar0 = 0 + scalarName1 = scalar1 + scalar1 = 0 + scalarName2 = scalar2 + scalar2 = 0 + scalarName3 = scalar3 + scalar3 = 0 + scalarName4 = scalar4 + scalar4 = 0 + scalarName5 = scalar5 + scalar5 = 0 + stringName0 = fileName + string0 = "" + stringName1 = type + string1 = "" + stringName2 = varName + string2 = "" + stringName3 = result + string3 = "" + stringName4 = string4 + string4 = "" + stringName5 = string5 + string5 = "" + vectorName0 = vector0 + vector0 = "0 0 0 0" + vectorName1 = vector1 + vector1 = "0 0 0 0" + vectorName2 = vector2 + vector2 = "0 0 0 0" + vectorName3 = vector3 + vector3 = "0 0 0 0" + vectorName4 = vector4 + vector4 = "0 0 0 0" + vectorName5 = vector5 + vector5 = "0 0 0 0" + matrixName0 = matrix0 + matrix0 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName1 = matrix1 + matrix1 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matrixName2 = matrix2 + matrix2 = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + matlabOutput = "" + showSessionWindow = TRUE + } +} +connections = "" +networkModel = "" Added: trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.py =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.py (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.py 2011-01-24 16:13:59 UTC (rev 337) @@ -0,0 +1,69 @@ +#---------------------------------------------------------------------------------- +#! Macro module MatlabReadWrite +#/*! +# \file MatlabReadWrite.py +# \author Reinhard Hameeteman +# \date 2011-01-24 +# +# conversion between a MeVisLab image and Matlab mat files +#*/ +#---------------------------------------------------------------------------------- + +from mevis import * + +types = {'Image':'0', + 'XMarkerList':'XMarkerList', + 'WEM':'WEM', + 'CurveList':'CurveList'} +script = "\ +vars=whos(\'-file\',fileName);\n\ +exists=false;\n\ +foundNames = [];\n\ +for i=1:size(vars,1)\n\ + if strcmp(vars(i).name, varName)\n\ + exists= true;\n\ + end\n\ + foundNames=[foundNames vars(i).name ',' ];\n\ +end\n\ +if exists \n\ + load( fileName );\n\ + <Output>= <Input>;\n\ +else\n\ + result=[\'Variable not found; only found: \' foundNames];\n\ +end\n\ +" + +def Save(): + global types,script + type = types[ctx.field("type").value] + ctx.field("MatlabScriptWrapper.matlabScript").value = "save(fileName,\'Input"+type+"\')" + ctx.field("MatlabScriptWrapper.update").touch() + return + +def Load(): + global types, script + ctx.field("MatlabScriptWrapper.scalar0").value = 1 + type = types[ctx.field("type").value] + ctx.field("MatlabScriptWrapper.string1").value = type + varName = ctx.field("variableName") + if varName.value == "" : + varName.value = "Input"+type + ctx.field("MatlabScriptWrapper.string2").value = varName.value + loadScript = script.replace('<Output>','Output'+type) + loadScript = loadScript.replace('<Input>',varName.value) + ctx.field("MatlabScriptWrapper.matlabScript").value = loadScript + ctx.field("MatlabScriptWrapper.update").touch() + result = ctx.field("MatlabScriptWrapper.string3") + if result.value != "" : + ctx.field("MatlabScriptWrapper.status").value = result.value.strip(',') + result.value = "" + return + + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBANEfsmYse2e1dRhkQ9AQbreCq9uxwzWLoGom13MNYmyfwoJqQOEXljLFAgw2eEjaT12G4CdqKWhRxh9ANP6n7GMCARE=:VI/mB8bT4u+mRtf/ru8yUQi8BzpaS3UeL2x62YxsUYnVqCWuLrVNLiukIIjnJMKQXlc8ezmgOIcVAV7pgvgKpQ== +#//# owner: MeVis +#//# date: 2010-06-22T21:02:14 +#//# hash: WZ2Zrb7QlWYG9lWMjeYuCHRLvxmYYaZ6MQqO9Kg9XxPCBYK/DJHa2Qh3o2PxB1FLSyHsag8deKQO4CvxQgQMAA== +#//# MeVis end + Added: trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.script =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.script (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/MatlabReadWrite.script 2011-01-24 16:13:59 UTC (rev 337) @@ -0,0 +1,68 @@ +//---------------------------------------------------------------------------------- +//! Macro module MatlabReadWrite +/*! +// \file MatlabReadWrite.script +// \author Reinhard Hameeteman +// \date 2011-01-24 +// +// conversion between a MeVisLab image and Matlab mat files +*/ +//---------------------------------------------------------------------------------- + + +Interface { + Inputs { + Field input0 { internalName = MatlabScriptWrapper.input0 } + Field inXMarkerList { internalName = MatlabScriptWrapper.inputXMarkerList } + Field inWEM { internalName = MatlabScriptWrapper.inputWEM } + Field inCurveList { internalName = MatlabScriptWrapper.inputCurve } + } + Outputs { + Field output0 { internalName = MatlabScriptWrapper.output0 } + Field outXMarkerList { internalName = MatlabScriptWrapper.outputXMarkerList } + Field outWEM { internalName = MatlabScriptWrapper.outputWEM } + Field outCurveList { internalName = MatlabScriptWrapper.outputCurveList } + } + Parameters { + Field save { type = Trigger } + Field load { type = Trigger } + Field fileName { internalName = MatlabScriptWrapper.string0 } + Field variableName { type = String value = "" } + Field type { + type = Enum + items { + item Image {} + item XMarkerList {} + item WEM {} + item CurveList {} + } + } + } +} + + +Commands { + source = $(LOCAL)/MatlabReadWrite.py + FieldListener load { command = Load } + FieldListener save { command = Save } +} + +Window { + Box { + ButtonBar type { show = Radio title = Type } + Field fileName { browseButton = Yes } + Field save {} + Field load {} + Field variableName {} + Field MatlabScriptWrapper.restartMatlab { title = Restart } + Field MatlabScriptWrapper.status { edit = No} + } +} + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBANEfsmYse2e1dRhkQ9AQbreCq9uxwzWLoGom13MNYmyfwoJqQOEXljLFAgw2eEjaT12G4CdqKWhRxh9ANP6n7GMCARE=:VI/mB8bT4u+mRtf/ru8yUQi8BzpaS3UeL2x62YxsUYnVqCWuLrVNLiukIIjnJMKQXlc8ezmgOIcVAV7pgvgKpQ== +//# owner: MeVis +//# date: 2010-06-22T21:02:14 +//# hash: VRybCdbKA/kSEACdXizQO5SmWnw5W2WxDiOQwTBg3jGSU7vFPbBvyBhmopyHgNRv8EzY7mYPj22sk8HNYrgpkw== +//# MeVis end + Added: trunk/Community/General/Modules/Macros/FileIO/html/MatlabReadWrite.html =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/html/MatlabReadWrite.html (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/html/MatlabReadWrite.html 2011-01-24 16:13:59 UTC (rev 337) @@ -0,0 +1,69 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>MatlabReadWrite</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>You can use this module to convert some MeVisLab data structures to and from Matlab array and save or load them from a .mat file +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>For saving: +Connect the input, select the appropriate type, specify the file name and press save. The saved .mat file will contain an array with the default name Input0, InputXMarkerList, InputWem or InputCurveList, depending on the choosen type. + +For loading: +Specify the file name, select the type and if necessary the variable name. You have to specify this name if you saved the array in Matlab with a differen name than the standard names: Input0, InputXMarkerList, InputWem or InputCurveList. +</blockquote> + + + + + + + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>type</b> + Select which data type should be saved or loaded + </li> + <li> + <b>fileName</b> + Full path to the file + </li> + <li> + <b>save</b> + Save the specified input to a .mat file + </li> + <li> + <b>load</b> + Load the specified input form a .mat file + </li> + <li> + <b>variableName</b> + Name of the variable in the .mat file that needs to be loaded. If you do not specify this value the default Input0, InputXMarkerList, InputWem or InputCurveList will be choosen + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <awa...@us...> - 2011-01-18 08:51:45
|
Revision: 336 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=336&view=rev Author: awakeideas Date: 2011-01-18 08:51:38 +0000 (Tue, 18 Jan 2011) Log Message: ----------- Added patch against revision 327 by Jens Kaftan. Unfortunately, I don't have the time right now to integrate the patch. Below are Jens's comments about the patch's purpose (German): Wir haben im laufe des letzten Jahres sehr viel mit Eurem MatlabScriptWrapper in MevisLab gearbeitet und haben dieses Modul als extrem hilfreich empfunden. Um das ganze vielleicht noch etwas zu verbessern, habe ich folgend eine Liste zusammengestellt ueber features/bugfixes, die ich waehrend meiner Arbeit und meinen speziellen Anforderungen als sehr hilfreich empfunden habe. Vielleicht waere es fuer Euch interessant die ein od. andere Idee aufzugreifen. Im Anhang findet Ihr auch die entsprechenden sourcen (fuer ML 2.1 - gibt sicherlich an der ein od. anderen Stelle bessere Implementierung, es sollte aber zumindest die Idee verdeutlichen). Leider beruhen sie nicht auf der aller neuesten Version die es im SVN gibt. 1. Bugfix: notifyAttachments() should be only invoked if, e.g., tmpScalars[k] != _scalarFld[k]->getDoubleValue() (instead of ==). 2. Bugfix: _get*BackFromMatlab() should not notify attachments (this is done as described above). I.e., around _scalarFld[i]->setDoubleValue(fieldVal[0]); should be disable/enable-Notifications block to avoid the set methods to trigger notify attachments. 3. Hazardous situation: If multiple MatlabWrapper are present in one network representing the same functionality (same output image names), it is likely that the result of one instance gets hampered by a second instance as both will use the same memory in matlab without necessarily getting the information back into ML before the volume is requested by subsequent modules. 4. Improvements: Automatically changed directory to external matlab script to use further local matlab functions 5. Improvements: Enabled path variables %NAME% to be used in path to external matlab script (which we found to be very useful if working on the same project with different people who might have different file structures) 6. Personal taste: When using an external script, its content gets automatically copied into the edit field -> this allows for simple editing/testing if an error occurs 7. Personal taste: Processing times of the matlab part only are reported 8. Personal taste: A done trigger button is pressed when e.th. is finished -> usefull to avoid unnecessary computations if multiple fields among MatlabScriptWrapper are connected 9. For information only: The added code extends the module to 4 in/outputs each. Ich hoffe die ein oder andere Information war hilfreich. Fuer Rueckfragen stehe ich gerne zur Verfuegung. Revision Links: -------------- http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=327&view=rev Added Paths: ----------- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper-Jens-r327.patch Added: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper-Jens-r327.patch =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper-Jens-r327.patch (rev 0) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper-Jens-r327.patch 2011-01-18 08:51:38 UTC (rev 336) @@ -0,0 +1,726 @@ +Index: MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp +=================================================================== +--- MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp (revision 327) ++++ MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp (working copy) +@@ -26,9 +26,11 @@ + //! The ML module class MatlabScriptWrapper. + /*! + // \file mlMatlabScriptWrapper.cpp +-// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter, Alexander Broersen ++// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter, Alexander Broersen, Jens Kaftan + // \date 2009-02-23 + // ++// $Id$ ++// + // Module for executing Matlab scripts in MeVisLab. + */ + //---------------------------------------------------------------------------------- +@@ -62,7 +64,7 @@ + //! Constructor + //---------------------------------------------------------------------------------- + MatlabScriptWrapper::MatlabScriptWrapper (void) +-: BaseOp(3, 3) ++: BaseOp(4, 4) + { + ML_TRACE_IN("MatlabScriptWrapper::MatlabScriptWrapper()") + +@@ -85,6 +87,7 @@ + + //! Use external Matlab script. + (_useExternalScriptFld = fields->addBool("useExternalScript"))->setBoolValue(false); ++ (_changePathToScriptLocationFld = fields->addBool("changePathToScriptLocation"))->setBoolValue(false); + + //! Where will Matlab script be dumped. + (_matlabScriptPathFld = fields->addString("matlabScriptPath"))->setStringValue(""); +@@ -93,9 +96,16 @@ + (_inDataNameFld[0] = fields->addString("inDataName0"))->setStringValue("Input0"); + (_inDataNameFld[1] = fields->addString("inDataName1"))->setStringValue("Input1"); + (_inDataNameFld[2] = fields->addString("inDataName2"))->setStringValue("Input2"); ++ (_inDataNameFld[3] = fields->addString("inDataName3"))->setStringValue("Input3"); + (_outDataNameFld[0] = fields->addString("outDataName0"))->setStringValue("Output0"); + (_outDataNameFld[1] = fields->addString("outDataName1"))->setStringValue("Output1"); + (_outDataNameFld[2] = fields->addString("outDataName2"))->setStringValue("Output2"); ++ (_outDataNameFld[3] = fields->addString("outDataName3"))->setStringValue("Output3"); ++ ++ //! Init output subimg array. ++ for(int i=0; i<4; i++) { ++ _outDataArray[i] = NULL; ++ } + //! Set input and output XMarker names used in matlab. + (_inXMarkerNameFld = fields->addString("inXMarkerName"))->setStringValue("inXMarker"); + (_outXMarkerNameFld = fields->addString("outXMarkerName"))->setStringValue("outXMarker"); +@@ -110,6 +120,7 @@ + //(_deleteMatlabVarFld = fields->addBool("delMatlabVar"))->setBoolValue(false); + //! Add update button. + _calculateFld = fields->addNotify("update"); ++ _processingFinishedFld = fields->addNotify("done"); + //! Add restart Matlab button. + _restartMatlabFld = fields->addNotify("restartMatlab"); + // Error message. +@@ -238,6 +249,14 @@ + { + ML_TRACE_IN("MatlabScriptWrapper::~MatlabScriptWrapper()"); + ++ for(int i=0; i<4; i++) { ++ if(_outDataArray[i] != NULL) ++ { ++ delete(_outDataArray[i]); ++ _outDataArray[i] = NULL; ++ } ++ } ++ + if (m_pEngine != NULL) { + engClose(m_pEngine); + } +@@ -279,7 +298,8 @@ + + // 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 == getInField(3))|| + (field == _inputXMarkerListFld)) || (field== _inputWEMFld) ) || + (_autoApplyFld->isOn() && ((field == _scalarFld[0])||(field == _scalarFld[1])||(field == _scalarFld[2])|| + (field == _scalarFld[3])||(field == _scalarFld[4])||(field == _scalarFld[5])|| +@@ -301,9 +321,12 @@ + bool validScriptString = true; + if(_useExternalScriptFld->isOn()) { // Get script from .m-file + validScriptString = _loadMatlabScriptFromFile(evaluateString); ++ std::cout << "MatlabScriptWrapper - " << "perform matlab from script: " << _matlabScriptPathFld->getStringValue() << std::endl; + } else { + evaluateString = _matlabScriptFld->getStringValue(); ++ std::cout << "MatlabScriptWrapper - " << "perform matlab from text field." << std::endl; + } ++ clock_t timer_start=clock(); + + // Execute Matlab script only when the string is valid + if(validScriptString) { +@@ -335,7 +358,7 @@ + + // Insert at the end of the script variable to proof execution status + // and run the script in Matlab +- evaluateString += "\nmevmatscr=1;"; // Added ';' to prevent unnecessary output ++ evaluateString += "\nmevmatscr=1;"; // Added ';' to prevent unnecessary output + _statusFld->setStringValue("Matlab script is executing...."); + + // Buffer to capture Matlab output +@@ -365,6 +388,8 @@ + _clearAllVariables(); + } + mxDestroyArray(mtmp); mtmp = NULL; ++ clock_t timer_stop=clock(); ++ std::cout << "MatlabScriptWrapper - " << "... finished in " << static_cast<double>(timer_stop-timer_start)/CLOCKS_PER_SEC << " seconds." << std::endl; + } + // If the script string was not valid, clear all data so that + // the user notes this. +@@ -388,7 +413,7 @@ + } + _getScalarsBackFromMatlab(); + for(int k=0; k<6; ++k) { +- if(tmpScalars[k] == _scalarFld[k]->getDoubleValue()) { ++ if(tmpScalars[k] != _scalarFld[k]->getDoubleValue()) { + _scalarFld[k]->notifyAttachments(); + } + } +@@ -400,7 +425,7 @@ + } + _getStringsBackFromMatlab(); + for(int k=0; k<6; ++k) { +- if(tmpstrings[k] == _stringFld[k]->getStringValue()) { ++ if(tmpstrings[k] != _stringFld[k]->getStringValue()) { + _stringFld[k]->notifyAttachments(); + } + } +@@ -412,7 +437,7 @@ + } + _getVectorsBackFromMatlab(); + for(int k=0; k<6; ++k) { +- if(tmpstrings[k] == _vectorFld[k]->getStringValue()) { ++ if(tmpstrings[k] != _vectorFld[k]->getStringValue()) { + _vectorFld[k]->notifyAttachments(); + } + } +@@ -424,16 +449,19 @@ + } + _getMatricesBackFromMatlab(); + for(int k=0; k<3; ++k) { +- if(tmpstrings[k] == _matrixFld[k]->getStringValue()) { ++ if(tmpstrings[k] != _matrixFld[k]->getStringValue()) { + _matrixFld[k]->notifyAttachments(); + } + } + + // Notify image attachments that are new images calculated so that they + // update themselves and call the calcOutSubImage() ++ _getOutputImageDataBackFromMatlab(); ++ + getOutField(0)->notifyAttachments(); + getOutField(1)->notifyAttachments(); + getOutField(2)->notifyAttachments(); ++ getOutField(3)->notifyAttachments(); + + // Notify the XMarkerList output + _outputXMarkerListFld->notifyAttachments(); +@@ -447,7 +475,11 @@ + ecList.push_back(ec); + + _outWEM->notifyObservers(ecList); ++ ++ _clearAllVariables(); ++ _processingFinishedFld->notify(); + } ++ + } + + //---------------------------------------------------------------------------------- +@@ -458,7 +490,7 @@ + ML_TRACE_IN("MatlabScriptWrapper::handleInput ()"); + + // If one of inputs is open we close it artificially by setting the input to a dummy input. +- if((inIndex == 0)||(inIndex == 1)||(inIndex == 2)) { ++ if((inIndex == 0)||(inIndex == 1)||(inIndex == 2)||(inIndex == 3)) { + return BaseOp::REDIRECT_TO_DUMMY_OP; + } + // If any other input is not present or invalid, we cannot do any processing. +@@ -469,7 +501,7 @@ + + + #if ML_MAJOR_VERSION >= 2 +-# define __setInSubImageDataType(__t) for(int __i=0;__i<3;++__i) {getOutImg(outIndex)->setInSubImageDataType(__i,__t);} ++# define __setInSubImageDataType(__t) for(int __i=0;__i<4;++__i) {getOutImg(outIndex)->setInSubImageDataType(__i,__t);} + #else + # define __setInSubImageDataType(__t) + #endif +@@ -493,65 +525,24 @@ + return; + } + +- // Get variable name in the Matlab workspace of the output image +- std::string outname = _outDataNameFld[outIndex]->getStringValue(); +- mxArray *m_pImage = engGetVariable(m_pEngine, outname.c_str()); +- + // If we can find the variable and calculate its size, go on. +- if(m_pImage != NULL) ++ if((_outDataArray[outIndex] != NULL)) + { +- const mwSize m_numDims = mxGetNumberOfDimensions(m_pImage); +- if(m_numDims>6) { +- std::cerr << "calcOutImageProps(): Too many dimensions in Matlab image!" << std::endl << std::flush; +- return; +- } +- Vector outExt = Vector(1,1,1,1,1,1); +- for (size_t i=0; i<m_numDims; i++) +- { +- outExt[i] = static_cast<MLint>(mxGetDimensions(m_pImage)[i]); +- } ++ Vector outExt = _outDataArray[outIndex]->GetExtend(); + + // Set page size. + getOutImg(outIndex)->setPageExt(outExt); + // Set output image size. + getOutImg(outIndex)->setImgExt(outExt); + // Set output image datatype. +- switch (mxGetClassID(m_pImage)) { +- 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; +- default: +- getOutImg(outIndex)->setDataType(ML_BAD_DATA_TYPE); +- std::cerr << "calcOutImageProps(): Output type from Matlab not supported" << std::endl << std::flush; +- } +- mxDestroyArray(m_pImage); m_pImage = NULL; +- +- // Get min and max values in Matlab workspace and set them in MeVisLab +- std::ostringstream minmaxCommand; +- minmaxCommand << "mevtmpminval = min(" << outname << "(:));" << "mevtmpmaxval = max(" << outname << "(:));"; +- engEvalString(m_pEngine, minmaxCommand.str().c_str()); +- mxArray *minVal = engGetVariable(m_pEngine, "mevtmpminval"); +- mxArray *maxVal = engGetVariable(m_pEngine, "mevtmpmaxval"); +- // if min and max are not defined, set default values +- if ((minVal==NULL) || (minVal==NULL)) { +- getOutImg(outIndex)->setMinVoxelValue(0); +- getOutImg(outIndex)->setMaxVoxelValue(127); +- } else { +- getOutImg(outIndex)->setMinVoxelValue(mxGetScalar(minVal)); +- getOutImg(outIndex)->setMaxVoxelValue(mxGetScalar(maxVal)); +- } +- mxDestroyArray(minVal); minVal = NULL; +- mxDestroyArray(maxVal); maxVal = NULL; +- engEvalString(m_pEngine, "clear mevtmpminval mevtmpmaxval"); +- } else { ++ getOutImg(outIndex)->setDataType( _outDataArray[outIndex]->GetDataType() ); __setInSubImageDataType(MLdoubleType); ++ ++ // Get min and max values and set them in MeVisLab ++ getOutImg(outIndex)->setMinVoxelValue( _outDataArray[outIndex]->GetMinValue() ); ++ getOutImg(outIndex)->setMaxVoxelValue( _outDataArray[outIndex]->GetMaxValue() ); ++ } // if((_outDataArray[outIndex] != NULL)) ++ else ++ { + getOutImg(outIndex)->setOutOfDate(); + getOutImg(outIndex)->setStateInfo("Cannot set output size, because variable could not be found in Matlab workspace.",ML_BAD_DATA_TYPE); + } +@@ -580,7 +571,8 @@ + { + ML_TRACE_IN("MatlabScriptWrapper::calcInSubImageBox ()"); + +- return outSubImgBox; ++ return SubImgBox(Vector(0), Vector(-1)); ++ //return outSubImgBox; + } + + //---------------------------------------------------------------------------------- +@@ -597,37 +589,16 @@ + return; + } + +- // Get matlab image data. +- mxArray *m_pImage = engGetVariable(m_pEngine, (_outDataNameFld[outIndex]->getStringValue()).c_str()); +- +- if ( (m_pImage != NULL) ) { +- // Copy different types of images from Matlab. +- MLPhysicalDataType outputClass; +- switch (mxGetClassID(m_pImage)) { +- case mxDOUBLE_CLASS: outputClass = MLdoubleType; break; +- case mxSINGLE_CLASS: outputClass = MLfloatType; break; +- case mxINT8_CLASS: outputClass = MLint8Type; break; +- case mxUINT8_CLASS: outputClass = MLuint8Type; break; +- case mxINT16_CLASS: outputClass = MLint16Type; break; +- case mxUINT16_CLASS: outputClass = MLuint16Type; break; +- case mxINT32_CLASS: outputClass = MLint32Type; break; +- case mxUINT32_CLASS: outputClass = MLuint32Type; break; +- case mxINT64_CLASS: // Matlab does not support basic operations on this type +- //outputClass = MLint64Type; +- //break; +- default: +- outputClass = ML_BAD_DATA_TYPE; +- std::cerr << "calcOutSubImage(): Output type from Matlab not supported" << std::endl << std::flush; +- } +- SubImg subImgBuf(outSubImg->getBox(), outputClass, mxGetPr(m_pImage)); ++ if ( (_outDataArray[outIndex] != NULL) ) ++ { ++ SubImg subImgBuf(SubImageBox(_outDataArray[outIndex]->GetExtend()), _outDataArray[outIndex]->GetDataType(), _outDataArray[outIndex]->GetData()); + outSubImg->copySubImage(subImgBuf); +- +- mxDestroyArray(m_pImage); m_pImage = NULL; + } + else + { + // Throw error, if no data available. +- ML_PRINT_ERROR("MatlabScriptWrapper::calcOutSubImage()", ML_BAD_INPUT_IMAGE_POINTER, "Cannot copy from Matlab data."); ++ outSubImg->fillSubImg(0.0); ++ //ML_PRINT_ERROR("MatlabScriptWrapper::calcOutSubImage()", ML_BAD_INPUT_IMAGE_POINTER, "Cannot copy from Matlab data."); + } + } + +@@ -655,6 +626,15 @@ + } + else + { ++ // Find %name% in string if existent ++ size_t firstLoc = pathString.find("%"); ++ size_t lastLoc = pathString.rfind("%"); ++ if(firstLoc != lastLoc) ++ { ++ std::string variableName = pathString.substr(firstLoc+1, lastLoc-firstLoc-1); ++ char* systemVariable = getenv( variableName.c_str() ); ++ pathString = pathString.replace(firstLoc, lastLoc-firstLoc+1, systemVariable); ++ } + // File to open. + std::ifstream dat; + dat.open(pathString.c_str()); +@@ -664,6 +644,18 @@ + return false; + } + ++ // Add matlab command to change path if specified ++ if(_changePathToScriptLocationFld->isOn()) ++ { ++ // Extract path of .m file ++ size_t endPos=pathString.rfind("/"); ++ if(endPos != std::string::npos) ++ { ++ std::string changeFolderCommand = "cd " + pathString.substr(0, endPos) + ";"; ++ tmpString << changeFolderCommand << "\n"; ++ } ++ } ++ + // Read script line by line from file. + std::string line; + while(!dat.eof()) +@@ -677,6 +669,7 @@ + + // Get string + evaluateString = tmpString.str(); ++ _matlabScriptFld->setStringValue( evaluateString ); + } + } + ML_CATCH_RETHROW; +@@ -730,12 +723,12 @@ + } + + // Clear input images +- for(int i=0; i<3; i++) { ++ for(int i=0; i<4; i++) { + clearString << _inDataNameFld[i]->getStringValue() << " "; + } + + // Clear output images +- for(int i=0; i<3; i++) { ++ for(int i=0; i<4; i++) { + clearString << _outDataNameFld[i]->getStringValue() << " "; + } + +@@ -764,7 +757,7 @@ + return; + } + +- for(int i=0; i<3; i++) ++ for(int i=0; i<4; i++) + { + // Get a valid input if possible. Dummy input is considered invalid. + PagedImg *inImg = getUpdatedInImg(i); +@@ -845,6 +838,91 @@ + } + } + ++void MatlabScriptWrapper::_getOutputImageDataBackFromMatlab() ++{ ++ for(int i=0; i<4; i++) ++ { ++ if(_outDataArray[i] != NULL) ++ { ++ delete(_outDataArray[i]); ++ _outDataArray[i] = NULL; ++ } ++ } ++ ++ // Check if Matlab is started. ++ if (!_checkMatlabIsStarted()) ++ { ++ std::cerr << "_getOutputImageDataBackFromMatlab(): Cannot find Matlab engine!" << std::endl << std::flush; ++ return; ++ } ++ ++ for(int outIndex=0; outIndex<4; outIndex++) ++ { ++ // Get matlab image data. ++ std::string outname = _outDataNameFld[outIndex]->getStringValue(); ++ mxArray *m_pImage = engGetVariable(m_pEngine, outname.c_str()); ++ ++ if ( (m_pImage != NULL) ) ++ { ++ const mwSize m_numDims = mxGetNumberOfDimensions(m_pImage); ++ if(m_numDims>6) { ++ std::cerr << "_getOutputImageDataBackFromMatlab(): Too many dimensions in Matlab image!" << std::endl << std::flush; ++ return; ++ } ++ Vector outExt = Vector(1,1,1,1,1,1); ++ for (size_t i=0; i<m_numDims; i++) ++ { ++ outExt[i] = static_cast<MLint>(mxGetDimensions(m_pImage)[i]); ++ } ++ ++ // Copy different types of images from Matlab. ++ MLPhysicalDataType outputClass; ++ switch (mxGetClassID(m_pImage)) { ++ case mxDOUBLE_CLASS: outputClass = MLdoubleType; break; ++ case mxSINGLE_CLASS: outputClass = MLfloatType; break; ++ case mxINT8_CLASS: outputClass = MLint8Type; break; ++ case mxUINT8_CLASS: outputClass = MLuint8Type; break; ++ case mxINT16_CLASS: outputClass = MLint16Type; break; ++ case mxUINT16_CLASS: outputClass = MLuint16Type; break; ++ case mxINT32_CLASS: outputClass = MLint32Type; break; ++ case mxUINT32_CLASS: outputClass = MLuint32Type; break; ++ default: ++ outputClass = ML_BAD_DATA_TYPE; ++ std::cerr << "_getOutputImageDataBackFromMatlab(): Output type from Matlab not supported" << std::endl << std::flush; ++ } ++ ++ _outDataArray[outIndex] = new MatlabScriptWrapperOutputData(); ++ _outDataArray[outIndex]->SetData( outExt, outputClass, mxGetPr(m_pImage) ); ++ ++ mxDestroyArray(m_pImage); ++ m_pImage = NULL; ++ ++ // Get min and max values in Matlab workspace and set them in MeVisLab ++ std::ostringstream minmaxCommand; ++ minmaxCommand << "mevtmpminval = min(" << outname << "(:));" << "mevtmpmaxval = max(" << outname << "(:));"; ++ engEvalString(m_pEngine, minmaxCommand.str().c_str()); ++ mxArray *minVal = engGetVariable(m_pEngine, "mevtmpminval"); ++ mxArray *maxVal = engGetVariable(m_pEngine, "mevtmpmaxval"); ++ // if min and max are not defined, set default values ++ if ((minVal==NULL) || (minVal==NULL)) ++ { ++ _outDataArray[outIndex]->SetMinMaxValue(0,127); ++ } else ++ { ++ _outDataArray[outIndex]->SetMinMaxValue(mxGetScalar(minVal), mxGetScalar(maxVal)); ++ } ++ mxDestroyArray(minVal); minVal = NULL; ++ mxDestroyArray(maxVal); maxVal = NULL; ++ engEvalString(m_pEngine, "clear mevtmpminval mevtmpmaxval"); ++ } // if ( (m_pImage != NULL) ) ++ else ++ { ++ // Throw error, if no data available. ++ // ML_PRINT_ERROR("MatlabScriptWrapper::calcOutSubImage()", ML_BAD_INPUT_IMAGE_POINTER, "Cannot copy from Matlab data."); ++ } ++ } // for outindex ++} ++ + //! Copy input XMarkerList to Matlab. + void MatlabScriptWrapper::_copyInputXMarkerToMatlab() + { +@@ -1237,9 +1315,11 @@ + if(temp!=NULL) { + if(mxGetClassID(temp)==mxDOUBLE_CLASS) { + double *fieldVal = static_cast<double*>(mxGetPr(temp)); ++ _scalarFld[i]->enableNotificationsGlobally(false); + _scalarFld[i]->setDoubleValue(fieldVal[0]); ++ _scalarFld[i]->enableNotificationsGlobally(true); + } else { +- std::cerr << "_getVectorsBackFromMatlab(): Output type from Matlab not supported" << std::endl << std::flush; ++ std::cerr << "_getScalarsBackFromMatlab(): Output type from Matlab not supported" << std::endl << std::flush; + } + } + } +@@ -1288,10 +1368,12 @@ + temp = engGetVariable(m_pEngine, (_stringNameFld[i]->getStringValue()).c_str()); + if(temp!=NULL) + { +- tempsize = mxGetN(temp)+1; ++ tempsize = (int)mxGetN(temp)+1; + ML_CHECK_NEW(fieldVal,char[tempsize]); + mxGetString(temp,fieldVal,tempsize); ++ _stringFld[i]->enableNotificationsGlobally(false); + _stringFld[i]->setStringValue(fieldVal); ++ _stringFld[i]->enableNotificationsGlobally(true); + ML_DELETE(fieldVal); + } + } +@@ -1344,7 +1426,9 @@ + if(mxGetClassID(temp)==mxDOUBLE_CLASS) { + double *fieldVal = static_cast<double*>(mxGetPr(temp)); + if(mxGetM(temp)==1 && mxGetN(temp)==4) { ++ _vectorFld[i]->enableNotificationsGlobally(false); + _vectorFld[i]->setVec4fValue(vec4(fieldVal[0],fieldVal[1],fieldVal[2],fieldVal[3])); ++ _vectorFld[i]->enableNotificationsGlobally(true); + } else { + std::cerr << "_getVectorsBackFromMatlab(): Incorrect vector size" << std::endl << std::flush; + } +@@ -1405,10 +1489,12 @@ + if(mxGetClassID(temp)==mxDOUBLE_CLASS) { + double *fieldVal = static_cast<double*>(mxGetPr(temp)); + if(mxGetM(temp)==4 && mxGetN(temp)==4) { ++ _matrixFld[i]->enableNotificationsGlobally(false); + _matrixFld[i]->setMatrixValue(mat4(fieldVal[0],fieldVal[4], fieldVal[8],fieldVal[12], + fieldVal[1],fieldVal[5], fieldVal[9],fieldVal[13], + fieldVal[2],fieldVal[6],fieldVal[10],fieldVal[14], + fieldVal[3],fieldVal[7],fieldVal[11],fieldVal[15])); ++ _matrixFld[i]->enableNotificationsGlobally(true); + } else { + std::cerr << "_getMatricesBackFromMatlab(): Incorrect matrix size" << std::endl << std::flush; + } + +Property changes on: MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp +___________________________________________________________________ +Added: svn:keywords + + Revision Author Date Id + +Index: MLMatlabScriptWrapper/mlMatlabScriptWrapperOutputData.h +=================================================================== +--- MLMatlabScriptWrapper/mlMatlabScriptWrapperOutputData.h (revision 0) ++++ MLMatlabScriptWrapper/mlMatlabScriptWrapperOutputData.h (revision 0) +@@ -0,0 +1,89 @@ ++//---------------------------------------------------------------------------------- ++//! The ML module class MatlabScriptWrapper. ++/*! ++// \file mlMatlabScriptWrapperOutputData.h ++// \author Jens Kaftan ++// \date 2010-09-15 ++// ++// Class for storing output data created in Matlab ++*/ ++//---------------------------------------------------------------------------------- ++ ++ ++#ifndef __mlMatlabScriptWrapperOutputData_H ++#define __mlMatlabScriptWrapperOutputData_H ++ ++// SDK includes ++#include <mlBasics.h> ++ ++ML_START_NAMESPACE ++ ++//! The output memory management class used in MatlabScriptWrapper ++class MatlabScriptWrapperOutputData ++{ ++public: ++ //! Constructor. ++ MatlabScriptWrapperOutputData (void) ++ { ++ _data = NULL; ++ _dataClass = ML_BAD_DATA_TYPE; ++ _ext = ImageVector(); ++ _minval = 0; ++ _maxval = 0; ++ }; ++ //! Destructor. ++ ~MatlabScriptWrapperOutputData () ++ { ++ if(_data) ++ { ++ delete []_data; ++ _data = NULL; ++ } ++ }; ++ ++ //! Copy new data to class (and deallocate old data if existent) ++ void SetData(const ImageVector& extend, const MLPhysicalDataType datatype, const double* data) ++ { ++ if(_data != NULL) ++ { ++ delete []_data; ++ _data = NULL; ++ } ++ _ext = extend; ++ _dataClass = datatype; ++ ++ SubImageBox temp = SubImageBox(extend); ++ try{ ++ _data = new double[temp.getNumVoxels()]; ++ memcpy(_data, data, sizeof(double)*temp.getNumVoxels() ); ++ } ++ catch(std::bad_alloc) ++ { ++ std::cerr << "MatlabScriptWrapperOutputData::SetData - " << "error during memory allocation" << std::endl; ++ } ++ }; ++ ++ void SetMinMaxValue(const MLldouble min, const MLldouble max) ++ { ++ _minval = min; ++ _maxval = max; ++ }; ++ ++ inline double* GetData() { return(_data); }; ++ inline MLPhysicalDataType GetDataType() { return(_dataClass); }; ++ inline ImageVector GetExtend() { return(_ext); }; ++ inline MLldouble GetMinValue() { return(_minval); }; ++ inline MLldouble GetMaxValue() { return(_maxval); }; ++ ++private: ++ double* _data; ++ MLPhysicalDataType _dataClass; ++ ImageVector _ext; ++ MLldouble _minval; ++ MLldouble _maxval; ++}; ++ ++ML_END_NAMESPACE ++ ++ ++#endif // __mlMatlabScriptWrapperOutputData_H +\ No newline at end of file + +Property changes on: MLMatlabScriptWrapper/mlMatlabScriptWrapperOutputData.h +___________________________________________________________________ +Added: svn:executable + + * +Added: svn:eol-style + + native + +Index: MLMatlabScriptWrapper/mlMatlabScriptWrapper.h +=================================================================== +--- MLMatlabScriptWrapper/mlMatlabScriptWrapper.h (revision 327) ++++ MLMatlabScriptWrapper/mlMatlabScriptWrapper.h (working copy) +@@ -26,9 +26,11 @@ + //! The ML module class MatlabScriptWrapper. + /*! + // \file mlMatlabScriptWrapper.h +-// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter ++// \author Alexander Gryanik, Markus Harz, Ola Friman, Felix Ritter, Jens Kaftan + // \date 2009-02-23 + // ++// $Id$ ++// + // Module for executing Matlab scripts in MeVisLab. + */ + //---------------------------------------------------------------------------------- +@@ -40,6 +42,7 @@ + + // Local includes + #include "MLMatlabScriptWrapperSystem.h" ++#include "mlMatlabScriptWrapperOutputData.h" + + // SDK includes + #include <mlXMarkerList.h> +@@ -125,6 +128,8 @@ + + //! Copies input image data into Matlab. + void _copyInputImageDataToMatlab(); ++ //! Copies output image from Matlab. ++ void _getOutputImageDataBackFromMatlab(); + //! Copies input XMarkerList into Matlab. + void _copyInputXMarkerToMatlab(); + //! Copies XMarkerList from Matlab and copies results into output XMarkerList. +@@ -172,6 +177,8 @@ + StringField* _matlabScriptFld; + //! Use external script. + BoolField* _useExternalScriptFld; ++ //! Change matlab path to script path ++ BoolField* _changePathToScriptLocationFld; + + //! Name of file where matlab script will be dumped. + StringField *_matlabScriptPathFld; +@@ -180,9 +187,11 @@ + BoolField* _showSessionWindowFld; + + //{@ Set matlab names for input and output images. +- StringField *_inDataNameFld[3]; +- StringField *_outDataNameFld[3]; ++ StringField *_inDataNameFld[4]; ++ StringField *_outDataNameFld[4]; + //@} ++ MatlabScriptWrapperOutputData *_outDataArray[4]; ++ + //{@ Set matlab names for input and output XMarkerList. + StringField *_inXMarkerNameFld; + StringField *_outXMarkerNameFld; +@@ -194,6 +203,8 @@ + + //! If pressed, the module updates. + NotifyField* _calculateFld; ++ //! Pressed if update has been performed. (Read-only) ++ NotifyField* _processingFinishedFld; + //! If true, the module updates on input changes. + BoolField* _autoCalculationFld; + //! If true, the module updates on parameter/field changes. + +Property changes on: MLMatlabScriptWrapper/mlMatlabScriptWrapper.h +___________________________________________________________________ +Added: svn:keywords + + Revision Author Date Id + +Index: MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro +=================================================================== +--- MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro (revision 327) ++++ MLMatlabScriptWrapper/MLMatlabScriptWrapper.pro (working copy) +@@ -122,7 +122,8 @@ + HEADERS += \ + MLMatlabScriptWrapperInit.h \ + MLMatlabScriptWrapperSystem.h \ +- mlMatlabScriptWrapper.h ++ mlMatlabScriptWrapper.h \ ++ mlMatlabScriptWrapperOutputData.h + + SOURCES += \ + MLMatlabScriptWrapperInit.cpp \ Property changes on: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper-Jens-r327.patch ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-12-09 09:45:14
|
Revision: 335 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=335&view=rev Author: rhameeteman Date: 2010-12-09 09:45:08 +0000 (Thu, 09 Dec 2010) Log Message: ----------- KH. * Fixed bug that could cause a crash when input was a CurveList. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp Modified: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2010-12-09 09:14:07 UTC (rev 334) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2010-12-09 09:45:08 UTC (rev 335) @@ -116,23 +116,18 @@ if ( field == f_InCurveList ) { m_SingleCurveList.clear(); - if ( f_InCurveList->getBaseValue() ) { - Base* inList = f_InCurveList->getBaseValue(); - m_InCurveList = NULL; - if ( BASE_IS_A(inList, CurveData) ) { - // Input is a single curve - m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( inList ) ); - m_InCurveList = &m_SingleCurveList; - } - else if ( BASE_IS_A( inList, CurveList) ) { - // Input is not a CurveData object or a CurveList - m_InCurveList = static_cast<CurveList*>( f_InCurveList->getBaseValue() ); - } + m_InCurveList = NULL; + Base* baseInput = f_InCurveList->getBaseValue(); + m_InCurveList = mlbase_cast<CurveList*>(baseInput); + CurveData* inCurve = mlbase_cast<CurveData*>( baseInput ); + if (inCurve){ + m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( baseInput ) ); + m_InCurveList = &m_SingleCurveList; } - SetMaxValues(); if ( m_InCurveList != NULL ) { if ( f_AutoUpdate->getBoolValue() ){ + SetMaxValues(); SetOutputCurve(); f_OutCurveList->notifyAttachments(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-12-09 09:14:13
|
Revision: 334 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=334&view=rev Author: rhameeteman Date: 2010-12-09 09:14:07 +0000 (Thu, 09 Dec 2010) Log Message: ----------- KH. * Renamed CurveFilter to CMCurveFilter to solve naming conflict with the now default ML module CurveFilter Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def Modified: trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2010-12-06 14:22:41 UTC (rev 333) +++ trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2010-12-09 09:14:07 UTC (rev 334) @@ -11,8 +11,9 @@ //---------------------------------------------------------------------------------- // MLModule CurveFilter //---------------------------------------------------------------------------------- -MLModule CurveFilter { +MLModule CMCurveFilter { DLL = "MLCMCurveList" + class = "CurveFilter" group = "BIGR" genre = "Diagram" author = "Reinhard Hameeteman" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-12-06 14:22:48
|
Revision: 333 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=333&view=rev Author: rhameeteman Date: 2010-12-06 14:22:41 +0000 (Mon, 06 Dec 2010) Log Message: ----------- KH. * Added a macro that can be used to compare the field values of two modules in the current network or the fields of a module and its default settings. Added Paths: ----------- trunk/Community/General/Modules/Macros/Fields/CompareModules.def trunk/Community/General/Modules/Macros/Fields/CompareModules.py trunk/Community/General/Modules/Macros/Fields/CompareModules.script trunk/Community/General/Modules/Macros/Fields/html/CompareModules.html Added: trunk/Community/General/Modules/Macros/Fields/CompareModules.def =================================================================== --- trunk/Community/General/Modules/Macros/Fields/CompareModules.def (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/CompareModules.def 2010-12-06 14:22:41 UTC (rev 333) @@ -0,0 +1,21 @@ +//---------------------------------------------------------------------------------- +//! CompareModules module definition +/*! +// \file CompareModules.def +// \author Reinhard Hameeteman +// \date 2010-12-06 +*/ +//---------------------------------------------------------------------------------- + +MacroModule CompareModules { + genre = "Fields" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Compare the field values of two modules" + keywords = "compara parameters interface fields values" + seeAlso = "" + externalDefinition = "$(LOCAL)/CompareModules.script" + documentation = "$(LOCAL)/html/CompareModules.html" + scriptOnly = yes +} // MacroModule CompareModules + Added: trunk/Community/General/Modules/Macros/Fields/CompareModules.py =================================================================== --- trunk/Community/General/Modules/Macros/Fields/CompareModules.py (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/CompareModules.py 2010-12-06 14:22:41 UTC (rev 333) @@ -0,0 +1,120 @@ +#---------------------------------------------------------------------------------- +# +# Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +# Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of BIGR nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +#---------------------------------------------------------------------------------- +#! Macro module CompareModules +#! +# \file CompareModules.script +# \author Reinhard Hameeteman +# \date 2010-12-06 +# +# Compare the field values of two modules +# +#---------------------------------------------------------------------------------- + +from mevis import * + +def UpdateModuleList(): + network = ctx.parent() + moduleList = list( network.modules() ) + ctx.field('moduleList').value = '' + listString = '' + for iModule in moduleList : + listString += iModule + '@' + listString += "Defaults" + ctx.field('moduleList').value = listString + return + +def TestField(field): + result = True + if field : + if field.type == 'Trigger' or field.name == "instanceName" : + result = False + else: + result = False + return result + + +def UpdateSelections(): + UpdateModuleList() + ctx.control("moduleList0").setCurrentText( ctx.field("module0").value ) + ctx.control("moduleList1").setCurrentText( ctx.field("module1").value ) + Compare() + return + +def Compare(): + selection0 = ctx.field("module0").value + selection1 = ctx.field("module1").value + selection0Default = (selection0 == "Defaults" ) + selection1Default = (selection1 == "Defaults" ) + if (selection0Default and selection1Default) : return + module0 = None + module1 = None + if not selection0Default : module0 = ctx.parent().module( selection0 ) + if not selection1Default : module1 = ctx.parent().module( selection1 ) + if selection0Default and module1: + module1Type = module1.type() + if module1Type != "CompareModules" : + module0 = ctx.addModule( module1Type ) + if selection1Default and module0: + module0Type = module0.type() + if module0Type != "CompareModules" : + module1 = ctx.addModule( module0Type ) + + parsString0 = "Parameter&Value@" + parsString1 = "Parameter&Value@" + if module0 and module1 : + pars0 = module0.parameters() + for par in pars0 : + field0 = module0.field(par) + field1 = None + if module1.hasField( par ) : + field1 = module1.field(par) + if TestField(field0) and TestField(field1): + value0 = field0.stringValue() + value1 = field1.stringValue() + pre = "" + post = "" + if value0 != value1 : + pre = "<font color=#ff0000><b>" + post = "</b></font>" + parsString0 += par + "&" + pre + value0 + post + "@" + parsString1 += par + "&" + pre + value1 + post + "@" + parsString0 = parsString0.strip("@") + parsString1 = parsString1.strip("@") + ctx.field("fields0").value = parsString0 + ctx.field("fields1").value = parsString1 + if selection0Default and module0: module0.remove() + if selection1Default and module1: module1.remove() + return + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +#//# owner: EMC +#//# date: 2010-03-02T15:48:44 +#//# hash: coVMpF1OpLnh/Aq1AXmPuWl4n/kpEa2aLF1QJq5AOncdkqez6UhJXMrSPyy97eIAOYYnAAagI3NevWdPsmaM6w== +#//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/CompareModules.script =================================================================== --- trunk/Community/General/Modules/Macros/Fields/CompareModules.script (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/CompareModules.script 2010-12-06 14:22:41 UTC (rev 333) @@ -0,0 +1,99 @@ +//---------------------------------------------------------------------------------- +//! Macro module CompareModules +/*! +// \file CompareModules.script +// \author Reinhard Hameeteman +// \date 2010-12-06 +// +// Compare the field values of two modules +*/ +//---------------------------------------------------------------------------------- + + +Interface { + Inputs {} + Outputs {} + Parameters { + Field moduleList { type = String value = "" } + Field module0 { type = string value = "" } + Field module1 { type = string value = "" } + Field fields0 { type = string value = "" } + Field fields1 { type = string value = "" } + } +} + + +Commands { + source = $(LOCAL)/CompareModules.py +} + +Window { + Vertical { + expandY = Yes + Box Update { + layout = Horizontal + expandX = Yes + Button { + title = Compare + command = Compare + alignX = Left + } + Button { + title = "Update module list" + command = UpdateSelections + alignX = Left + } + } // Update + + Box Fields { + layout = Horizontal + expandY = Yes + Splitter { + expandY = Yes + Vertical { + expandY = Yes + ComboBox module0 { + expandX = yes + name = moduleList0 + editable = no + comboField = moduleList + comboSeparator = "@" + activatedCommand = Compare + } + ListView fields0 { + rowSeparator = "@" + columnSeparator = "&" + selectionMode = NoSelection + richText = Yes + } + } + Vertical { + expandY = Yes + ComboBox module1 { + expandX = yes + name = moduleList1 + editable = no + comboField = moduleList + comboSeparator = "@" + activatedCommand = Compare + } + ListView fields1 { + rowSeparator = "@" + columnSeparator = "&" + richText = Yes + selectionMode = NoSelection + } + } + } // Splitter + } // Fields + } + Execute = UpdateSelections +} + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-06-22T21:02:14 +//# hash: Y6g/HIpreauLUmNWg5upWR7/x/1Q8vafFEkI+JvruUzIUWoqQlg/uLr7Aufp9/yWvbF3USzuRbxCj+jjyrUQ+g== +//# MeVis end + Added: trunk/Community/General/Modules/Macros/Fields/html/CompareModules.html =================================================================== --- trunk/Community/General/Modules/Macros/Fields/html/CompareModules.html (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/html/CompareModules.html 2010-12-06 14:22:41 UTC (rev 333) @@ -0,0 +1,46 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> + +<hr WIDTH="100%"></center> +<h2></h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>Compare modules can be used to compare the field values of two modules in the network or to compare the field values of a module with the default values. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Select the two modules to see their parameters and their differences. To compare a module with it's default field values, select the "Default" module for the other module. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Pressing "Compare" will update the comparison with the current field values.<br/> +Pressing "Update module list" will update the list of selectable modules with those in the current network.<br/> +The module only shows fields which the two selected modules have in common. It does not show any trigger fields nor instanceName fields. + +</blockquote> + + + + + + + + + + + + + + + +</body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2010-11-12 13:36:36
|
Revision: 332 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=332&view=rev Author: broersen Date: 2010-11-12 13:36:29 +0000 (Fri, 12 Nov 2010) Log Message: ----------- - Added support for importing CurveData and CurveLists and exporting CurveLists 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-11-12 13:29:37 UTC (rev 331) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-11-12 13:36:29 UTC (rev 332) @@ -75,11 +75,14 @@ (_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); + (_inputCurveFld = fields->addBase("inputCurve"))->setBaseValue(NULL); + (_outputCurveListFld = fields->addBase("outputCurveList"))->setBaseValue(&_outputCurveList); + //! Use Matlab commands in text field. (_matlabScriptFld = fields->addString("matlabScript"))->setStringValue("Output0=Input0 % Type your matlab script here."); @@ -89,27 +92,31 @@ //! Where will Matlab script be dumped. (_matlabScriptPathFld = fields->addString("matlabScriptPath"))->setStringValue(""); - //! Set input and output data names used in matlab. + //! Set input and output data names used in Matlab. (_inDataNameFld[0] = fields->addString("inDataName0"))->setStringValue("Input0"); (_inDataNameFld[1] = fields->addString("inDataName1"))->setStringValue("Input1"); (_inDataNameFld[2] = fields->addString("inDataName2"))->setStringValue("Input2"); (_outDataNameFld[0] = fields->addString("outDataName0"))->setStringValue("Output0"); (_outDataNameFld[1] = fields->addString("outDataName1"))->setStringValue("Output1"); (_outDataNameFld[2] = fields->addString("outDataName2"))->setStringValue("Output2"); - //! Set input and output XMarker names used in matlab. + //! 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. + //! Set input and output WEM names used in Matlab. (_inWEMNameFld = fields->addString("inWEMName"))->setStringValue("inWEM"); (_outWEMNameFld = fields->addString("outWEMName"))->setStringValue("outWEM"); + //! Set input and output Curve names used in Matlab. + (_inCurveNameFld = fields->addString("inCurveName"))->setStringValue("inCurve"); + (_outCurveNameFld = fields->addString("outCurveName"))->setStringValue("outCurve"); - //! 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. _calculateFld = fields->addNotify("update"); + //! Create image data randomly. + (_autoCalculationFld = fields->addBool("autoUpdate"))->setBoolValue(false); + //! Use automatic apply after change of a parameter/field. + (_autoApplyFld = fields->addBool("autoApply"))->setBoolValue(false); //! Add restart Matlab button. _restartMatlabFld = fields->addNotify("restartMatlab"); // Error message. @@ -185,7 +192,7 @@ } } } - + if (m_startCmd.empty()) { // Try to locate Matlab binary via its bundle id std::string matlabBundle = macx::Bundle::getBundleDirectory("com.mathworks.StartMATLAB"); @@ -197,7 +204,7 @@ } } } - + if (! m_startCmd.empty()) { std::cout << "Found matlab binary at: " << m_startCmd.c_str() << std::endl; } @@ -205,8 +212,7 @@ m_pEngine = engOpen( (m_startCmd.empty()) ? NULL : m_startCmd.c_str() ); - if ( !_checkMatlabIsStarted() ) - { + 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 << "Additional Hints: " << std::endl; @@ -241,7 +247,7 @@ if (m_pEngine != NULL) { engClose(m_pEngine); } - + ML_DELETE(_outWEM); } @@ -280,7 +286,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 == _inputXMarkerListFld)) || (field== _inputWEMFld) ) || + (field == _inputXMarkerListFld) || (field== _inputWEMFld) || (field== _inputCurveFld)) ) || (_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])|| @@ -307,6 +313,13 @@ // Execute Matlab script only when the string is valid if(validScriptString) { + if (_inputCurveFld->getBaseValue() != NULL) { + // Check if a valid CurveData or CurveList is attached to the input + if (_inputCurveFld->isValidValue() && (ML_BASE_IS_A(_inputCurveFld,CurveData)||ML_BASE_IS_A(_inputCurveFld,CurveList)) ) { + // Copy input CurveData or CurveList to Matlab. + _copyInputWEMToMatlab(); + } + } if( _inputXMarkerListFld->getBaseValue() != NULL ) { // Check if a valid XMarkerList is attached to the input. if( _inputXMarkerListFld->isValidValue() && ML_BASE_IS_A(_inputXMarkerListFld->getBaseValue(), XMarkerList) ) { @@ -373,12 +386,14 @@ _clearAllVariables(); } + // Get CurveList from Matlab and copy results into output CurveList + _getCurveDataBackFromMatlab(); + // 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. @@ -437,7 +452,9 @@ // Notify the XMarkerList output _outputXMarkerListFld->notifyAttachments(); - + // Notify the CurveList output + _outputCurveListFld->notifyAttachments(); + // Notify the WEM output std::vector<WEMEventContainer>ecList; WEMEventContainer ec; @@ -450,6 +467,7 @@ } } + //---------------------------------------------------------------------------------- //! Configures (in)validation handling of inputs which are not connected or up to date. //---------------------------------------------------------------------------------- @@ -467,14 +485,12 @@ } } - #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. //---------------------------------------------------------------------------------- @@ -506,8 +522,7 @@ return; } Vector outExt = Vector(1,1,1,1,1,1); - for (size_t i=0; i<m_numDims; i++) - { + for (size_t i=0; i<m_numDims; i++) { outExt[i] = static_cast<MLint>(mxGetDimensions(m_pImage)[i]); } @@ -551,8 +566,7 @@ mxDestroyArray(minVal); minVal = NULL; mxDestroyArray(maxVal); maxVal = NULL; engEvalString(m_pEngine, "clear mevtmpminval mevtmpmaxval"); - } - else { + } else { getOutImg(outIndex)->setOutOfDate(); getOutImg(outIndex)->setStateInfo("Cannot set output size, because variable could not be found in Matlab workspace.",ML_BAD_DATA_TYPE); std::ostringstream msg; @@ -627,9 +641,7 @@ SubImg subImgBuf(outSubImg->getBox(), outputClass, mxGetPr(m_pImage)); outSubImg->copySubImage(subImgBuf); mxDestroyArray(m_pImage); m_pImage = NULL; - } - else - { + } else { // Throw error if the variable could not be found in the Matlab workspace. // NOTE: This is also checked in calcOutSubImgProps() above, so execution should never enter here. std::ostringstream msg; @@ -654,8 +666,7 @@ // Update script window if new script chosen. std::string pathString = _matlabScriptPathFld->getStringValue(); - ML_TRY - { + ML_TRY { if(pathString.empty()) { _statusFld->setStringValue("Script path is empty."); return false; @@ -673,8 +684,7 @@ // Read script line by line from file. std::string line; - while(!dat.eof()) - { + while(!dat.eof()) { getline(dat, line); tmpString << line << "\n"; } @@ -704,9 +714,7 @@ { engEvalString(m_pEngine, "clear mevTestIfMatlabIsRunning"); return true; - } - else - { + } else { return false; } } @@ -771,8 +779,7 @@ return; } - for(int i=0; i<3; i++) - { + for(int i=0; i<3; i++) { // Get a valid input if possible. Dummy input is considered invalid. PagedImg *inImg = getUpdatedInImg(i); @@ -838,15 +845,13 @@ std::ostringstream msg; msg << "Could not allocate matrix for input image " << i << " in Matlab."; ML_PRINT_ERROR("MatlabScriptWrapper::copyInputImageDataToMatlab()", msg.str().c_str(), "Matrix will not be created in Matlab."); - } - else { - + } else { // Copy data to Matlab array. memcpy((void*)mxGetPr(m_pImage), data, inDataSize*elementSize); // Get input names from GUI. const std::string inputName = _inDataNameFld[i]->getStringValue(); - + // Write data to Matlab. int status = engPutVariable(m_pEngine, inputName.c_str(), m_pImage); if(status != 0) { @@ -864,6 +869,122 @@ } } +//! Copy input CurveData or CurveList to Matlab. +void MatlabScriptWrapper::_copyInputCurveToMatlab() +{ + + if (!_checkMatlabIsStarted()) + { + std::cerr << "_copyInputCurveToMatlab(): Cannot find Matlab engine!" << std::endl << std::flush; + return; + } + + CurveData* inputCurveData = NULL; + CurveList* inputCurveList = NULL; + std::size_t numCurves = -1; + + // Get input data. + if( ML_BASE_IS_A(_inputCurveFld->getBaseValue(), CurveList) ) { + inputCurveList = mlbase_cast<CurveList*>(_inputCurveFld->getBaseValue()); + numCurves = inputCurveList->getNumCurves(); + if(numCurves) { + inputCurveData = inputCurveList->getCurveData(0); + } + } else { + inputCurveData = mlbase_cast<CurveData*>(_inputCurveFld->getBaseValue()); + numCurves = 1; + } + + mxArray *cellArray = mxCreateCellMatrix(1,numCurves); + mxArray *matArray; + for(size_t i=0; i<numCurves; i++) { + const std::size_t numPoints = inputCurveData->getPoints(); + const std::size_t numSeries = inputCurveData->getNumSeries(); + const mwSize dims[2] = {numPoints,numSeries+1}; + + // Create matrix with series and points for each curve-data in a cell + matArray = mxCreateNumericArray(2, dims, mxDOUBLE_CLASS, mxREAL); + // If both arrays are created + if(cellArray && matArray){ + double *arrayPtr = (double *)mxGetData(matArray); + for(std::size_t k=0; k<numPoints; ++k) { + // The X - values + arrayPtr[k] = inputCurveData->getXValue(k); + } + for(std::size_t j=0; j<numSeries; ++j) { + for(std::size_t k=0; k<numPoints; ++k) { + // The Y - values for each series + arrayPtr[k+numPoints*(j+1)] = inputCurveData->getYValue(j,k); + } + } + // Put array in a cell + mxSetCell(cellArray, i, mxDuplicateArray(matArray)); + if(inputCurveList) { + inputCurveData = inputCurveList->getCurveData(i+1); + } + } + mxDestroyArray(matArray); matArray = NULL; + } + + // Write CurveData or CurveList into Matlab cell array with input name from GUI. + engPutVariable(m_pEngine, _inCurveNameFld->getStringValue().c_str(), cellArray); + + mxDestroyArray(cellArray); cellArray = NULL; +} + +//! Gets structure from Matlab and copies results into output CurveData. +void MatlabScriptWrapper::_getCurveDataBackFromMatlab() +{ + if (!_checkMatlabIsStarted()) + { + std::cerr << "_getCurveDataBackFromMatlab(): Cannot find Matlab engine!" << std::endl << std::flush; + return; + } + + // Clear _outputCurveData and preserve curve properties. + _outputCurveList.clear(); + + // Get name from GUI. + std::string outCurveStr = _outCurveNameFld->getStringValue(); + // Internal temp variable with the number of Curves in Matlab. + mxArray *m_curveList = engGetVariable(m_pEngine, outCurveStr.c_str()); + + if((m_curveList!=NULL && mxGetClassID(m_curveList)==mxCELL_CLASS)) { + CurveData* curve = NULL; + const size_t curves = mxGetN(m_curveList); // Number of matrices in Matlab cell + for(size_t i=0; i<=curves; i++) { + ML_CHECK_NEW(curve,CurveData); + + mxArray *m_curve = mxGetCell(m_curveList,i); + if((m_curve && !mxIsEmpty(m_curve) && mxGetClassID(m_curve)==mxDOUBLE_CLASS)) { + const size_t points = mxGetM(m_curve); // Number of rows in Matlab matrix + const size_t series = mxGetN(m_curve); // Number of columns in Matlab matrix + curve->resizeX(points); // Initialize the X - values with zeros + // Initialize the remaining columns with zeros as series of Y - values + for(size_t serie=0; serie<series-1; serie++) { + curve->resizeY(serie,points); + } + double *dataPoints = static_cast<double*>(mxGetPr(m_curve)); + // For each point. + for(size_t point=0; point<points; point++) { + // Set the X - values + curve->setXValue(dataPoints[point], point); + } + // For each serie + for(size_t serie=0; serie<series-1; serie++) { + for(size_t point=0; point<points; point++) { + // Set the Y - values + curve->setYValue(dataPoints[point+points*(serie+1)], serie, point); + } + } + } + // Append CurveData to CurvList. + _outputCurveList.getCurveList().push_back(curve); + } + } + mxDestroyArray(m_curveList); m_curveList = NULL; +} + //! Copy input XMarkerList to Matlab. void MatlabScriptWrapper::_copyInputXMarkerToMatlab() { @@ -907,18 +1028,17 @@ std::ostringstream all; all << setPos.str() << "\n" << setVec.str() << "\n" << setType.str() << "\n"; - + mxArray *m_X = mxCreateString(all.str().c_str()); if (m_X) { - if (engPutVariable(m_pEngine, "copyInputXMarkerToMatlab", m_X) == 0) { + if(engPutVariable(m_pEngine, "copyInputXMarkerToMatlab", m_X) == 0) { engEvalString(m_pEngine, "eval(copyInputXMarkerToMatlab); clear copyInputXMarkerToMatlab;"); } } mxDestroyArray(m_X); m_X = NULL; - } -//! Gets XMarkerList from Matlab and copies results into output XMarkerList. +//! Gets structure from Matlab and copies results into output XMarkerList. void MatlabScriptWrapper::_getXMarkerBackFromMatlab() { // Clear _outputXMarkerList. @@ -965,9 +1085,8 @@ double *dataVec = static_cast<double*>(mxGetPr(m_vec)); double *dataType = static_cast<double*>(mxGetPr(m_type)); - // Copy matlab data to xmarker if it's not empty. - if(dataPos!=NULL) - { + // Copy Matlab data to XMarker if it's not empty. + if(dataPos!=NULL) { // Get rows numbers. const size_t rows = mxGetM(m_pos); const size_t cols = mxGetN(m_pos); @@ -1179,18 +1298,17 @@ 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]); } - - if (m_faces && !mxIsEmpty(m_faces) && mxGetClassID(m_faces) == mxDOUBLE_CLASS) - { + + if (m_faces && !mxIsEmpty(m_faces) && mxGetClassID(m_faces) == mxDOUBLE_CLASS) { double *dataFaces = static_cast<double*>(mxGetPr(m_faces)); - + if (dataFaces != NULL) { const size_t face_rows = mxGetM(m_faces); @@ -1199,13 +1317,13 @@ 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); } } @@ -1215,7 +1333,7 @@ } } -//! Copies scalar values to matlab. +//! Copies scalar values to Matlab. void MatlabScriptWrapper::_copyInputScalarsToMatlab() { // Check if Matlab is started. @@ -1305,8 +1423,7 @@ for(MLint i=0; i<6; i++) { temp = engGetVariable(m_pEngine, (_stringNameFld[i]->getStringValue()).c_str()); - if(temp!=NULL) - { + if(temp!=NULL) { tempsize = mxGetN(temp)+1; ML_CHECK_NEW(fieldVal,char[tempsize]); mxGetString(temp,fieldVal,tempsize); @@ -1392,7 +1509,7 @@ for(i=0; i<3; i++) { execute<<_matrixNameFld[i]->getStringValue()<<"=["; - + mat4 mat = _matrixFld[i]->getMatrixValue(); execute<<mat[0][0]<<","<<mat[0][1]<<","<<mat[0][2]<<","<<mat[0][3]<<";"; execute<<mat[1][0]<<","<<mat[1][1]<<","<<mat[1][2]<<","<<mat[1][3]<<";"; Modified: trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h =================================================================== --- trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-11-12 13:29:37 UTC (rev 331) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.h 2010-11-12 13:36:29 UTC (rev 332) @@ -26,7 +26,7 @@ //! The ML module class MatlabScriptWrapper. /*! // \file mlMatlabScriptWrapper.h -// \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. @@ -42,8 +42,10 @@ #include "MLMatlabScriptWrapperSystem.h" // SDK includes +#include <mlVersion.h> +#include "mlCurveData.h" +#include "mlCurveList.h" #include <mlXMarkerList.h> -#include <mlVersion.h> #include <WEMBase/WEM.h> // System includes @@ -123,16 +125,20 @@ //! Clear all variables that have been put in the Matlab workspace. void _clearAllVariables(); - //! Copies input image data into Matlab. + //! Copies input image data to Matlab. void _copyInputImageDataToMatlab(); - //! Copies input XMarkerList into Matlab. + //! Copies input CurveData or CurveList to Matlab. + void _copyInputCurveToMatlab(); + //! Copies structure from Matlab and copies results into output CurveList. + void _getCurveDataBackFromMatlab(); + //! Copies input XMarkerList to Matlab. void _copyInputXMarkerToMatlab(); //! Copies XMarkerList from Matlab and copies results into output XMarkerList. void _getXMarkerBackFromMatlab(); - //! Copies WEM to matlab. + //! Copies input WEM to Matlab. void _copyInputWEMToMatlab(); - //! Copies WEM from matlab. - void _getWEMBackFromMatlab(); + //! Copies WEM from Matlab. + void _getWEMBackFromMatlab(); //! Copies scalar values to matlab. void _copyInputScalarsToMatlab(); //! Copies scalar values from matlab. @@ -154,6 +160,12 @@ //@{ \name Module field declarations // ---------------------------------------------------------- + //! The Curve input field. + BaseField *_inputCurveFld; + //! The CurveList output field. + BaseField *_outputCurveListFld; + //! The output list + CurveList _outputCurveList; //! The XMarkerList input field. BaseField *_inputXMarkerListFld; //! The XMarkerList output field. @@ -168,7 +180,7 @@ //! The output WEM. WEM *_outWEM; - //! Type a matlab script into this field. + //! Type a Matlab script into this field. StringField* _matlabScriptFld; //! Use external script. BoolField* _useExternalScriptFld; @@ -183,6 +195,10 @@ StringField *_inDataNameFld[3]; StringField *_outDataNameFld[3]; //@} + //{@ Set matlab names for input and output CurveList. + StringField *_inCurveNameFld; + StringField *_outCurveNameFld; + //@} //{@ Set matlab names for input and output XMarkerList. StringField *_inXMarkerNameFld; StringField *_outXMarkerNameFld; @@ -194,10 +210,11 @@ //! 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; + //! If true, the module updates on input changes. + BoolField* _autoCalculationFld; + //! Status messages. StringField* _statusFld; //! Restart Matlab button. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bro...@us...> - 2010-11-12 13:29:43
|
Revision: 331 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=331&view=rev Author: broersen Date: 2010-11-12 13:29:37 +0000 (Fri, 12 Nov 2010) Log Message: ----------- - Added support for importing CurveData and CurveLists and exporting CurveLists - Updated documentation and example network to current status Modified Paths: -------------- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 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-09-28 14:57:10 UTC (rev 330) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/MLMatlabScriptWrapper.def 2010-11-12 13:29:37 UTC (rev 331) @@ -15,10 +15,10 @@ MLModule MatlabScriptWrapper { DLL = "MLMatlabScriptWrapper" genre = "Other" - author = "Alexander Gryanik, Ola Friman, Markus Harz" + author = "Alexander Gryanik, Ola Friman, Markus Harz, Alexander Broersen" status = "work-in-progress" - comment = "Execute matlab script on an image to produce an output image." - keywords = "matlab scripting wrapper" + comment = "Execute Matlab script and/or exchange different data-structures." + keywords = "Matlab scripting wrapper" seeAlso = "" documentation = "$(LOCAL)/html/MatlabScriptWrapper.html" exampleNetwork = "$(LOCAL)/networks/MatlabScriptWrapperExample.mlab" @@ -34,11 +34,11 @@ showLineNumbers = Yes } - CheckBox useExternalScript {} Horizontal { + CheckBox useExternalScript {} Field matlabScriptPath { title = "Matlab Script:" - expandX = yes + expandX = Yes browseButton = ON browseMode = open browseFilter = "MATLAB M-files (*.m)" @@ -75,6 +75,12 @@ Field outWEMName {title = "Output name:" expandX = yes} } } + Vertical { + Box "Curve names" { + Field inCurveName {title = "Input name:" expandX = yes} + Field outCurveName {title = "Output name:" expandX = yes} + } + } } } Horizontal { @@ -199,10 +205,10 @@ } } // Category Strings Category Output { + expandY = Yes TextView matlabOutput { autoApply = Yes edit = False - visibleRows = 33 wrap = off } } // Category Output Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 2010-09-28 14:57:10 UTC (rev 330) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/html/MatlabScriptWrapper.html 2010-11-12 13:29:37 UTC (rev 331) @@ -41,10 +41,18 @@ 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> + <li><span style="font-weight: bold;">CurveData (input only) and CurveLists:</span> + A CurveData is an object consisting of zero or one X- and any number of Y-data series. A CurveList + is an array of CurveData objects. + In Matlab, a CurveList is represented as a cell array with in each cell a matrix with the points of + each series of a curve. The first column in the matrix contains the X-values, the second column + contains the first serie of Y-values, the third column the second serie of Y-values etc.. + </li> <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: + In Matlab, an XMarkerList is represented as a struct with the following members (where + <span style="font-style: italic;">N</span> is the number of XMarkers): </li> <span style="font-style: italic;"><variablename></span>.pos, where pos is an <span style="font-style: italic;">N</span>x2, @@ -52,18 +60,25 @@ <span style="font-style: italic;">N</span>x4, <span style="font-style: italic;">N</span>x5 or <span style="font-style: italic;">N</span>x6 matrix with the position coordinates. - <span style="font-style: italic;">N</span> is the number of XMarkers. <br> <span style="font-style: italic;"><variablename></span>.vec, where vec is an <span style="font-style: italic;">N</span>x2 or <span style="font-style: italic;">N</span>x3 matrix of vectors. <br> <span style="font-style: italic;"><variablename></span>.type, where type is an - <span style="font-style: italic;">N</span>x1 vector of integers.<br> + <span style="font-style: italic;">N</span>x1 vector of integers. + <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> + <li><span style="font-weight: bold;">WEMs:</span> + A Winged Edge Mesh (WEM) is an object that contains a representation of a surface. In Matlab, + a WEM is represented as a cell array of structures with nodes (markers of vertices), faces, edges, + normals. Optionally, if a WEM contains a Look Up Table (LUT), this data will be put into the CData field. + These structures can be exchanged directly with the Matlab Patch Properties. See the example network for + an example. + </li> <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 @@ -127,7 +142,7 @@ <h3><a name="Inputs"></a>Inputs</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -Up to three input images and one XMarkerList can be attached to the module. +Up to three input images and one CurveData, CurveList, XMarkerList , or WEM can be attached to the module. Input to the module from MeVisLab is optional, the output can be generated entirely in Matlab without input from MeVisLab (see the example network for examples). </blockquote> @@ -136,7 +151,7 @@ <h3><a name="Outputs"></a>Outputs</h3> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -Up to three output images and one XMarkerList. +Up to three output images and one CurveList, one XMarkerList, or one WEM. </blockquote> @@ -159,8 +174,8 @@ <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> <b>Auto update</b> <br> -Execute the script automatically on input change (only for input images -and the XMarkerList, not for changes in the names).<br> +Execute the script automatically on input change (only for input images, CurveData, CurveList, +XMarkerList, and WEM, not for changes in the names).<br> </blockquote> @@ -209,7 +224,8 @@ <br> <blockquote style="margin-top: 5pt; margin-bottom: 5pt;"> -<b>Input/Output image, XMarkerList, scalar, vector, matrix names and strings</b> +<b>Input/Output image, Curve, Mat4, CSO, XMarker, WEM, scalar, vector, matrix names, and +strings</b> <br> The variable names in the Matlab script of the input and output data structures.<br> </blockquote> Modified: trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab 2010-09-28 14:57:10 UTC (rev 330) +++ trunk/Community/General/Modules/ML/MLMatlabScriptWrapper/networks/MatlabScriptWrapperExample.mlab 2010-11-12 13:29:37 UTC (rev 331) @@ -2,6 +2,70 @@ network { watchlist = "" } +module Diagram2D { + internal { + frame = "937 397 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "404 345 444 576" + sizeHint = "444 576" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 1 + autoRangeX = TRUE + minY = 0 + maxY = 1 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = TRUE + diagramTitleString = "A random spline" + borderH = 0 + autoBorderH = TRUE + borderV = 0 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 1 0" + lineStyle = Solid + markerType = Circle + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = 0 + mousePosY = 0 + mousePosValid = FALSE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = FALSE + } +} module SoWEMRenderer { internal { frame = "885 173 136 56" @@ -36,9 +100,9 @@ overwriteBoundingBoxParameters = FALSE colorMode = WEM_COLOR_LUT_VALUES drawFaces = TRUE - faceDiffuseColor = "0.760784327983856 0.756862759590149 0.752941191196442" + faceDiffuseColor = "0.7607843279838562 0.7568627595901489 0.7529411911964417" useFaceAmbientColor = TRUE - faceAmbientColor = "0.803921580314636 0.796078443527222 0.800000011920929" + faceAmbientColor = "0.8039215803146362 0.7960784435272217 0.800000011920929" useFaceSpecularColor = TRUE faceSpecularColor = "0 0 0" drawEdges = FALSE @@ -60,7 +124,7 @@ useEdgeColoringMode = FALSE nodeRenderingMode = WEM_NODE_RENDERING_NORMAL boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED - primitiveValueLists = LUT + primitiveValueLists = "" selectedPrimitiveValueList = LUT primitiveValueListValid = FALSE selectedTab = 0 @@ -122,7 +186,7 @@ drawFaces = TRUE faceDiffuseColor = "1 1 0" useFaceAmbientColor = TRUE - faceAmbientColor = "1 0.333333343267441 0" + faceAmbientColor = "1 0.3333333432674408 0" useFaceSpecularColor = TRUE faceSpecularColor = "0 0 0" drawEdges = FALSE @@ -144,7 +208,7 @@ useEdgeColoringMode = FALSE nodeRenderingMode = WEM_NODE_RENDERING_NORMAL boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED - primitiveValueLists = "" + primitiveValueLists = LUT selectedPrimitiveValueList = LUT primitiveValueListValid = TRUE selectedTab = 0 @@ -251,6 +315,8 @@ } fields { instanceName = WEMIsoSurface + isProcessing = FALSE + elapsedTime = 0 id = 0 autoApply = TRUE autoUpdate = TRUE @@ -304,7 +370,7 @@ } module Comment { internal { - frame = "905 549 96 56" + frame = "945 549 96 56" moduleGroupName = "" windows { window _default { @@ -323,7 +389,7 @@ } module View2D { internal { - frame = "713 485 80 56" + frame = "777 477 80 56" moduleGroupName = "" windows { window _default { @@ -351,7 +417,7 @@ cineMode = CINE_Z cineDirection = CINE_PINGPONG cineRepeat = CINE_ONCE - cineSpeed = 0.1 + cineSpeed = 0.1000000015 snapToCenter = FALSE zoomMode = VIEW2D_AUTO_ZOOM unzoomOnImageChange = FALSE @@ -379,12 +445,13 @@ } module LocalImage { internal { - frame = "777 629 96 56" + frame = "817 629 96 56" moduleGroupName = "" } fields { instanceName = LocalImage name = $(DemoDataPath)/Bone.tiff + trueName = "" autoLoad = TRUE status = "File open" } @@ -392,7 +459,7 @@ } module SubImage { internal { - frame = "805 549 88 56" + frame = "845 549 88 56" moduleGroupName = "" windows { window _default { @@ -432,12 +499,12 @@ } module MatlabScriptWrapper { internal { - frame = "805 477 152 56" + frame = "861 477 168 56" moduleGroupName = "" windows { window _default { - geometry = "233 303 400 650" - sizeHint = "400 650" + geometry = "233 303 600 621" + sizeHint = "600 621" wasOpen = no wasActive = no } @@ -460,7 +527,13 @@ imagesc(permute(Input0,[2 1])), axis image title(sprintf('Plot of image from MeVisLab\\nafter permute(Input0,[2 1]) command')) -colormap gray" +colormap gray + +% Create a random spline as outputCurve +n = 7 +ts = 1:1/10:n; +outCurve{1}(:,1) = spline(1:n,rand(n,1),ts); +outCurve{1}(:,2) = spline(1:n,rand(n,1),ts);" useExternalScript = FALSE matlabScriptPath = "" inDataName0 = Input0 @@ -473,6 +546,8 @@ outXMarkerName = outXMarker inWEMName = inWEM outWEMName = outWEM + inCurveName = inCurve + outCurveName = outCurve autoUpdate = FALSE autoApply = FALSE status = "Execution successful!" @@ -635,7 +710,7 @@ } module MatlabScriptWrapper { internal { - frame = "765 317 152 56" + frame = "781 317 168 56" moduleGroupName = "" windows { window _default { @@ -691,6 +766,8 @@ outXMarkerName = outXMarker inWEMName = inWEM outWEMName = outWEM + inCurveName = inCurve + outCurveName = outCurve autoUpdate = FALSE autoApply = FALSE status = "Execution successful!" @@ -811,7 +888,7 @@ maxTimePoint = 0 filterMode = FILTER_LINEAR inheritFilterMode = TRUE - alphaFactor = 0.56199998 + alphaFactor = 0.5619999766 baseColor = "1 1 0" useWorldCoords = FALSE applyLut = TRUE @@ -850,7 +927,7 @@ cineMode = CINE_Z cineDirection = CINE_PINGPONG cineRepeat = CINE_ONCE - cineSpeed = 0.1 + cineSpeed = 0.1000000015 snapToCenter = FALSE zoomMode = VIEW2D_AUTO_ZOOM unzoomOnImageChange = FALSE @@ -878,7 +955,7 @@ } module TestPattern { internal { - frame = "441 653 96 56" + frame = "449 629 96 56" moduleGroupName = "" windows { window _default { @@ -912,7 +989,7 @@ } module MatlabScriptWrapper { internal { - frame = "533 549 152 56" + frame = "549 557 168 56" moduleGroupName = "" windows { window _default { @@ -954,6 +1031,8 @@ outXMarkerName = outXMarker inWEMName = inWEM outWEMName = outWEM + inCurveName = inCurve + outCurveName = outCurve autoUpdate = FALSE autoApply = FALSE status = "Execution successful!" @@ -1092,7 +1171,7 @@ stereoOffset = 3 height = 0.7853981853 position = "1.466153740882874 -34.25235366821289 -22.5416316986084" - orientation = "-0.1885405629873276 0.862696647644043 -0.4692620933055878 3.305067300796509" + orientation = "-0.1885405629873276 0.862696647644043 -0.469262033700943 3.305067300796509" nearDistance = 31.73994255 farDistance = 50.33739471 focalDistance = 41.04526138 @@ -1131,8 +1210,8 @@ renderCulling = AUTO pickCulling = AUTO scaleSize = 3 - scaleLength = 0.1 - color = "0.333333343267441 1 0" + scaleLength = 0.1000000015 + color = "0.3333333432674408 1 0" validStylePalette = TRUE enableVector = FALSE drawingOn = TRUE @@ -1186,7 +1265,7 @@ } module MatlabScriptWrapper { internal { - frame = "553 293 144 56" + frame = "549 293 168 56" moduleGroupName = "" windows { window _default { @@ -1223,6 +1302,8 @@ outXMarkerName = OutputXMarkerList inWEMName = inWEM outWEMName = outWEM + inCurveName = inCurve + outCurveName = outCurve autoUpdate = FALSE autoApply = FALSE status = "Execution successful!" @@ -1282,6 +1363,7 @@ } } connections { + Diagram2D.inCurveList = MatlabScriptWrapper3.outputCurveList SoWEMRenderer1.inWEM = MatlabScriptWrapper2.outputWEM TorusRenderer.inWEM = WEMIsoSurface.outWEM SoExaminerViewer1.children = "TorusRenderer.self SoWEMRenderer1.self" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <of...@us...> - 2010-09-28 14:57:17
|
Revision: 330 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=330&view=rev Author: ofriman Date: 2010-09-28 14:57:10 +0000 (Tue, 28 Sep 2010) Log Message: ----------- - Added checks and output messages where data matrices are allocated and transferred between MeVisLab and Matlab. - Variables in the Matlab workspace are no longer cleared when the Matlab script does not execute correctly. This helps the debugging process within Matlab. 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-09-07 07:45:10 UTC (rev 329) +++ trunk/Community/General/Sources/ML/MLMatlabScriptWrapper/mlMatlabScriptWrapper.cpp 2010-09-28 14:57:10 UTC (rev 330) @@ -358,11 +358,11 @@ // 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!"); + _statusFld->setStringValue("Matlab execution successful!"); engEvalString(m_pEngine, "clear mevmatscr"); } else { _statusFld->setStringValue("Matlab script contains errors!"); - _clearAllVariables(); + //_clearAllVariables(); } mxDestroyArray(mtmp); mtmp = NULL; } @@ -551,9 +551,13 @@ mxDestroyArray(minVal); minVal = NULL; mxDestroyArray(maxVal); maxVal = NULL; engEvalString(m_pEngine, "clear mevtmpminval mevtmpmaxval"); - } else { + } + else { getOutImg(outIndex)->setOutOfDate(); getOutImg(outIndex)->setStateInfo("Cannot set output size, because variable could not be found in Matlab workspace.",ML_BAD_DATA_TYPE); + std::ostringstream msg; + msg << "Could not find the variable " << outname << " for output image number " << outIndex << " in the Matlab workspace."; + ML_PRINT_ERROR("MatlabScriptWrapper::calcOutImageProps", msg.str().c_str(), "Output will be invalid."); } } @@ -598,9 +602,10 @@ } // Get matlab image data. - mxArray *m_pImage = engGetVariable(m_pEngine, (_outDataNameFld[outIndex]->getStringValue()).c_str()); + const std::string matlabVariableName = _outDataNameFld[outIndex]->getStringValue(); + mxArray *m_pImage = engGetVariable(m_pEngine, matlabVariableName.c_str()); - if ( (m_pImage != NULL) ) { + if ( m_pImage != NULL) { // Copy different types of images from Matlab. MLPhysicalDataType outputClass; switch (mxGetClassID(m_pImage)) { @@ -621,13 +626,15 @@ } SubImg subImgBuf(outSubImg->getBox(), outputClass, mxGetPr(m_pImage)); outSubImg->copySubImage(subImgBuf); - mxDestroyArray(m_pImage); m_pImage = NULL; } else { - // Throw error, if no data available. - ML_PRINT_ERROR("MatlabScriptWrapper::calcOutSubImage()", ML_BAD_INPUT_IMAGE_POINTER, "Cannot copy from Matlab data."); + // Throw error if the variable could not be found in the Matlab workspace. + // NOTE: This is also checked in calcOutSubImgProps() above, so execution should never enter here. + std::ostringstream msg; + msg << "Could not find the variable " << matlabVariableName << " for output number " << outIndex << " in the Matlab workspace."; + ML_PRINT_ERROR("MatlabScriptWrapper::calcOutSubImage()", msg.str().c_str(), "Output will be empty"); } } @@ -801,8 +808,7 @@ } // Need also to have storage for complete output image. - //MLuint32 inDataSize = inImg->getBoxFromImgExt().getExt().getStrides().u; - const MLuint32 inDataSize = imgSize.x*imgSize.y*imgSize.z*imgSize.c*imgSize.t*imgSize.u; + const MLuint inDataSize = imgSize.x*imgSize.y*imgSize.z*imgSize.c*imgSize.t*imgSize.u; // Set Matlab image extent. const mwSize insizesArray[6] = {imgSize.x, imgSize.y, imgSize.z, imgSize.c, imgSize.t, imgSize.u}; @@ -825,19 +831,32 @@ elementSize = sizeof(double); std::cerr << "_copyInputImageDataToMatlab(): Output type from MeVisLab not supported" << std::endl << std::flush; } + // Create numeric array mxArray *m_pImage = mxCreateNumericArray(6, insizesArray, inputClass, mxREAL); + if(m_pImage == NULL) { + std::ostringstream msg; + msg << "Could not allocate matrix for input image " << i << " in Matlab."; + ML_PRINT_ERROR("MatlabScriptWrapper::copyInputImageDataToMatlab()", msg.str().c_str(), "Matrix will not be created in Matlab."); + } + else { - // Copy data to Matlab array. - memcpy((void*)mxGetPr(m_pImage), data, inDataSize*elementSize); + // Copy data to Matlab array. + memcpy((void*)mxGetPr(m_pImage), data, inDataSize*elementSize); - // Get input names from GUI. - std::string inputName = _inDataNameFld[i]->getStringValue(); - // Write data to Matlab. - engPutVariable(m_pEngine, inputName.c_str(), m_pImage); + // Get input names from GUI. + const std::string inputName = _inDataNameFld[i]->getStringValue(); + + // Write data to Matlab. + int status = engPutVariable(m_pEngine, inputName.c_str(), m_pImage); + if(status != 0) { + std::ostringstream msg; + msg << "Could not put data for image " << i << " in Matlab."; + ML_PRINT_ERROR("MatlabScriptWrapper::copyInputImageDataToMatlab()", msg.str().c_str(), "Matrix will not be created in Matlab."); + } - mxDestroyArray(m_pImage); m_pImage = NULL; - + mxDestroyArray(m_pImage); m_pImage = NULL; + } // Free allocated memory for holding a slice. freeTile(data); data = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |