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: <tva...@us...> - 2010-03-09 14:38:26
|
Revision: 254 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=254&view=rev Author: tvanwalsum Date: 2010-03-09 14:38:19 +0000 (Tue, 09 Mar 2010) Log Message: ----------- TVW: Added sources for expression parser modules (similar to Arithmetic2), and a module to fill an image using an arithmetic expression. Added Paths: ----------- trunk/Community/General/Sources/ML/MLCMImageFilters/ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.cpp trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.h trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.cpp trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.h trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.cpp trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.h trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parseImage.h trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.h trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.bat trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.pro trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFilters.sh trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFiltersInit.cpp trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFiltersInit.h trunk/Community/General/Sources/ML/MLCMImageFilters/MLCMImageFiltersSystem.h Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.cpp 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,155 @@ +// 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 ExpressionParser1. +/*! +// \file mlExpressionParser1.cpp +// \author ISI, Theo van Walsum +// \date 2007-03-06 +// +// Parses expression on input images +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#ifndef __mlExpressionParser1_H +#include "mlExpressionParser1.h" +#endif + +ML_START_NAMESPACE + +#include "parseImage.h" + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(ExpressionParser1, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +ExpressionParser1::ExpressionParser1 (void) + : BaseOp(1, 1) +{ + ML_TRACE_IN("ExpressionParser1::ExpressionParser1()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + (_expressionFld = fields->addString("expression"))->setStringValue("1.0*x+0.0"); + _expressionFld->attachField(getOutField()); + getInField(0)->attachField(getOutField()); + _parser = makeParser(_expressionFld->getStringValue()); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + +ExpressionParser1::~ExpressionParser1 (void) +{ + destroyParser(_parser); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void ExpressionParser1::handleNotification (Field *field) +{ + ML_TRACE_IN("ExpressionParser1::handleNotification()") + + // ... field notification handling code + if (field == _expressionFld) + { + destroyParser(_parser); + _parser = makeParser(_expressionFld->getStringValue()); + } +} + +void ExpressionParser1::activateAttachments(){ + this->handleNotification( _expressionFld ); + BaseOp::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! Sets properties of the output image at output \c outIndex. +//---------------------------------------------------------------------------------- +void ExpressionParser1::calcOutImageProps (int outIndex) +{ + ML_TRACE_IN("ExpressionParser1::calcOutImageProps ()") + + // ... set image properties for output image outIndex + if (!_parser) + getOutImg(outIndex)->setOutOfDate(); +} + + +//---------------------------------------------------------------------------------- +//! Returns the input image region required to calculate a region of an output image. +//---------------------------------------------------------------------------------- +SubImgBox ExpressionParser1::calcInSubImageBox (int /* inIndex */, const SubImgBox &outSubImgBox, int /* outIndex */) +{ + ML_TRACE_IN("ExpressionParser1::calcInSubImageBox ()") + + // ... return region of input image inIndex needed to compute region outSubImgBox of + // output image outIndex + + // replace this with your own SubImgBox: + return outSubImgBox; +} + + + +//---------------------------------------------------------------------------------- +//! Calls correctly typed (template) version of \c calcOutSubImage to calculate page +//! \c outSubImg of output image with index \c outSubImg. +//---------------------------------------------------------------------------------- +CALC_OUTSUBIMAGE1_CPP(ExpressionParser1); + +//---------------------------------------------------------------------------------- +//! Template for type specific page calculation. Called by +//! CALC_OUTSUBIMAGE1_CPP(ExpressionParser1). +//---------------------------------------------------------------------------------- +template <typename T> +void ExpressionParser1::calcOutSubImage (TSubImg<T> *outSubImg, int outIndex, + TSubImg<T> *inSubImg1) +{ + ML_TRACE_IN("template <typename T> ExpressionParser1::calcOutSubImage ()") + + // ... compute subimage of output image outIndex from subimages of all input images + SubImgBox outBox(outSubImg->getBox().intersect( getOutImg(outIndex)-> getBoxFromImgExt())); + + parseSubImage(inSubImg1, outSubImg, _parser, outBox); + +} + + + +ML_END_NAMESPACE + Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.cpp ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.h 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,132 @@ +// 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 ExpressionParser1. +/*! +// \file mlExpressionParser1.h +// \author ISI, Theo van Walsum +// \date 2007-03-06 +// +// Parses expression on input images +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlExpressionParser1_H +#define __mlExpressionParser1_H + + +// Local includes +#ifndef __MLCMImageFiltersSystem_H +#include "MLCMImageFiltersSystem.h" +#endif + +// ML includes +#ifndef __mlOperatorIncludes_H +#include "mlOperatorIncludes.h" +#endif + + +#include "parser.h" + +ML_START_NAMESPACE + + +//! Parses expression on input images +class MLCMIMAGEFILTERS_EXPORT ExpressionParser1 : public BaseOp +{ +public: + + //! Constructor. + ExpressionParser1 (void); + + //! Desctructor + ~ExpressionParser1 (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + virtual void activateAttachments(); + // ---------------------------------------------------------- + //@{ \name Image processing methods. + // ---------------------------------------------------------- + + //! Sets properties of the output image at output \c outIndex. + virtual void calcOutImageProps (int outIndex); + + //! Returns the input image region required to calculate a region of an output image. + //! \param inIndex The input of which the regions shall be calculated. + //! \param outSubImageBox The region of the output image for which the required input region + //! shall be calculated. + //! \param outIndex The index of the output image for which the required input region + //! shall be calculated. + //! \return Region of input image needed to compute the region \c outSubImgBox on output \c outIndex. + virtual SubImgBox calcInSubImageBox (int inIndex, const SubImgBox &outSubImgBox, int outIndex); + + //! Calculates page \c outSubImg of output image with index \c outIndex by using \c inSubimgs. + //! \param outSubImg The subimage of output image \c outIndex calculated from \c inSubImgs. + //! \param outIndex The index of the output the subimage is calculated for. + //! \param inSubImgs Array of subimage(s) of the input(s) whose extents were specified + //! by \c calcInSubImageBox. Array size is given by \c getInputNum(). + virtual void calcOutSubImage (SubImg *outSubImg, int outIndex, SubImg *inSubImgs); + + //! Method template for type-specific page calculation. Called by \c calcOutSubImage(). + //! \param outSubImg The typed subimage of output image \c outIndex calculated from \c inSubImg?. + //! \param outIndex The index of the output the subimage is calculated for. + //! \param inSubImg1 Temporary subimage of input 1. + template <typename T> + void calcOutSubImage (TSubImg<T> *outSubImg, int outIndex, + TSubImg<T> *inSubImg1); + + //@} + +private: + + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(ExpressionParser1) + + Parser *_parser; + + + StringField *_expressionFld; + + +}; + + +ML_END_NAMESPACE + +#endif // __mlExpressionParser1_H + + Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser1.h ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.cpp 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,158 @@ +// 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 ExpressionParser2. +/*! +// \file mlExpressionParser2.cpp +// \author ISI, Theo van Walsum +// \date 2007-03-06 +// +// Fills output image via expression on input images +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#ifndef __mlExpressionParser2_H +#include "mlExpressionParser2.h" +#endif + +ML_START_NAMESPACE + +#include "parseImage.h" + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(ExpressionParser2, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +ExpressionParser2::ExpressionParser2 (void) + : BaseOp(2, 1) +{ + ML_TRACE_IN("ExpressionParser2::ExpressionParser2()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + (_expressionFld = fields->addString("expression"))->setStringValue("x+y"); + _expressionFld->attachField(getOutField()); + getInField(0)->attachField(getOutField()); + getInField(1)->attachField(getOutField()); + _parser = makeParser(_expressionFld->getStringValue()); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); + +} + + +ExpressionParser2::~ExpressionParser2 (void) +{ + destroyParser(_parser); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void ExpressionParser2::handleNotification (Field *field) +{ + ML_TRACE_IN("ExpressionParser2::handleNotification()") + + // ... field notification handling code + if (field == _expressionFld) + { + destroyParser(_parser); + _parser = makeParser(_expressionFld->getStringValue()); + } +} + +void ExpressionParser2::activateAttachments(){ + this->handleNotification( _expressionFld ); + BaseOp::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! Sets properties of the output image at output \c outIndex. +//---------------------------------------------------------------------------------- +void ExpressionParser2::calcOutImageProps (int outIndex) +{ + ML_TRACE_IN("ExpressionParser2::calcOutImageProps ()") + + // ... set image properties for output image outIndex + if (!_parser) + getOutImg(outIndex)->setOutOfDate(); +} + + +//---------------------------------------------------------------------------------- +//! Returns the input image region required to calculate a region of an output image. +//---------------------------------------------------------------------------------- +SubImgBox ExpressionParser2::calcInSubImageBox (int /* inIndex */, const SubImgBox &outSubImgBox, int /* outIndex */) +{ + ML_TRACE_IN("ExpressionParser2::calcInSubImageBox ()") + + // ... return region of input image inIndex needed to compute region outSubImgBox of + // output image outIndex + + // replace this with your own SubImgBox: + return outSubImgBox; +} + + + +//---------------------------------------------------------------------------------- +//! Calls correctly typed (template) version of \c calcOutSubImage to calculate page +//! \c outSubImg of output image with index \c outSubImg. +//---------------------------------------------------------------------------------- +CALC_OUTSUBIMAGE2_CPP(ExpressionParser2); + +//---------------------------------------------------------------------------------- +//! Template for type specific page calculation. Called by +//! CALC_OUTSUBIMAGE2_CPP(ExpressionParser2). +//---------------------------------------------------------------------------------- +template <typename T> +void ExpressionParser2::calcOutSubImage (TSubImg<T> *outSubImg, int outIndex, + TSubImg<T> *inSubImg1, + TSubImg<T> *inSubImg2) +{ + ML_TRACE_IN("template <typename T> ExpressionParser2::calcOutSubImage ()") + + // ... compute subimage of output image outIndex from subimages of all input images + SubImgBox outBox(outSubImg->getBox().intersect( getOutImg(outIndex)-> getBoxFromImgExt())); + + parse2SubImages(inSubImg1, inSubImg2, outSubImg, _parser, outBox); +} + + + +ML_END_NAMESPACE + Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.cpp ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.h 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,127 @@ +// 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 ExpressionParser2. +/*! +// \file mlExpressionParser2.h +// \author ISI, Theo van Walsum +// \date 2007-03-06 +// +// Fills output image via expression on input images +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlExpressionParser2_H +#define __mlExpressionParser2_H + + +// Local includes +#ifndef __MLCMImageFiltersSystem_H +#include "MLCMImageFiltersSystem.h" +#endif + +// ML includes +#ifndef __mlOperatorIncludes_H +#include "mlOperatorIncludes.h" +#endif + +#include "parser.h" + +ML_START_NAMESPACE + + +//! Fills output image via expression on input images +class MLCMIMAGEFILTERS_EXPORT ExpressionParser2 : public BaseOp +{ +public: + + //! Constructor. + ExpressionParser2 (void); + + //! Desctructor + ~ExpressionParser2 (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + virtual void activateAttachments(); + // ---------------------------------------------------------- + //@{ \name Image processing methods. + // ---------------------------------------------------------- + + //! Sets properties of the output image at output \c outIndex. + virtual void calcOutImageProps (int outIndex); + + //! Returns the input image region required to calculate a region of an output image. + //! \param inIndex The input of which the regions shall be calculated. + //! \param outSubImageBox The region of the output image for which the required input region + //! shall be calculated. + //! \param outIndex The index of the output image for which the required input region + //! shall be calculated. + //! \return Region of input image needed to compute the region \c outSubImgBox on output \c outIndex. + virtual SubImgBox calcInSubImageBox (int inIndex, const SubImgBox &outSubImgBox, int outIndex); + + //! Calculates page \c outSubImg of output image with index \c outIndex by using \c inSubimgs. + //! \param outSubImg The subimage of output image \c outIndex calculated from \c inSubImgs. + //! \param outIndex The index of the output the subimage is calculated for. + //! \param inSubImgs Array of subimage(s) of the input(s) whose extents were specified + //! by \c calcInSubImageBox. Array size is given by \c getInputNum(). + virtual void calcOutSubImage (SubImg *outSubImg, int outIndex, SubImg *inSubImgs); + + //! Method template for type-specific page calculation. Called by \c calcOutSubImage(). + //! \param outSubImg The typed subimage of output image \c outIndex calculated from \c inSubImg?. + //! \param outIndex The index of the output the subimage is calculated for. + //! \param inSubImg1 Temporary subimage of input 1. + //! \param inSubImg2 Temporary subimage of input 2. + template <typename T> + void calcOutSubImage (TSubImg<T> *outSubImg, int outIndex, + TSubImg<T> *inSubImg1, + TSubImg<T> *inSubImg2); + + //@} + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(ExpressionParser2) + + Parser *_parser; + + + StringField *_expressionFld; + + +}; + + +ML_END_NAMESPACE + +#endif // __mlExpressionParser2_H + + Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlExpressionParser2.h ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.cpp 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,153 @@ +// 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 NewImageFromExpression. +/*! +// \file mlNewImageFromExpression.cpp +// \author ISI/TVW +// \date 2007-03-06 +// +// Generates new image from an expression +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#ifndef __mlNewImageFromExpression_H +#include "mlNewImageFromExpression.h" +#endif + + +ML_START_NAMESPACE + + +#include "parseImage.h" + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(NewImageFromExpression, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +NewImageFromExpression::NewImageFromExpression (void) + : BaseOp(0, 1) +{ + ML_TRACE_IN("NewImageFromExpression::NewImageFromExpression()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + getOutField(0)->setName("outputImage"); + + _dimFld = fields->addVector("imageDimension"); + _dimFld->setVectorValue(Vector(128,128,1,1,1,1)); + _dimFld->attachField(getOutField()); + _pageFld = fields->addVector("pageSize"); + _pageFld->setVectorValue(Vector(128,128,1,1,1,1)); + _pageFld->attachField(getOutField()); + + _dataTypeFld = fields->addEnum("datatype",MLDataTypeNames(),MLNumDataTypes()); + _dataTypeFld->setEnumValue(MLuint8Type); + _dataTypeFld->attachField(getOutField()); + + _expressionFld = fields->addString("expression"); + _expressionFld->setStringValue("0"); + _expressionFld->attachField(getOutField()); + _parser = makeParser(_expressionFld->getStringValue()); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); + +} + +NewImageFromExpression::~NewImageFromExpression (void) +{ + destroyParser(_parser); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void NewImageFromExpression::handleNotification (Field * /* field */) +{ + ML_TRACE_IN("NewImageFromExpression::handleNotification()") + // mlDebug("handleNotification for field" << field->getName() ); + +} + + +//---------------------------------------------------------------------------------- +//! Sets properties of the output image at output \c outIndex. +//---------------------------------------------------------------------------------- +void NewImageFromExpression::calcOutImageProps (int outIndex) +{ + ML_TRACE_IN("NewImageFromExpression::calcOutImageProps ()") + + destroyParser(_parser); + _parser = makeParser(_expressionFld->getStringValue()); + if (!_parser) + getOutImg(outIndex)->setOutOfDate(); + else + { + getOutImg(outIndex)->setImgExt(_dimFld->getVectorValue()); + getOutImg(outIndex)->setPageExt(_pageFld->getVectorValue()); + getOutImg(outIndex)->setDataType(MLfloatType); + } + + // ... set image properties for output image outIndex +} + + + +//---------------------------------------------------------------------------------- +//! Calls correctly typed (template) version of \c calcOutSubImage to calculate page +//! \c outSubImg of output image with index \c outSubImg. +//---------------------------------------------------------------------------------- +CALC_OUTSUBIMAGE0_CPP(NewImageFromExpression); + +//---------------------------------------------------------------------------------- +//! Template for type specific page calculation. Called by +//! CALC_OUTSUBIMAGE0_CPP(NewImageFromExpression). +//---------------------------------------------------------------------------------- +template <typename T> +void NewImageFromExpression::calcOutSubImage (TSubImg<T> *outSubImg, int outIndex) +{ + ML_TRACE_IN("template <typename T> NewImageFromExpression::calcOutSubImage ()") + + // ... compute subimage of output image outIndex from subimages of all input images + SubImgBox outBox(outSubImg->getBox().intersect( getOutImg(outIndex)-> getBoxFromImgExt())); + + parseCoordinatesImage(outSubImg, _parser, outBox); +} + + + +ML_END_NAMESPACE + Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.cpp ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.h 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,118 @@ +// 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 NewImageFromExpression. +/*! +// \file mlNewImageFromExpression.h +// \author ISI/TVW +// \date 2007-03-06 +// +// Generates new image from an expression +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlNewImageFromExpression_H +#define __mlNewImageFromExpression_H + + +// Local includes +#ifndef __MLCMImageFiltersSystem_H +#include "MLCMImageFiltersSystem.h" +#endif + +// ML includes +#ifndef __mlOperatorIncludes_H +#include "mlOperatorIncludes.h" +#endif + +#include "parser.h" + + +ML_START_NAMESPACE + + +//! Generates new image from an expression +class MLCMIMAGEFILTERS_EXPORT NewImageFromExpression : public BaseOp +{ +public: + + //! Constructor. + NewImageFromExpression (void); + + ~NewImageFromExpression (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + // ---------------------------------------------------------- + //@{ \name Image processing methods. + // ---------------------------------------------------------- + + //! Sets properties of the output image at output \c outIndex. + virtual void calcOutImageProps (int outIndex); + + + //! Calculates page \c outSubImg of output image with index \c outIndex by using \c inSubimgs. + //! \param outSubImg The subimage of output image \c outIndex calculated from \c inSubImgs. + //! \param outIndex The index of the output the subimage is calculated for. + //! \param inSubImgs Array of subimage(s) of the input(s) whose extents were specified + //! by \c calcInSubImageBox. Array size is given by \c getInputNum(). + virtual void calcOutSubImage (SubImg *outSubImg, int outIndex, SubImg *inSubImgs); + + //! Method template for type-specific page calculation. Called by \c calcOutSubImage(). + //! \param outSubImg The typed subimage of output image \c outIndex calculated from \c inSubImg?. + //! \param outIndex The index of the output the subimage is calculated for. + template <typename T> + void calcOutSubImage (TSubImg<T> *outSubImg, int outIndex); + + //@} + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(NewImageFromExpression) + + Parser *_parser; + + VectorField *_dimFld; + + VectorField *_pageFld; + + EnumField *_dataTypeFld; + + StringField *_expressionFld; + +}; + + +ML_END_NAMESPACE + +#endif // __mlNewImageFromExpression_H + + Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/mlNewImageFromExpression.h ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parseImage.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parseImage.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parseImage.h 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,137 @@ +/***************************************************************-*-c++-*- + + $Id$ + +*************************************************************************/ + +//--------------------------------------------------------------------------- +#ifndef ParseImagesH +#define ParseImagesH +//--------------------------------------------------------------------------- + +#include <string> + +#include "parser.h" + +// FUNCTION GROUP: Parsing of expressions on images + +inline Parser *makeParser(const std::string &expression) +{ + Parser *pParser = new Parser(expression.c_str()); + if (!pParser->isValid) { + delete pParser; + pParser = NULL; + } + return pParser; +} + +inline void destroyParser(Parser *pParser) +{ + delete pParser; +} + +////////// +// Parses expression, and evaluates it for each pixel in im. Use an +// 'x' in the expression for the input pixel value. +template <class T> +void parseSubImage(TSubImg<T> *inIm, + TSubImg<T> *outIm, + Parser *pParser, + const SubImgBox &box) +{ + //we have a valid parser now + + Vector p; + + for (p.u = box.v1.u; p.u <= box.v2.u; ++p.u) + + for (p.t = box.v1.t; p.t <= box.v2.t; ++p.t) + + for (p.c = box.v1.c; p.c <= box.v2.c; ++p.c) + + for (p.z = box.v1.z; p.z <= box.v2.z; ++p.z) + + for (p.y = box.v1.y; p.y <= box.v2.y; ++p.y) + + { + p.x = box.v1.x; + T *in = inIm->getImgPos(p); + T *out = outIm->getImgPos(p); + T *end = in + box.v2.x - box.v1.x + 1; + + while ( in != end ) + *out++ = pParser->Value(*in++); + + } +} + +////////// +// Parses expression, and evaluates it for each pixel in im. Use an +// 'x' in the expression for the input pixel value of the first input +// image, and y for the input pixel value of th second input. +template <class T> +void parse2SubImages(TSubImg<T> *inIm1, TSubImg<T> *inIm2, + TSubImg<T> *outIm, + Parser *pParser, + const SubImgBox &box) +{ + //we have a valid parser now + + Vector p; + + for (p.u = box.v1.u; p.u <= box.v2.u; ++p.u) + + for (p.t = box.v1.t; p.t <= box.v2.t; ++p.t) + + for (p.c = box.v1.c; p.c <= box.v2.c; ++p.c) + + for (p.z = box.v1.z; p.z <= box.v2.z; ++p.z) + + for (p.y = box.v1.y; p.y <= box.v2.y; ++p.y) + + { + p.x = box.v1.x; + T *in1 = inIm1->getImgPos(p); + T *in2 = inIm2->getImgPos(p); + T *out = outIm->getImgPos(p); + T *end = in1 + box.v2.x - box.v1.x + 1; + + while ( in1 != end ) + *out++ = pParser->Value(*in1++,*in2++); + + } +} + + +////////// +// Parses expression, and evaluates it for each pixel in im. Use an +// 'x' in the expression for the input pixel value. +template <class T> +void parseCoordinatesImage( TSubImg<T> *outIm, + Parser *pParser, + const SubImgBox &box ) +{ + //we have a valid parser now + + int x, y, z, c, t, u; + + for (u = box.v1.u; u <= box.v2.u; ++u) + + for (t = box.v1.t; t <= box.v2.t; ++t) + + for (c = box.v1.c; c <= box.v2.c; ++c) + + for (z = box.v1.z; z <= box.v2.z; ++z) + + for (y = box.v1.y; y <= box.v2.y; ++y) + + { + x = box.v1.x; + T *out = outIm->getImgPos(Vector(x,y,z,c,t,u)); + + while ( x <= box.v2.x ) + *out++ = pParser->Value(x++,y,z,c,t,u); + } +} + +#endif Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parseImage.h ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,514 @@ +// 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. + + +#include "parser.h" + +// Include NR error function code +#include "nr3.h" +#include "erf.h" + +using namespace std; + +const double Parser::pi = 4.0*atan(1.0); +const double Parser::e = exp(1.0); + +//=========================================================================== +Parser::Parser (const char* infix, ostream& ostr) : + tokenList(0), isValid(1) +{ + if ( infix == NULL ) + { + ostr << "Parser: null string not allowed" << endl; + isValid = 0; + return; + } + + int infixLength = strlen(infix); + if ( infixLength == 0 ) + { + ostr << "Parser: empty string not allowed" << endl; + isValid = 0; + return; + } + + tokenListLength = 0; + tokenList = new Token[infixLength]; + + Token* tokenStack = new Token[infixLength]; + int tokenStackTop = -1; + + Token token, topOp, op; + + const char* s = infix; + for (const char* f = s; *f; f = s) + { + int length; + + // get token from input string + if ( IsWhiteSpace(*s) ) + { + s++; + continue; + } + + if ( IsIdentifier(*s) ) + { + for (length = 0; IsIdentifier(*s); length++) + s++; + + if ( IsVariable(f,length,&token.variable) ) + { + token.type = ttVariable; + } + else if ( IsConstant(f,length,&token.number) ) + { + token.type = ttNumber; + } + else if ( IsFunction(f,length,&token.uf) ) + { + token.type = ttUnaryFunction; + } + else + { + char* save = new char[length+1]; + strncpy(save,f,length); + save[length+1] = 0; + ostr << "Parser: invalid identifier " << save << endl; + delete[] save; + isValid = 0; + delete[] tokenStack; + return; + } + } + else if ( IsNumber(*s) ) + { + for (length = 0; IsNumber(*s); length++) + s++; + + int decPoints = 0; + for (int i = 0; i < length; i++) + decPoints += ( f[i] == '.' ); + if ( decPoints > 1 ) + { + ostr << "Parser: too many decimal points in number" << endl; + isValid = 0; + delete[] tokenStack; + return; + } + + char* number = new char[length+1]; + strncpy(number,f,length); + number[length] = 0; + token.type = ttNumber; + token.number = atof(number); + delete[] number; + } + else if ( IsOperator(*s,&token.bf) ) + { + token.type = ttBinaryFunction; + s++; + } + else if ( *s == '(' ) + { + token.type = ttLeftParenthesis; + s++; + } + else if ( *s == ')' ) + { + token.type = ttRightParenthesis; + s++; + } + else + { + if ( *s ) + { + ostr << "Parser: invalid symbol " << *s << endl; + isValid = 0; + delete[] tokenStack; + return; + } + } + + // parse current token + if ( token.type == ttNumber || token.type == ttVariable ) + { + tokenList[tokenListLength++] = token; + } + else + { + if ( tokenStackTop >= 0 ) + topOp = tokenStack[tokenStackTop]; + while ( tokenStackTop >= 0 && HigherPrecedence(topOp,token) ) + { + op = tokenStack[tokenStackTop--]; + tokenList[tokenListLength++] = op; + if ( tokenStackTop >= 0 ) + topOp = tokenStack[tokenStackTop]; + } + if ( token.type != ttRightParenthesis ) + { + tokenStack[++tokenStackTop] = token; + } + else if ( tokenStackTop >= 0 ) + { + op = tokenStack[tokenStackTop--]; + } + else + { + ostr << "Parser: unmatched right parenthesis" << endl; + isValid = 0; + delete[] tokenStack; + return; + } + } + } + + while ( tokenStackTop >= 0 ) + { + op = tokenStack[tokenStackTop--]; + if ( op.type == ttLeftParenthesis ) + { + ostr << "Parser: unmatched left parenthesis" << endl; + isValid = 0; + delete[] tokenStack; + return; + } + tokenList[tokenListLength++] = op; + } + if ( tokenListLength == 0 ) + { + ostr << "Parser: null expression" << endl; + isValid = 0; + delete[] tokenStack; + return; + } + + isValid = IsValidExpression(); + if ( isValid == 0 ) + ostr << "Parser: invalid expression" << endl; + delete[] tokenStack; +} +//--------------------------------------------------------------------------- +Parser::~Parser () +{ + delete[] tokenList; +} +//--------------------------------------------------------------------------- +int Parser::IsVariable (const char* ss, int length, double** var) +{ + if ( length == 1 ) + { + switch ( *ss ) + { + case 'x': *var = &x; return 1; + case 'y': *var = &y; return 1; + case 'z': *var = &z; return 1; + case 'c': *var = &c; return 1; + case 't': *var = &t; return 1; + case 'u': *var = &u; return 1; + default: *var = 0; return 0; + } + } + return 0; +} +//--------------------------------------------------------------------------- +int Parser::IsConstant (const char* string, int length, double* value) +{ + if ( length == 2 && strcmp(string,"pi") ) + { + *value = pi; + return 1; + } + + if ( length == 1 && strcmp(string,"e") ) + { + *value = e; + return 1; + } + + return 0; +} +//--------------------------------------------------------------------------- +int Parser::IsOperator (char s, BinaryFunction* f) +{ + switch ( s ) + { + case '^': *f = Power; return 1; + case '*': *f = Multiply; return 1; + case '/': *f = Divide; return 1; + case '+': *f = Add; return 1; + case '-': *f = Subtract; return 1; + default : *f = 0; return 0; + } +} +//--------------------------------------------------------------------------- +double sign(double f) +{ + return (f<0)?-1:(f>0)?1:0; +} + +const double randfac = 1.0/RAND_MAX; + +double randomnumber(double /* f */) +{ + return rand()*randfac; +} + +double erf(double f) +{ + Erf erf; + return erf.erf(f); +} + +int Parser::IsFunction (const char* string, int length, UnaryFunction* f) +{ + switch ( length ) + { + case 3: + if ( strncmp(string,"sin",3) == 0 ) + { + *f = sin; + return 1; + } + if ( strncmp(string,"cos",3) == 0 ) + { + *f = cos; + return 1; + } + if ( strncmp(string,"tan",3) == 0 ) + { + *f = tan; + return 1; + } + if ( strncmp(string,"exp",3) == 0 ) + { + *f = exp; + return 1; + } + if ( strncmp(string,"log",3) == 0 ) + { + *f = log; + return 1; + } + if ( strncmp(string,"erf",3) == 0 ) + { + *f = erf; + return 1; + } + case 4: + if ( strncmp(string,"sqrt",4) == 0 ) + { + *f = sqrt; + return 1; + } + if ( strncmp(string,"atan",4) == 0 ) + { + *f = atan; + return 1; + } + if ( strncmp(string,"sign",4) == 0 ) + { + *f = sign; + return 1; + } + if ( strncmp(string,"asin",4) == 0 ) + { + *f = asin; + return 1; + } + if ( strncmp(string,"acos",4) == 0 ) + { + *f = acos; + return 1; + } + case 5: + if ( strncmp(string,"floor",5) == 0 ) + { + *f = floor; + return 1; + } + case 12: + if ( strncmp(string,"randomnumber",12) == 0 ) + { + *f = randomnumber; + return 1; + } + default: + *f = 0; + return 0; + } +} +//--------------------------------------------------------------------------- +int Parser:: +HigherPrecedence (Token& op1, Token& op2) +{ + int result; + + switch ( op1.type ) + { + case ttLeftParenthesis: + result = 0; + break; + case ttBinaryFunction: + if ( op1.bf == Power || op1.bf == Multiply || op1.bf == Divide ) + { + result = op2.type == ttRightParenthesis + || op2.bf == Multiply + || op2.bf == Divide + || op2.bf == Add + || op2.bf == Subtract; + break; + } + if ( op1.bf == Add || op1.bf == Subtract ) + { + result = op2.type == ttRightParenthesis + || op2.bf == Add + || op2.bf == Subtract; + break; + } + result = 0; + break; + case ttUnaryFunction: + result = op2.type == ttRightParenthesis + || op2.type == ttBinaryFunction; + break; + default: + result = 0; + } + + return result; +} +//--------------------------------------------------------------------------- +int Parser::IsValidExpression () +{ + int stackSize = 0; + maxStackSize = 0; + + for (int i = 0; i < tokenListLength; i++) + { + Token token = tokenList[i]; + + switch ( token.type ) + { + case ttNumber: + case ttVariable: + // push + stackSize++; + if ( stackSize > maxStackSize ) + maxStackSize = stackSize; + break; + case ttUnaryFunction: + // pop + // push + if ( stackSize < 1 ) + return 0; + break; + case ttBinaryFunction: + // pop + // pop + // push + if ( stackSize < 2 ) + return 0; + stackSize--; + break; + default: + break; + } + } + + return ( stackSize == 1 ); // pop final result +} +//--------------------------------------------------------------------------- +double Parser:: +Value (double _x, double _y, double _z, double _c, double _t, double _u) +{ + x = _x; + y = _y; + z = _z; + c = _c; + t = _t; + u = _u; + + // cheap stack + int top = -1; + double* stack = new double[maxStackSize]; + + double op1, op2; + + for (int i = 0; i < tokenListLength; i++) + { + Token token = tokenList[i]; + + switch ( token.type ) + { + case ttNumber: + stack[++top] = token.number; // push + break; + case ttVariable: + stack[++top] = *token.variable; // push + break; + case ttUnaryFunction: + op1 = stack[top--]; // pop + stack[++top] = token.uf(op1); // push + break; + case ttBinaryFunction: + op2 = stack[top--]; // pop + op1 = stack[top--]; // pop + stack[++top] = token.bf(op1,op2); // push + break; + default: + break; + } + } + + double result = stack[top]; + delete[] stack; + return result; +} +//=========================================================================== + +#ifdef PARSER_TEST + +int main (int argc, char** argv) +{ + Parser p(argv[1]); + cout << "expression " << argv[1] << " is "; + if ( p.isValid ) + cout << "valid"; + else + cout << "not valid"; + cout << endl; + + if ( p.isValid ) + cout << p.Value(1.0,2.0,3.0) << endl; + + return 0; +} + +#endif + + Property changes on: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.cpp ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMImageFilters/ExpressionParser/parser.h 2010-03-09 14:38:19 UTC (rev 254) @@ -0,0 +1,109 @@ +// 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. + + +#ifndef PARSER_H +#define PARSER_H + + +#include <cmath> +#include <iostream> + +typedef double (*UnaryFunction)(double); +typedef double (*BinaryFunction)(double,double); + +typedef enum + { + ttVariable, + ttNumber, + ttUnaryFunction, + ttBinaryFunction, + ttLeftParenthesis, + ttRightParenthesis + } + parserTokenType; + +typedef struct +{ + parserTokenType type; + union + { + double* variable; + double number; + UnaryFunction uf; + BinaryFunction bf; + }; +} + Token; + + +class Parser +{ +public: + Parser (const char* infix, std::ostream& ostr = std::cout); + ~Parser (); + + int IsValidExpression(); + + int IsWhiteSpace (char c) + { return c == ' ' || c == '\t' || c == '\n'; } + int IsIdentifier (char c) + { return isalpha(c); } + int IsNumber (char c) + { return isdigit(c) || c == '.'; } + + int IsVariable (const char* string, int length, double** var); + int IsConstant (const char* string, int length, double* value); + int IsFunction (const char* string, int length, UnaryFunction* f); + int IsOperator (char c, BinaryFunction* f); + + int HigherP... [truncated message content] |
From: <tva...@us...> - 2010-03-09 14:36:39
|
Revision: 253 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=253&view=rev Author: tvanwalsum Date: 2010-03-09 14:36:32 +0000 (Tue, 09 Mar 2010) Log Message: ----------- TVW: Added expression parser modules (similar to Arithmetic2), and a module to fill an image using an arithmetic expression. Added Paths: ----------- trunk/Community/General/Modules/ML/MLCMImageFilters/ trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser1.html trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser2.html trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParserExample.mlab trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/NewImageFromExpression.html trunk/Community/General/Modules/ML/MLCMImageFilters/MLCMImageFilters.def Added: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser1.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser1.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser1.html 2010-03-09 14:36:32 UTC (rev 253) @@ -0,0 +1,78 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>ExpressionParser1</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>Generate an image where the voxel value is the result of evaluating an expression for that voxel. Use x in the expression for the value of the corresponding input image voxel. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Specify an expression (where you can use for x the input voxel value). +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>The expression does not handle unary minus. E.g. the following is not a valid expression: +<p>-x +<p>The following expression can be used as a substitute: +<p>(0-1)*x +<p>Expressions that can not be parsed will not give an output image. +</blockquote> + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>input0</b> + Input image. + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>output0</b> + Output image. + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>expression</b> + Expression to parse. x stands for the input image. See NewImageFromExpression for details on the expression syntax. + </li> + </ul> + +</blockquote> + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>Example expressions: + +<ul><li>Add 10 to the image: x + 10 +<li>square the image: x*x +<li>quadratic exponential decay: exp( (0-1)*(x*x) ) +</ul> +</blockquote> + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser1.html ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser2.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser2.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser2.html 2010-03-09 14:36:32 UTC (rev 253) @@ -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="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>ExpressionParser2</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>More generic Arithmetic2 (but a bit slower ...). +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect 2 images, and specify the expression. In the expression, x refers to voxel value of first image, and y to voxel value of second image. Unary minus is not implemented, replace with e.g. (0-1)* instead of -. +</blockquote> + + + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>input0</b> + First input image (x in expression) + </li> + <li> + <b>input1</b> + Second input image (y in expression) + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>output0</b> + Result of evaluating expression for each voxel. + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>expression</b> + Expression to parse. x stands for the first input image, y for the second input image. See NewImageFromExpression for details on the expression syntax. + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParser2.html ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParserExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParserExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParserExample.mlab 2010-03-09 14:36:32 UTC (rev 253) @@ -0,0 +1,268 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SynchroView2D { + internal { + frame = "373 -11 120 56" + windows { + window _default { + geometry = "241 334 804 400" + sizeHint = "804 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SynchroView2D + leftInventorInputOn = FALSE + rightInventorInputOn = FALSE + synchSlicing = TRUE + synchZooming = TRUE + synchTiming = TRUE + synchLUTs = FALSE + disconnectOnHide = TRUE + snapToCenter1 = FALSE + snapToCenter2 = FALSE + slice1 = 0 + slice2 = 0 + lut1w = 2 + lut1c = 1 + lut2w = 2 + lut2c = 1 + filterMode = FILTER_LINEAR + annotationColor = "0.9 0.9 0.9" + drawCurrentPos = TRUE + } + internalFields = "" +} +module ImgPropConvert { + internal { + frame = "177 101 128 56" + windows { + window _default { + geometry = "449 246 389 576" + sizeHint = "389 576" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ImgPropConvert1 + changeDimensionInfo = FALSE + cDimInfo = "" + tDimInfo = "" + uDimInfo = "" + a00 = 1 + a01 = 0 + a02 = 0 + a03 = 0 + a10 = 0 + a11 = 1 + a12 = 0 + a13 = 0 + a20 = 0 + a21 = 0 + a22 = 1 + a23 = 0 + a30 = 0 + a31 = 0 + a32 = 0 + a33 = 1 + changeDatatype = FALSE + datatype = "unsigned int8" + changePageSize = FALSE + pageSizeX = 32 + pageSizeY = 32 + pageSizeZ = 1 + pageSizeC = 1 + pageSizeT = 1 + pageSizeU = 1 + changeMinGreyvalue = TRUE + minGreyvalue = -1 + changeMaxGreyvalue = TRUE + maxGreyvalue = 1 + changeWorldMatrix = FALSE + voxelSizeX = 1 + voxelSizeY = 1 + voxelSizeZ = 1 + autoApply = TRUE + } +} +module NewImageFromExpression { + internal { + frame = "245 409 184 64" + windows { + window _default { + geometry = "138 683 373 255" + sizeHint = "204 200" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = NewImageFromExpressionY + imageDimension = "128 128 1 1 1 1" + pageSize = "128 128 1 1 1 1" + datatype = float + expression = y-30 + } +} +module ExpressionParser1 { + internal { + frame = "265 289 144 64" + windows { + window _default { + geometry = "541 459 204 103" + sizeHint = "204 103" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ExpressionParser1Y + expression = "x*x" + } +} +module ExpressionParser2 { + internal { + frame = "173 181 136 56" + windows { + window _default { + geometry = "543 649 204 103" + sizeHint = "204 103" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ExpressionParser2 + expression = "sin( (x+y)/100)" + } +} +module ExpressionParser1 { + internal { + frame = "81 289 144 64" + windows { + window _default { + geometry = "541 459 204 103" + sizeHint = "204 103" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ExpressionParser1X + expression = "x*x" + } +} +module NewImageFromExpression { + internal { + frame = "61 409 184 64" + windows { + window _default { + geometry = "101 554 373 255" + sizeHint = "204 200" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = NewImageFromExpressionX + imageDimension = "128 128 1 1 1 1" + pageSize = "128 128 1 1 1 1" + datatype = float + expression = x-10 + } +} +module ImgPropConvert { + internal { + frame = "525 317 120 56" + windows { + window _default { + geometry = "449 246 389 576" + sizeHint = "389 576" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ImgPropConvert + changeDimensionInfo = FALSE + cDimInfo = "" + tDimInfo = "" + uDimInfo = "" + a00 = 1 + a01 = 0 + a02 = 0 + a03 = 0 + a10 = 0 + a11 = 1 + a12 = 0 + a13 = 0 + a20 = 0 + a21 = 0 + a22 = 1 + a23 = 0 + a30 = 0 + a31 = 0 + a32 = 0 + a33 = 1 + changeDatatype = FALSE + datatype = "unsigned int8" + changePageSize = FALSE + pageSizeX = 32 + pageSizeY = 32 + pageSizeZ = 1 + pageSizeC = 1 + pageSizeT = 1 + pageSizeU = 1 + changeMinGreyvalue = TRUE + minGreyvalue = -1 + changeMaxGreyvalue = TRUE + maxGreyvalue = 1 + changeWorldMatrix = FALSE + voxelSizeX = 1 + voxelSizeY = 1 + voxelSizeZ = 1 + autoApply = TRUE + } +} +module NewImageFromExpression { + internal { + frame = "493 405 184 56" + windows { + window _default { + geometry = "108 522 373 255" + sizeHint = "204 200" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = NewImageFromExpression1 + imageDimension = "128 128 1 1 1 1" + pageSize = "128 128 1 1 1 1" + datatype = float + expression = "sin( ((x-10)*(x-10)+(y-30)*(y-30))/100 )" + } +} +connections { + SynchroView2D.inImage1 = ImgPropConvert1.output0 + SynchroView2D.inImage2 = ImgPropConvert.output0 + ImgPropConvert1.input0 = ExpressionParser2.output0 + ExpressionParser1Y.input0 = NewImageFromExpressionY.outputImage + ExpressionParser2.input0 = ExpressionParser1X.output0 + ExpressionParser2.input1 = ExpressionParser1Y.output0 + ExpressionParser1X.input0 = NewImageFromExpressionX.outputImage + ImgPropConvert.input0 = NewImageFromExpression1.outputImage +} Property changes on: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/ExpressionParserExample.mlab ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + LF Added: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/NewImageFromExpression.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/NewImageFromExpression.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/NewImageFromExpression.html 2010-03-09 14:36:32 UTC (rev 253) @@ -0,0 +1,95 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>NewImageFromExpression</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>Generate an image where each voxels value is the result of evaluating an expression for that voxel. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Specify image dimension, page size and datatype for voxels. Also specify an expression (where you can use x, y and z as the voxel index values). Each voxels value will be the result of evaluating the expression for that voxel. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>The expression does not handle unary minus. E.g. the following is not a valid expression: +<p>-x +<p>The following expression can be used as a substitute: +<p>(0-1)*x +<p>Expressions that can not be parsed will not give an output image. +</blockquote> + +<blockquote>The expression parser recognizes the following tokens: +<p>pi : the value of pi +<p> e : the value of e +<p>unary functions: sin, cos, tan, exp, log, erf, sqrt, atan, sign, asin, acos, floor, randomnumber +<p>binary operators: ^, *, /, +, - +<p>braces: ( ) to specify the argument of a unary functions, and to group subexpressions. +<p>x, y, z, c, t, u: coordinates of voxel (for NewImageFromExpression) +<p>x, y: input image voxels voor ExpressionParser1 (only x), and ExpressionParser2 (x and y) +<p>The following expression can be used as a substitute: +<p>(0-1)*x +<p>Expressions that can not be parsed will not give an output image. +</blockquote> + + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outputImage</b> + Image generated from the expression. + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>imageDimension</b> + The dimensions of the image, e.g. 10 20 30 1 1 1 for an image of 10x20x30 voxels. + Note that the dimension should contain 6 integers, and that each of the values should be larger than 0. + </li> + <li> + <b>pageSize</b> + Preferred page size of the image, notation similar to imageDimension. + </li> + <li> + <b>datatype</b> + Datatype of voxels. + </li> + <li> + <b>expression</b> + Expression to be parsed. + </li> + </ul> + +</blockquote> + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>Example expressions: + +<ul><li>sin( (x-20)*(x-20) + (y-10)*(y-10) ) +<li>x*x + y +<li>3 +</ul> +</blockquote> + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLCMImageFilters/ExpressionParser/NewImageFromExpression.html ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLCMImageFilters/MLCMImageFilters.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMImageFilters/MLCMImageFilters.def (rev 0) +++ trunk/Community/General/Modules/ML/MLCMImageFilters/MLCMImageFilters.def 2010-03-09 14:36:32 UTC (rev 253) @@ -0,0 +1,88 @@ +//---------------------------------------------------------------------------------- +//! MLCMImageFilters module definitions. +/*! +// \file MLCMImageFilters.def +// \author Theo van Walsum +// \date 2007-08-14 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule NewImageFromExpression +//---------------------------------------------------------------------------------- +MLModule NewImageFromExpression { + DLL = "MLCMImageFilters" + group = "BIGR" + genre = "" + author = "Theo van Walsum" + status = "stable" + comment = "Fills a new image with values by evaluating an expression for each voxel" + keywords = "New Image, Expression Parser" + seeAlso = "ExpressionParser1, ExpressionParser2, TestPattern" + documentation = "$(LOCAL)/ExpressionParser/NewImageFromExpression.html" + projectSource = "$(MLAB_EMC_General)/Sources/ML/MLCMImageFilters" + exampleNetwork = "$(LOCAL)/ExpressionParser/ExpressionParserExample.mlab" + + Window { + Vertical { + Field expression {} + Field datatype {} + Field imageDimension {} + Field pageSize {} + } + } + +} // MLModule NewImageFromExpression + +//---------------------------------------------------------------------------------- +// MLModule ExpressionParser1 +//---------------------------------------------------------------------------------- +MLModule ExpressionParser1 { + DLL = "MLCMImageFilters" + group = "BIGR" + genre = "" + author = "Theo van Walsum" + status = "stable" + comment = "Parses expression on input images" + keywords = "arithmetic expression parser" + seeAlso = "NewImageFromExpression, ExpressionParser2, Arithmetic1" + documentation = "$(LOCAL)/ExpressionParser/ExpressionParser1.html" + projectSource = "$(MLAB_EMC_General)/Sources/ML/MLCMImageFilters" + exampleNetwork = "$(LOCAL)/ExpressionParser/ExpressionParserExample.mlab" + + Window { + w = 250 + Vertical { + Field expression {} + } + } + + +} // MLModule ExpressionParser1 + + +//---------------------------------------------------------------------------------- +// MLModule ExpressionParser2 +//---------------------------------------------------------------------------------- +MLModule ExpressionParser2 { + DLL = "MLCMImageFilters" + group = "BIGR" + genre = "" + author = "Theo van Walsum" + status = "stable" + comment = "Fills output image via expression on input images" + keywords = "expression parser arithmetic" + seeAlso = "NewImageFromExpression, ExpressionParser1, Arithmetic2" + documentation = "$(LOCAL)/ExpressionParser/ExpressionParser2.html" + projectSource = "$(MLAB_EMC_General)/Sources/ML/MLCMImageFilters" + exampleNetwork = "$(LOCAL)/ExpressionParser/ExpressionParserExample.mlab" + + Window { + w = 250 + Vertical { + Field expression {} + } + } + +} // MLModule ExpressionParser2 Property changes on: trunk/Community/General/Modules/ML/MLCMImageFilters/MLCMImageFilters.def ___________________________________________________________________ Added: svn:keywords + Date Revision Author HeadURL Id 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-03-08 09:26:26
|
Revision: 252 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=252&view=rev Author: rhameeteman Date: 2010-03-08 09:26:19 +0000 (Mon, 08 Mar 2010) Log Message: ----------- KH. * made some casts explicit * fixed some singed unsigned mismatches Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/MainAxisPCA.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.h Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/MainAxisPCA.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/MainAxisPCA.cpp 2010-03-08 08:00:16 UTC (rev 251) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/MainAxisPCA.cpp 2010-03-08 09:26:19 UTC (rev 252) @@ -259,7 +259,7 @@ jacobi(covaMatrix, 3, eigenValues, jacobiMat, &nrot); // Calculate main axes - int counter=0; + unsigned int counter=0; for (counter = 0; counter < 3; counter++) { _xAxis[counter] = jacobiMat[counter + 1][1]; _yAxis[counter] = jacobiMat[counter + 1][2]; @@ -271,7 +271,7 @@ float* newVertices = NULL; ML_CHECK_NEW(newVertices, float[size * 3]); - int counter2 = 0; + unsigned int counter2 = 0; for (counter = 0; counter < size; counter++) { newVertices[counter2++] = dotProduct(points, _xAxis); //tempPoint.dot(_xAxis); Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-03-08 08:00:16 UTC (rev 251) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-03-08 09:26:19 UTC (rev 252) @@ -485,22 +485,23 @@ mat4 wTvMatrix = mat4(vMatrix); CSOBoundingBox csoBB = cso->getVoxelBoundingBox( wTvMatrix ); const MLint t = cso->getTimePointIndex(); - const MLint x1 = csoBB.v1[0]; - const MLint y1 = csoBB.v1[1]; - const MLint z1 = csoBB.v1[2]; - const MLint x2 = csoBB.v2[0]; - const MLint y2 = csoBB.v2[1]; - const MLint z2 = csoBB.v2[2]; + 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. - double* inputTile = NULL; + void* tile; MLErrorCode err = getTile( static_cast<BaseOp*>(mpr), 0, csoVoxelBox, MLdoubleType, - (void**)(&inputTile) ); + &tile ); + double* inputTile = reinterpret_cast< double* >(tile); // Remove data on error to avoid memory leaks. if (inputTile && (err != ML_RESULT_OK)){ @@ -530,9 +531,9 @@ const Vector strideVector = csoVoxelBox.getExt().getStrides(); const int currentCSOIndex = cso->getCSOList()->getCSOIndex( cso ); for ( unsigned int iPos = 0; iPos < contourPoints.size(); ++iPos){ - const MLint x0 = contourPoints[iPos][0]; - const MLint y0 = contourPoints[iPos][1]; - const MLint z0 = contourPoints[iPos][2]; + 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); Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp 2010-03-08 08:00:16 UTC (rev 251) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp 2010-03-08 09:26:19 UTC (rev 252) @@ -96,7 +96,7 @@ //---------------------------------------------------------------------------------- //! Handle notifications of CSOList //---------------------------------------------------------------------------------- -void CSOPointsToXMarkers::CSOListNotifyObserverCB(void* userData, int notificationFlag) +void CSOPointsToXMarkers::CSOListNotifyObserverCB(void* userData, int /*notificationFlag*/) { ML_TRACE_IN("CSOPointsToXMarkers::_csoListNotifyObserverCB"); @@ -177,10 +177,10 @@ if (outputPathPoints) { std::list<vec3> points; // First collect all pathpoints - for (int i=0; i<cso->numPathPointLists(); ++i) { + for (unsigned int i=0; i<cso->numPathPointLists(); ++i) { CSOPathPoints* pathList=cso->getPathPointsAt(i); - int numOfPathPoints = pathList->numPathPoints(); - for (int k=0; k<numOfPathPoints; k++) + const unsigned int numOfPathPoints = pathList->numPathPoints(); + for (unsigned int k=0; k<numOfPathPoints; k++) { vec3 posPathPoint = pathList->getPosAt(k); if (points.back()!=posPathPoint) points.push_back(posPathPoint); @@ -232,7 +232,7 @@ _outputXMarkerList.appendItem(markerPath); } } else{ - for (int i=0; i<cso->numSeedPoints(); ++i) { + for (unsigned int i=0; i<cso->numSeedPoints(); ++i) { CSOSeedPoint * seedpoint = cso->getSeedPointAt(i); vec3 pos = seedpoint->worldPosition; XMarker marker (pos); @@ -241,7 +241,7 @@ if (inPlane && outputNormals) { // Determine previous and next marker int iPrev = i-1; - int iNext = i+1; + unsigned int iNext = i+1; if (iPrev<0) { if (cso->isClosed()) { iPrev=cso->numSeedPoints()-1; Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.h 2010-03-08 08:00:16 UTC (rev 251) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.h 2010-03-08 09:26:19 UTC (rev 252) @@ -66,7 +66,7 @@ virtual void handleNotification (Field * /*field*/); //! Observer for CSO List - static void CSOListNotifyObserverCB(void* userData, int notificationFlag); + static void CSOListNotifyObserverCB(void* userData, int /*notificationFlag*/); private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-03-08 08:00:23
|
Revision: 251 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=251&view=rev Author: coertmetz Date: 2010-03-08 08:00:16 +0000 (Mon, 08 Mar 2010) Log Message: ----------- CM: Changed title of fiel in GUI. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def Modified: trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2010-03-06 13:59:14 UTC (rev 250) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/MLCSOCommunityModules.def 2010-03-08 08:00:16 UTC (rev 251) @@ -151,7 +151,7 @@ margin = 3 Field listIndexFld { title = "CSO list-index:" } CheckBox convertPathPoints {} - CheckBox outputCSONormals {} + CheckBox outputCSONormals { title = "Output CSO normals" } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-06 13:59:21
|
Revision: 250 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=250&view=rev Author: rhameeteman Date: 2010-03-06 13:59:14 +0000 (Sat, 06 Mar 2010) Log Message: ----------- KH. * Resolved some gcc warnings. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.cpp trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp Modified: trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-03-06 13:59:14 UTC (rev 250) @@ -131,7 +131,7 @@ //---------------------------------------------------------------------------------- //! Handle field changes of the field field. //---------------------------------------------------------------------------------- -void BoxArithmetic::handleNotification (Field *field) +void BoxArithmetic::handleNotification (Field * /*field*/) { ML_TRACE_IN("BoxArithmetic::handleNotification ()"); Modified: trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h 2010-03-06 13:59:14 UTC (rev 250) @@ -58,7 +58,7 @@ BoxArithmetic (); //! Handle field changes of the field field. - virtual void handleNotification (Field *field); + virtual void handleNotification (Field * /*field*/); private: Modified: trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.cpp 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.cpp 2010-03-06 13:59:14 UTC (rev 250) @@ -478,7 +478,7 @@ } float det = rotationMatrix.det(); // Set rotation field only if there is a valid rotation matrix defined - if ( abs(det - 1) < 0.0001 ){ + if ( MLAbs(det - 1) < 0.0001 ){ imageWorldRotation = Rotation(rotationMatrix); } else { imageWorldRotation = Rotation(); Modified: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro 2010-03-06 13:59:14 UTC (rev 250) @@ -15,7 +15,7 @@ # add dependencies of this project here -CONFIG += dll ML MLBase newmat nr EMCUtilities inventor MLOpenGL boost +CONFIG += dll ML MLBase boost # set high warn level (warn 4 on MSCV) WARN = HIGH Modified: trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp 2010-03-06 13:59:14 UTC (rev 250) @@ -99,7 +99,7 @@ //---------------------------------------------------------------------------------- //! Handle field changes of the field field. //---------------------------------------------------------------------------------- -void StringToCurve::handleNotification (Field *field) +void StringToCurve::handleNotification (Field * /*field*/) { ML_TRACE_IN("StringToCurve::handleNotification ()"); Modified: trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h 2010-03-06 13:59:14 UTC (rev 250) @@ -62,7 +62,7 @@ ~StringToCurve(); //! Handle field changes of the field field. - virtual void handleNotification (Field *field); + virtual void handleNotification (Field * /*field*/); //! Ensure the output is up to date on copying the module virtual void activateAttachments(); Modified: trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp 2010-03-06 13:59:14 UTC (rev 250) @@ -196,7 +196,7 @@ { unsigned int numComp = sizeof(first)/sizeof(first[0]); for (unsigned int iComp=0; iComp < numComp; ++iComp){ - if ( abs(first[iComp] - last[iComp]) > precision) { + if ( MLAbs(first[iComp] - last[iComp]) > precision) { return true; } } @@ -205,7 +205,7 @@ bool SyncFields::DiffTest( const double first, const double last, const double precision ) { - return (abs(first - last) > precision); + return (MLAbs(first - last) > precision); } ML_END_NAMESPACE Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-03-06 12:40:32 UTC (rev 249) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.cpp 2010-03-06 13:59:14 UTC (rev 250) @@ -286,7 +286,7 @@ ML_TRACE_IN_TC("void CSOImageStats::_addCSOId(const std::string& idString)"); if (m_OutCSOList != NULL){ - unsigned int currentId = 0; + int currentId = 0; std::stringstream strstream; strstream << idString; strstream >> currentId; @@ -412,7 +412,7 @@ MLErrorCode libErr = MLLoadLibrary("MLResample1"); mlModule* mpr = NULL; mpr = MLCreateModuleFromName("MPR"); - if ( mpr == NULL ) { + if ( mpr == NULL || libErr != ML_RESULT_OK ) { mlDebug("Error creating module"); return; } @@ -433,9 +433,9 @@ if ( resolution < 0 ){ vec3 voxelSize = getNonDummyUpdatedInImg(0)->getVoxelSize(); double minVoxelSize = ML_MIN(ML_MIN(voxelSize[0],voxelSize[1]),voxelSize[2]); - outputSize = ceil(size/minVoxelSize); + outputSize = static_cast<int>( ceil(size/minVoxelSize) ); } else { - outputSize = ceil(size/resolution); + outputSize = static_cast<int>( ceil(size/resolution) ); } IntField* outputSizeField = static_cast<IntField*>( MLModuleGetField( mpr,"outputSize" ) ); outputSizeField->setIntValue( outputSize ); @@ -471,6 +471,10 @@ OutputConnectorField *connectedOutput = inputModule->getOutField( inputNr ); MLint32 connetionResult = MLFieldConnectFrom(mprInput,(mlField*)connectedOutput); + if ( connetionResult != 1 ) { + mlDebug("Error connecting mpr module"); + return; + } MLFieldTouch( mprInput ); MLFieldTouch( connectedOutput ); @@ -481,8 +485,14 @@ mat4 wTvMatrix = mat4(vMatrix); CSOBoundingBox csoBB = cso->getVoxelBoundingBox( wTvMatrix ); const MLint t = cso->getTimePointIndex(); - SubImgBox csoVoxelBox = SubImgBox( Vector(csoBB.v1[0],csoBB.v1[1],csoBB.v1[2],0,t,0), - Vector(csoBB.v2[0],csoBB.v2[1],csoBB.v2[2],0,t,0) ); + const MLint x1 = csoBB.v1[0]; + const MLint y1 = csoBB.v1[1]; + const MLint z1 = csoBB.v1[2]; + const MLint x2 = csoBB.v2[0]; + const MLint y2 = csoBB.v2[1]; + const MLint z2 = 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. double* inputTile = NULL; @@ -520,7 +530,10 @@ const Vector strideVector = csoVoxelBox.getExt().getStrides(); const int currentCSOIndex = cso->getCSOList()->getCSOIndex( cso ); for ( unsigned int iPos = 0; iPos < contourPoints.size(); ++iPos){ - const Vector currentPos( contourPoints[iPos][0], contourPoints[iPos][1], contourPoints[iPos][2],0,0,0 ); + const MLint x0 = contourPoints[iPos][0]; + const MLint y0 = contourPoints[iPos][1]; + const MLint z0 = 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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-03-06 12:40:39
|
Revision: 249 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=249&view=rev Author: coertmetz Date: 2010-03-06 12:40:32 +0000 (Sat, 06 Mar 2010) Log Message: ----------- CM: Attempt to solve release warning. 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 2010-03-06 12:38:41 UTC (rev 248) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp 2010-03-06 12:40:32 UTC (rev 249) @@ -191,7 +191,7 @@ WEMTrianglePatch * inPatch = (WEMTrianglePatch*) _inWEM->getWEMPatchAt(index % numPatches); // Create new output patch - WEMTrianglePatch * outTrianglePatch; + WEMTrianglePatch * outTrianglePatch = NULL; ML_CHECK_NEW(outTrianglePatch, WEMTrianglePatch(*inPatch)); _finish(outTrianglePatch); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 248 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=248&view=rev Author: coertmetz Date: 2010-03-06 12:38:41 +0000 (Sat, 06 Mar 2010) Log Message: ----------- CM: Commented field argument as it is not used. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp 2010-03-05 18:32:15 UTC (rev 247) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp 2010-03-06 12:38:41 UTC (rev 248) @@ -78,7 +78,7 @@ //---------------------------------------------------------------------------------- //! Handle field changes of the field field. //---------------------------------------------------------------------------------- -void LinearInterpolateXMarkerList::handleNotification (Field *field) +void LinearInterpolateXMarkerList::handleNotification (Field * /*field*/ ) { ML_TRACE_IN("LinearInterpolateXMarkerList::handleNotification ()"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2010-03-05 18:32:21
|
Revision: 247 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=247&view=rev Author: wolfspindler Date: 2010-03-05 18:32:15 +0000 (Fri, 05 Mar 2010) Log Message: ----------- Changed: -Fixing some windows/unix incompatibilities, windows.h is already included on Windows by mlOperatorIncludes and is not needed here. 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 2010-03-05 18:29:39 UTC (rev 246) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp 2010-03-05 18:32:15 UTC (rev 247) @@ -40,7 +40,6 @@ // Local includes #include "WEMSelectPatches.h" -#include <windows.h> #include <algorithm> #include <functional> #include <fstream> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2010-03-05 18:29:47
|
Revision: 246 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=246&view=rev Author: wolfspindler Date: 2010-03-05 18:29:39 +0000 (Fri, 05 Mar 2010) Log Message: ----------- Changed: -Fixing some windows/unix/32/64 incompatibilities. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp trunk/Community/General/Sources/ML/MLCSOCommunityModules/MLCSOCommunityModulesDefs.h Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h 2010-03-05 18:25:32 UTC (rev 245) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOImageStatistics/mlCSOImageStatistics.h 2010-03-05 18:29:39 UTC (rev 246) @@ -50,7 +50,7 @@ #include "CSOBase/CSOList.h" #include "CSOTools/CSOMath.h" #include "mlKeyFrameList.h" -#include "mlXmarkerList.h" +#include "mlXMarkerList.h" ML_START_NAMESPACE Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp 2010-03-05 18:25:32 UTC (rev 245) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/CSOPointsToXMarkers/mlCSOPointsToXMarkers.cpp 2010-03-05 18:29:39 UTC (rev 246) @@ -142,7 +142,7 @@ if (_inputCSOList!=NULL) { // Get list index value - int listIndex = max (-1, _listIndexFld->getIntValue()); + int listIndex = mlMax (static_cast<MLint>(-1), _listIndexFld->getIntValue()); // Get output options const bool outputNormals = _outputCSONormals->getBoolValue(); Modified: trunk/Community/General/Sources/ML/MLCSOCommunityModules/MLCSOCommunityModulesDefs.h =================================================================== --- trunk/Community/General/Sources/ML/MLCSOCommunityModules/MLCSOCommunityModulesDefs.h 2010-03-05 18:25:32 UTC (rev 245) +++ trunk/Community/General/Sources/ML/MLCSOCommunityModules/MLCSOCommunityModulesDefs.h 2010-03-05 18:29:39 UTC (rev 246) @@ -1,20 +1,20 @@ -// **InsertLicense** code -//---------------------------------------------------------------------------------- -//! Often used definitions in CSO module library. -/*! -// \file CSOModuleDefs.h -// \author Bart De Dobbelaer -// \date 06/2009 -*/ -//---------------------------------------------------------------------------------- - -#ifndef __CSOModuleDefs_h -#define __CSOModuleDefs_h - -#include "MLCSOCommunityModulesSystem.h" - -#include <CSOBase/CSOList.h> - +// **InsertLicense** code +//---------------------------------------------------------------------------------- +//! Often used definitions in CSO module library. +/*! +// \file CSOModuleDefs.h +// \author Bart De Dobbelaer +// \date 06/2009 +*/ +//---------------------------------------------------------------------------------- + +#ifndef __CSOModuleDefs_h +#define __CSOModuleDefs_h + +#include "MLCSOCommunityModulesSystem.h" + +#include <CSOBase/CSOList.h> + #include <mlLibraryInitMacros.h> #include <math.h> @@ -22,9 +22,9 @@ #include <vector> #include <map> #include <fstream> -#include <sstream> - - -#endif // __CSOModuleDefs_h - - +#include <sstream> + + +#endif // __CSOModuleDefs_h + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2010-03-05 18:25:38
|
Revision: 245 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=245&view=rev Author: wolfspindler Date: 2010-03-05 18:25:32 +0000 (Fri, 05 Mar 2010) Log Message: ----------- Changed: -Fixing windows/unix/32/64 incompatibilities. 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-03-05 18:17:50 UTC (rev 244) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2010-03-05 18:25:32 UTC (rev 245) @@ -178,7 +178,7 @@ if ( m_InCurveList != NULL ){ nCurveSets = m_InCurveList->getNumCurves(); for (int iSet = 0; iSet < nCurveSets; ++iSet ) { - nCurves = max( nCurves, m_InCurveList->getCurveData( iSet )->getNumSeries() ); + nCurves = mlMax( static_cast<MLssize_t>(nCurves), m_InCurveList->getCurveData( iSet )->getNumSeries() ); } } f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); @@ -194,16 +194,16 @@ // Curves are numbered from 0 int nCurveSets = m_InCurveList->getNumCurves(); if ( nCurveSets == 0 ) {return;} - int minSet = max( 0, f_MinCurveSet->getIntValue() ); - int maxSet = max( minSet, f_MaxCurveSet->getIntValue() ); - maxSet = min( maxSet, nCurveSets-1 ); + 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 = max(0,f_MinCurve->getIntValue() ); - int maxCurve = max(minCurve, f_MaxCurve->getIntValue() ); - maxCurve = min(maxCurve, nCurves-1 ); + 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 ); @@ -216,7 +216,7 @@ bool crop = f_CropCurve->getBoolValue(); float minX = f_XStart->getFloatValue(); float maxX = f_XEnd->getFloatValue(); - minX = min(minX,maxX); + minX = mlMin(minX,maxX); for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ float xValue = curveSet->getXValue( iX ); if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2010-03-05 18:17:59
|
Revision: 244 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=244&view=rev Author: wolfspindler Date: 2010-03-05 18:17:50 +0000 (Fri, 05 Mar 2010) Log Message: ----------- Changed: -Fixing windows/unix incompatibility. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp Modified: trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-03-05 16:26:11 UTC (rev 243) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-03-05 18:17:50 UTC (rev 244) @@ -302,12 +302,12 @@ if ( !box0.isEmpty() && !box1.isEmpty() ){ for (int index = 0; index < 6; ++index ){ - newBox.v1[index] = min( box0.v1[index], - box1.v1[index]); + newBox.v1[index] = mlMin( box0.v1[index], + box1.v1[index]); } for (int index = 0; index < 6; ++index ){ - newBox.v2[index] = max( box0.v2[index], - box1.v2[index]); + newBox.v2[index] = mlMax( box0.v2[index], + box1.v2[index]); } } else { if ( box0.isEmpty() ){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-03-05 16:26:19
|
Revision: 243 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=243&view=rev Author: coertmetz Date: 2010-03-05 16:26:11 +0000 (Fri, 05 Mar 2010) Log Message: ----------- CM: Added 4 WEM modules: -WEMNodesToFile: write WEM node coordinates to a text file. -WEMCenterOfMass: compute center of mass of WEM node coordinates. -WEMVolume: compute volumes of WEM patches. -WEMSelectPatches: select a subset of WEM patches. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModules.pro trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModulesInit.cpp Added Paths: ----------- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.cpp trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.h trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.h trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.cpp trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.h Modified: trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModules.pro =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModules.pro 2010-03-05 16:24:00 UTC (rev 242) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModules.pro 2010-03-05 16:26:11 UTC (rev 243) @@ -35,11 +35,19 @@ MLWEMCommunityModulesInit.h \ MLWEMCommunityModulesSystem.h \ WEMPlane/WEMMarchingCubes.h \ - WEMPlane/WEMPlane.h + WEMPlane/WEMPlane.h \ + WEMVolume/WEMVolume.h \ + WEMCenterOfMass/WEMCenterOfMass.h \ + WEMNodesToFile/WEMNodesToFile.h \ + WEMSelectPatches/WEMSelectPatches.h SOURCES += \ MLWEMCommunityModulesInit.cpp \ - WEMPlane/WEMPlane.cpp + WEMPlane/WEMPlane.cpp \ + WEMVolume/WEMVolume.cpp \ + WEMCenterOfMass/WEMCenterOfMass.cpp \ + WEMNodesToFile/WEMNodesToFile.cpp \ + WEMSelectPatches/WEMSelectPatches.cpp RELATEDFILES += \ ../../../Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def Modified: trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModulesInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModulesInit.cpp 2010-03-05 16:24:00 UTC (rev 242) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/MLWEMCommunityModulesInit.cpp 2010-03-05 16:26:11 UTC (rev 243) @@ -13,6 +13,10 @@ #include <mlLibraryInitMacros.h> #include "WEMPlane/WEMPlane.h" +#include "WEMCenterOfMass/WEMCenterOfMass.h" +#include "WEMVolume/WEMVolume.h" +#include "WEMSelectPatches/WEMSelectPatches.h" +#include "WEMNodesToFile/WEMNodesToFile.h" ML_START_NAMESPACE @@ -23,6 +27,10 @@ ML_TRACE_IN("MLWEMCommunityModulesInit()"); WEMPlane::initClass(); + WEMVolume::initClass(); + WEMSelectPatches::initClass(); + WEMNodesToFile::initClass(); + WEMCenterOfMass::initClass(); return 1; } Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,165 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMCenterOfMass. +/*! +// \file WEMCenterOfMass.cpp +// \author Coert Metz +// \date 2008-11-27 +// +// Computes the center of mass of a WEM object +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "WEMCenterOfMass.h" + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(WEMCenterOfMass, WEMInspector); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +WEMCenterOfMass::WEMCenterOfMass (std::string type) + : WEMInspector(type) +{ + ML_TRACE_IN("WEMCenterOfMass::WEMCenterOfMass()") + + FieldContainer *fieldC = getFieldContainer(); + ML_CHECK(fieldC); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Add output fields + _centerOfMass = fieldC->addVec3f("centerOfMass"); + _centerOfMass->setVec3fValue(vec3(0.0,0.0,0.0)); + _inverseCenterOfMass = fieldC->addVec3f("inverseCenterOfMass"); + _inverseCenterOfMass->setVec3fValue(vec3(0.0,0.0,0.0)); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Destructor +//---------------------------------------------------------------------------------- +WEMCenterOfMass::~WEMCenterOfMass() +{ + ML_TRACE_IN("WEMCenterOfMass::~WEMCenterOfMass()") + + // destroy own dynamic data structures here +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void WEMCenterOfMass::handleNotification (Field *field) +{ + ML_TRACE_IN("WEMCenterOfMass::handleNotification()") + + // call parent class and handle apply/autoApply and in/outputs + WEMInspector::handleNotification(field); +} + +//---------------------------------------------------------------------------------- +//! Code below is performed after module and network initialization. +//---------------------------------------------------------------------------------- +void WEMCenterOfMass::activateAttachments() +{ + ML_TRACE_IN("WEMCenterOfMass::activateAttachments()") + + // call parent class + WEMInspector::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! The process method is called by the parent class. +//---------------------------------------------------------------------------------- +void WEMCenterOfMass::_process() +{ + ML_TRACE_IN("WEMCenterOfMass::process()") + + // for time measurement and mouse cursor setting. + _startProcessing(); + + WEMInspector::_process(); + + // Compute centroid of WEM + ComputeCentroid(); + + // stop time measurement and mouse cursor resetting. + _finishProcessing(); + + // notify registered observer modules. + //_notifyObservers(); +} + +//---------------------------------------------------------------------------------- +//! The main processing routine. Implement your algorithm here. +//---------------------------------------------------------------------------------- +void WEMCenterOfMass::ComputeCentroid() +{ + ML_TRACE_IN("WEMCenterOfMass::ComputeCentroid()") + + if (_inWEM != NULL){ + double sumX=0.0, sumY=0.0, sumZ=0.0; + int num=0; + // Iterate over all nodes and compute sum of x, y and z-position + for (unsigned int i = 0; i < _inWEM->getNumWEMPatches(); i++){ + WEMPatch* wemPatch = _inWEM->getWEMPatchAt(i); + const unsigned int numNodesInPatch = wemPatch->getNumNodes(); + for (unsigned int j = 0; j < numNodesInPatch; j++){ + WEMNode* node = wemPatch->getNodeAt(j); + float x, y, z; + node->getPosition(x, y, z); + sumX+=x; + sumY+=y; + sumZ+=z; + ++num; + } + } + // Set output fields + _centerOfMass->setVec3fValue(vec3(sumX/double(num), sumY/double(num), sumZ/double(num))); + _inverseCenterOfMass->setVec3fValue(-vec3(sumX/double(num), sumY/double(num), sumZ/double(num))); + } else { + // Reset output fields + _centerOfMass->setVec3fValue(vec3()); + _inverseCenterOfMass->setVec3fValue(vec3()); + } +} + + +ML_END_NAMESPACE + Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,101 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMCenterOfMass. +/*! +// \file WEMCenterOfMass.h +// \author Coert Metz +// \date 2008-11-27 +// +// Computes the center of mass of a WEM object +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __WEMCenterOfMass_H +#define __WEMCenterOfMass_H + +// Local includes +#include "MLWEMCommunityModulesSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +// WEM inspector include +#include <WEMBase/WEMModuleBase/WEMInspector.h> + +ML_START_NAMESPACE + + +//! Computes the center of mass of a WEM object +class MLWEMCOMMUNITYMODULES_EXPORT WEMCenterOfMass : public WEMInspector +{ + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(WEMCenterOfMass) + +public: + + //! Constructor. + WEMCenterOfMass (std::string type="WEMCenterOfMass"); + +protected: + + //! Destructor. + virtual ~WEMCenterOfMass(); + + //! Initialize module after loading. + virtual void activateAttachments(); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + //! _process()-routine for correct processing. + virtual void _process(); + +private: + + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + //! Center of mass (and its inverse) output field + Vec3fField *_centerOfMass, *_inverseCenterOfMass; + + //@} + + //! The main processing routine. Here, the own mesh algorithm can be implemented. + void ComputeCentroid(); + +}; + + +ML_END_NAMESPACE + +#endif // __mlWEMCenterOfMass_H + + Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.cpp 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,176 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMNodesToFile. +/*! +// \file WEMNodesToFile.cpp +// \author Coert Metz +// \date 2009-02-09 +// +// Output WEM node coordinates to a textfile +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "WEMNodesToFile.h" + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(WEMNodesToFile, WEMInspector); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +WEMNodesToFile::WEMNodesToFile (std::string type) + : WEMInspector(type) +{ + ML_TRACE_IN("WEMNodesToFile::WEMNodesToFile()") + + FieldContainer *fields = getFieldContainer(); + ML_CHECK(fields); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Add filename field + _filenameFld = fields->addString("filename"); + _filenameFld->setStringValue(""); + + // Add transformix option field + _transformixCompatibleFld = fields->addBool("transformixCompatible"); + _transformixCompatibleFld->setBoolValue(false); + + // Add save button + _saveFld = fields->addNotify("save"); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Destructor +//---------------------------------------------------------------------------------- +WEMNodesToFile::~WEMNodesToFile() +{ + ML_TRACE_IN("WEMNodesToFile::~WEMNodesToFile()") +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void WEMNodesToFile::handleNotification (Field *field) +{ + ML_TRACE_IN("WEMNodesToFile::handleNotification()") + + WEMInspector::handleNotification(field); + if (field == _saveFld) { + OutputNodes(); + } +} + +//---------------------------------------------------------------------------------- +//! Code below is performed after module and network initialization. +//---------------------------------------------------------------------------------- +void WEMNodesToFile::activateAttachments() +{ + ML_TRACE_IN("WEMNodesToFile::activateAttachments()") + + // call parent class + WEMInspector::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! The process method is called by the parent class. +//---------------------------------------------------------------------------------- +void WEMNodesToFile::_process() +{ + ML_TRACE_IN("WEMNodesToFile::process()") + + // for time measurement and mouse cursor setting. + _startProcessing(); + + WEMInspector::_process(); + + // stop time measurement and mouse cursor resetting. + _finishProcessing(); +} + +//---------------------------------------------------------------------------------- +//! The main processing routine. Implement your algorithm here. +//---------------------------------------------------------------------------------- +void WEMNodesToFile::OutputNodes() +{ + ML_TRACE_IN("WEMNodesToFile::OutputNodes()") + + // Get and check filename + std::string filename = _filenameFld->getStringValue(); + if (filename=="") { + std::cout << "You should provide a filename for the output!" << std::endl; + return; + } + + // Open file + std::fstream file_op(filename.c_str(), std::ios::out); + if (!file_op.is_open()) { + std::cout << "Cannot write output file!" << std::endl; + return; + } + + if (_inWEM != NULL){ + // Output transformix specific line + if (_transformixCompatibleFld->getBoolValue()) file_op << "point" << std::endl; + + std::stringstream points; + int num=0; + // Add all node coordinates to point stringstream + for (unsigned int i = 0; i < _inWEM->getNumWEMPatches(); i++){ + WEMPatch* wemPatch = _inWEM->getWEMPatchAt(i); + const unsigned int numNodesInPatch = wemPatch->getNumNodes(); + for (unsigned int j = 0; j < numNodesInPatch; j++){ + WEMNode* node = wemPatch->getNodeAt(j); + float x, y, z; + node->getPosition(x, y, z); + points << x << " " << y << " " << z << std::endl; + ++num; + } + } + // Output transformix specific line (number of points) + if (_transformixCompatibleFld->getBoolValue()) file_op << num << std::endl; + // Output coordinates + file_op << points.str(); + } + file_op.close(); +} + + +ML_END_NAMESPACE Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.h =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.h (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.h 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,103 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMNodesToFile. +/*! +// \file WEMNodesToFile.h +// \author Coert Metz +// \date 2009-02-09 +// +// Output WEM node coordinates to a textfile +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __WEMNodesToFile_H +#define __WEMNodesToFile_H + +// Local includes +#include "MLWEMCommunityModulesSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +// WEM inspector include +#include <WEMBase/WEMModuleBase/WEMInspector.h> + +ML_START_NAMESPACE + +//! Computes the center of mass of a WEM object +class MLWEMCOMMUNITYMODULES_EXPORT WEMNodesToFile : public WEMInspector +{ + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(WEMNodesToFile) + +public: + + //! Constructor. + WEMNodesToFile (std::string type="WEMNodesToFile"); + +protected: + + //! Destructor. + virtual ~WEMNodesToFile(); + + //! Initialize module after loading. + virtual void activateAttachments(); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + //! _process()-routine for correct processing. + virtual void _process(); + +private: + + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + //! Filename field + StringField *_filenameFld; + + //! Save button + NotifyField *_saveFld; + + //! Option to output transformix compatible coordinate file + BoolField *_transformixCompatibleFld; + + //@} + + //! The main processing routine + void OutputNodes(); + +}; + +ML_END_NAMESPACE + +#endif // __mlWEMNodesToFile_H Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,204 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMSelectPatches. +/*! +// \file WEMSelectPatches.cpp +// \author Coert Metz +// \date 2009-02-10 +// +// Select a range of patches from a WEM +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "WEMSelectPatches.h" + +#include <windows.h> +#include <algorithm> +#include <functional> +#include <fstream> + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(WEMSelectPatches, WEMProcessor); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +WEMSelectPatches::WEMSelectPatches (std::string type) + : WEMProcessor(type, false) +{ + ML_TRACE_IN("WEMSelectPatches::WEMSelectPatches()") + + FieldContainer *fields = getFieldContainer(); + ML_CHECK(fields); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // WEM Patch start and end index field + _patchStartIndexFld = fields->addInt("patchStartIndex"); + _patchStartIndexFld->setIntValue(0); + _patchEndIndexFld = fields->addInt("patchEndIndex"); + _patchEndIndexFld->setIntValue(0); + + // Bool field to enable to select only one patch based on start index value + _onePatchFld = fields->addBool("onePatch"); + _onePatchFld->setBoolValue(false); + + // Set auto apply fields + _autoClearFld->setBoolValue(true); + _autoApplyFld->setBoolValue(true); + _autoUpdateFld->setBoolValue(true); + + _notifyFld = fields->addNotify("notify"); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Destructor +//---------------------------------------------------------------------------------- +WEMSelectPatches::~WEMSelectPatches() +{ + ML_TRACE_IN("WEMSelectPatches::~WEMSelectPatches()") +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void WEMSelectPatches::handleNotification (Field *field) +{ + ML_TRACE_IN("WEMSelectPatches::handleNotification()") + + if (field==_patchStartIndexFld || field==_patchEndIndexFld || field==_onePatchFld) { + if (_autoApplyFld->getBoolValue()) { + _process(); + } + } + + // call parent class and handle apply/autoApply and in/outputs + WEMProcessor::handleNotification(field); +} + +//---------------------------------------------------------------------------------- +//! Code below is performed after module and network initialization. +//---------------------------------------------------------------------------------- +void WEMSelectPatches::activateAttachments() +{ + ML_TRACE_IN("WEMSelectPatches::activateAttachments()") + + // call parent class + WEMProcessor::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! The process method is called by the parent class. +//---------------------------------------------------------------------------------- +void WEMSelectPatches::_process() +{ + ML_TRACE_IN("WEMSelectPatches::process()") + + // for time measurement and mouse cursor setting. + _startProcessing(); + + WEMProcessor::_process(); + + // Now call the own processing routine. + if (_inWEM!=NULL) { + selectPatch(); + } + + // stop time measurement and mouse cursor resetting. + _finishProcessing(); + + // notify registered observer modules. + _notifyObservers(); + + _notifyFld->notifyAttachments(); +} + +//---------------------------------------------------------------------------------- +//! The main processing routine. Implement your algorithm here. +//---------------------------------------------------------------------------------- +void WEMSelectPatches::selectPatch() +{ + ML_TRACE_IN("WEMSelectPatches::selectPatch()") + + // Get number of input WEM patches + const int numPatches = _inWEM->getNumWEMPatches(); + + // Get settings + int patchStartIndex = _patchStartIndexFld->getIntValue(); + int patchEndIndex = _patchEndIndexFld->getIntValue(); + if (_onePatchFld->getBoolValue()) { + // Select only one patch, so set end index to start index + patchEndIndex=patchStartIndex; + } + + if (numPatches>0) { + // Check index numbers + if (patchStartIndex>patchEndIndex) { + patchEndIndex=patchStartIndex; + _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; + } + + // 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; + ML_CHECK_NEW(outTrianglePatch, WEMTrianglePatch(*inPatch)); + + _finish(outTrianglePatch); + _addWEMPatch(outTrianglePatch); + } + } +} + +ML_END_NAMESPACE Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.h =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.h (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.h 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,106 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMSelectPatches. +/*! +// \file WEMSelectPatches.h +// \author Coert Metz +// \date 2009-02-10 +// +// Select a range of patches from a WEM +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __WEMSelectPatches_H +#define __WEMSelectPatches_H + + +// Local includes +#include "MLWEMCommunityModulesSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +// WEM inspector include +#include <WEMBase/WEMModuleBase/WEMProcessor.h> + +ML_START_NAMESPACE + +//! Select a subset of patches from a WEM +class MLWEMCOMMUNITYMODULES_EXPORT WEMSelectPatches : public WEMProcessor +{ + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(WEMSelectPatches) + +public: + + //! Constructor. + WEMSelectPatches (std::string type="WEMSelectPatches"); + +protected: + + //! Destructor. + virtual ~WEMSelectPatches(); + + //! Initialize module after loading. + virtual void activateAttachments(); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + //! _process()-routine for correct processing. + virtual void _process(); + +private: + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + //! Start and end index of output patches + IntField *_patchStartIndexFld; + IntField *_patchEndIndexFld; + + //! Field to select only one patch based on the start index number + BoolField *_onePatchFld; + + //! Notify field + NotifyField *_notifyFld; + + //@} + + //! The main processing routine which selects the patches. + void selectPatch(); +}; + + +ML_END_NAMESPACE + +#endif // __mlWEMSelectPatches_H + + Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.cpp 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,190 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMVolume. +/*! +// \file WEMVolume.cpp +// \author Coert Metz +// \date 2008-11-27 +// +// Computes the center of mass of a WEM object +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "WEMVolume.h" + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(WEMVolume, WEMInspector); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +WEMVolume::WEMVolume (std::string type) + : WEMInspector(type) +{ + ML_TRACE_IN("WEMVolume::WEMVolume()") + + FieldContainer *fields = getFieldContainer(); + ML_CHECK(fields); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Add min, max volume, and corresponding index fields + _minVolumeFld = fields->addFloat("minVolume"); + _minVolumeFld->setFloatValue(0.0f); + _maxVolumeFld = fields->addFloat("maxVolume"); + _maxVolumeFld->setFloatValue(0.0f); + _minVolumeIndexFld = fields->addInt("minVolumePatchIndex"); + _minVolumeIndexFld->setIntValue(0); + _maxVolumeIndexFld = fields->addInt("maxVolumePatchIndex"); + _maxVolumeIndexFld->setIntValue(0); + + // Add output curve field + _outputVolumeCurveFld = fields->addBase("outputVolumeCurve"); + _outputVolumeCurveFld->setBaseValue(&_outputVolumeCurve); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Destructor +//---------------------------------------------------------------------------------- +WEMVolume::~WEMVolume() +{ + ML_TRACE_IN("WEMVolume::~WEMVolume()") +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void WEMVolume::handleNotification (Field *field) +{ + ML_TRACE_IN("WEMVolume::handleNotification()") + + // call parent class and handle apply/autoApply and in/outputs + WEMInspector::handleNotification(field); +} + +//---------------------------------------------------------------------------------- +//! Code below is performed after module and network initialization. +//---------------------------------------------------------------------------------- +void WEMVolume::activateAttachments() +{ + ML_TRACE_IN("WEMVolume::activateAttachments()") + + // call parent class + WEMInspector::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! The process method is called by the parent class. +//---------------------------------------------------------------------------------- +void WEMVolume::_process() +{ + ML_TRACE_IN("WEMVolume::process()") + + // for time measurement and mouse cursor setting. + _startProcessing(); + + WEMInspector::_process(); + + // Now call the own processing routine. + ComputeVolumes(); + + // stop time measurement and mouse cursor resetting. + _finishProcessing(); +} + +//---------------------------------------------------------------------------------- +//! The main processing routine. Implement your algorithm here. +//---------------------------------------------------------------------------------- +void WEMVolume::ComputeVolumes() +{ + ML_TRACE_IN("WEMVolume::ComputeVolumes()") + + // Clear output curve + _outputVolumeCurve.clear(); + + // Vectors to store the x and y values of the curve + std::vector<float> indices; + std::vector<float> volumes; + + if (_inWEM != NULL){ + float minVol = ML_FLOAT_MAX; + int minVolIndex = 0; + float maxVol = 0.0f; + int maxVolIndex = 0; + + // Iterate over all patches and compute volume of patch + for (unsigned int i = 0; i < _inWEM->getNumWEMPatches(); i++){ + WEMPatch* wemPatch = _inWEM->getWEMPatchAt(i); + const float volume = wemPatch->getVolume(); + // Check for min and max volume + if (volume<minVol) { + minVol=volume; + minVolIndex=i; + } + if (volume>maxVol) { + maxVol=volume; + maxVolIndex=i; + } + // Add values to curve + volumes.push_back(volume); + indices.push_back(static_cast<float>(i)); + } + _minVolumeFld->setFloatValue(minVol); + _minVolumeIndexFld->setIntValue(minVolIndex); + _maxVolumeFld->setFloatValue(maxVol); + _maxVolumeIndexFld->setIntValue(maxVolIndex); + } else { + // Default values + _minVolumeFld->setFloatValue(0.0f); + _minVolumeIndexFld->setIntValue(0); + _maxVolumeFld->setFloatValue(0.0f); + _maxVolumeIndexFld->setIntValue(0); + } + + // Output curve + _outputVolumeCurveData.setTitle("Volumes"); + _outputVolumeCurveData.setXRange(0, volumes.size()-1); + _outputVolumeCurveData.setX(volumes.size(), &indices[0]); + _outputVolumeCurveData.setY(0, volumes.size(), &volumes[0]); + _outputVolumeCurve.getCurveList().push_back(&_outputVolumeCurveData); + _outputVolumeCurveFld->notifyAttachments(); +} + +ML_END_NAMESPACE Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.h =================================================================== --- trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.h (rev 0) +++ trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.h 2010-03-05 16:26:11 UTC (rev 243) @@ -0,0 +1,111 @@ +//---------------------------------------------------------------------------------- +//! The ML module class WEMVolume. +/*! +// \file WEMVolume.h +// \author Coert Metz +// \date 2009-12-08 +// +// Computes the volume of the WEM patches in a WEM. +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __WEMVolume_H +#define __WEMVolume_H + + +// Local includes +#include "MLWEMCommunityModulesSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +// CurveData include +#include "mlDiagramData.h" + +// WEM inspector include +#include <WEMBase/WEMModuleBase/WEMInspector.h> + +ML_START_NAMESPACE + + +//! Computes the center of mass of a WEM object +class MLWEMCOMMUNITYMODULES_EXPORT WEMVolume : public WEMInspector +{ + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(WEMVolume) + +public: + + //! Constructor. + WEMVolume (std::string type="WEMVolume"); + +protected: + + //! Destructor. + virtual ~WEMVolume(); + + //! Initialize module after loading. + virtual void activateAttachments(); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + //! _process()-routine for correct processing. + virtual void _process(); + +private: + + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + //! Min, max volume field and patch index field + FloatField* _minVolumeFld, * _maxVolumeFld; + IntField* _minVolumeIndexFld, * _maxVolumeIndexFld; + + //! Output curvelist with volume values + BaseField * _outputVolumeCurveFld; + CurveList _outputVolumeCurve; + CurveData _outputVolumeCurveData; + + //@} + + //! The main processing routine. Here, the own mesh algorithm can be implemented. + void ComputeVolumes(); + +}; + + +ML_END_NAMESPACE + +#endif // __mlWEMVolume_H + + Property changes on: trunk/Community/General/Sources/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-03-05 16:24:12
|
Revision: 242 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=242&view=rev Author: coertmetz Date: 2010-03-05 16:24:00 +0000 (Fri, 05 Mar 2010) Log Message: ----------- CM: Added 4 WEM modules: -WEMNodesToFile: write WEM node coordinates to a text file. -WEMCenterOfMass: compute center of mass of WEM node coordinates. -WEMVolume: compute volumes of WEM patches. -WEMSelectPatches: select a subset of WEM patches. Modified Paths: -------------- trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def Added Paths: ----------- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.html trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMassExample.mlab trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMNodesToFile/ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.html trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.html trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatchesExample.mlab trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.html trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolumeExample.mlab Modified: trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def 2010-03-05 16:13:04 UTC (rev 241) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/MLWEMCommunityModules.def 2010-03-05 16:24:00 UTC (rev 242) @@ -47,3 +47,197 @@ Execute = updateTabs } } // MLModule WEMPlane + +//---------------------------------------------------------------------------------- +// MLModule WEMVolume +//---------------------------------------------------------------------------------- +MLModule WEMVolume { + DLL = "MLWEMCommunityModules" + + genre = "BIGR-WEM" + group = "BIGR" + author = "Coert Metz" + status = "work-in-progress" + comment = "Computes the volumes of the WEM patches" + keywords = "WEM,volume" + documentation = "$(LOCAL)/WEMVolume/WEMVolume.html" + seeAlso = "" + exampleNetwork = "$(LOCAL)/WEMVolume/WEMVolumeExample.mlab" + + Commands { FieldListener isProcessing { command = "*js: if (ctx.field("isProcessing").boolValue()){ MLAB.setWaitCursor(); } else { MLAB.removeWaitCursor(); } *" } + + // put more commands in here if required + + } + + Description { + + // put the fields' description in here if required + + } + + Window { + minimumWidth = 250 + + Category "Main" { + + Field minVolume { + expandX = True + edit = False + } + Field minVolumePatchIndex { + expandX = True + edit = False + } + Field maxVolume { + expandX = True + edit = False + } + Field maxVolumePatchIndex { + expandX = True + edit = False + } + + //Separator { direction = horizontal } + + //Horizontal { + //CheckBox autoApply { title = "Auto Apply" } + //Field apply { title = "Apply" } + //} + } + } +} // MLModule WEMVolume + +//---------------------------------------------------------------------------------- +// MLModule WEMCenterOfMass +//---------------------------------------------------------------------------------- +MLModule WEMCenterOfMass { + DLL = "MLWEMCommunityModules" + + genre = "BIGR-WEM" + group = "BIGR" + author = "Coert Metz" + status = "stable" + comment = "Computes the center of mass of the nodes of WEM object" + keywords = "WEM,Center of Mass,Centroid" + seeAlso = "" + documentation = "$(LOCAL)/WEMCenterOfMass/WEMCenterOfMass.html" + exampleNetwork = "$(LOCAL)/WEMCenterOfMass/WEMCenterOfMassExample.mlab" + + Commands { FieldListener isProcessing { command = "*js: if (ctx.field("isProcessing").boolValue()){ MLAB.setWaitCursor(); } else { MLAB.removeWaitCursor(); } *" } + + // put more commands in here if required + + } + + Description { + + // put the fields' description in here if required + + } + + Window { + + Category "Main" { + + Field centerOfMass { + expandX = True + } + + Field inverseCenterOfMass { + expandX = True + } + + //Separator { direction = horizontal } + + //Horizontal { + //CheckBox autoApply { title = "Auto Apply" } + //Field apply { title = "Apply" } + //} + } + } +} // MLModule WEMCenterOfMass + +//---------------------------------------------------------------------------------- +// MLModule WEMSelectPatches +//---------------------------------------------------------------------------------- +MLModule WEMSelectPatches { + DLL = "MLWEMCommunityModules" + + genre = "BIGR-WEM" + group = "BIGR" + author = "Coert Metz" + status = "stable" + comment = "Computes the center of mass of a WEM object" + keywords = "WEM,Center of Mass,Centroid" + seeAlso = "" + documentation = "$(LOCAL)/WEMSelectPatches/WEMSelectPatches.html" + exampleNetwork = "$(LOCAL)/WEMSelectPatches/WEMSelectPatchesExample.mlab" + deprecatedName = "WEMSelectPatch" + + Commands { FieldListener isProcessing { command = "*js: if (ctx.field("isProcessing").boolValue()){ MLAB.setWaitCursor(); } else { MLAB.removeWaitCursor(); } *" } + + // put more commands in here if required + + } + + Description { + + // put the fields' description in here if required + + } + + Window { + + Category "Main" { + Field patchStartIndex {} + Field patchEndIndex {} + CheckBox onePatch {} + } + } +} // MLModule WEMSelectPatches + +//---------------------------------------------------------------------------------- +// MLModule WEMNodesToFile +//---------------------------------------------------------------------------------- +MLModule WEMNodesToFile { + documentation = "$(LOCAL)/WEMNodesToFile/WEMNodesToFile.html" + DLL = "MLWEMCommunityModules" + + genre = "BIGR-WEM" + group = "BIGR" + author = "Coert Metz" + status = "stable" + comment = "Output WEM node coordinates to a text filed" + keywords = "WEM,nodes,output,save,file" + seeAlso = "" + + Commands { FieldListener isProcessing { command = "*js: if (ctx.field("isProcessing").boolValue()){ MLAB.setWaitCursor(); } else { MLAB.removeWaitCursor(); } *" } + + // put more commands in here if required + + } + + Description { + + // put the fields' description in here if required + + } + + Window { + minimumWidth = 400 + + Vertical { + margin = 3 + Field filename { + expandX = True + browseButton = True + browseMode = save + } + Field transformixCompatible {} + Separator {} + Button save {} + } + } +} // MLModule WEMCenterOfMass + Added: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.html =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.html (rev 0) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.html 2010-03-05 16:24:00 UTC (rev 242) @@ -0,0 +1,65 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#InputFields">Input</a> <a href="#Parameters">Parameters</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>WEMCenterOfMass</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>Computes the centroid of the nodes of the input WEM object. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect a WEM to the input field. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Both the center of mass and its negated version are outputted. The last one might turn usefull if one wants to translate an object/image according to the centroid position. +</blockquote> + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>inWEM</b> + Input WEM surface + </li> + </ul> + +</blockquote> + + + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>centerOfMass</b> + Center of mass of WEM nodes + </li> + <li> + <b>inverseCenterOfMass</b> + Negated center of mass of WEM nodes + </li> + </ul> + +</blockquote> + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>See example network. +</blockquote> + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMass.html ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMassExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMassExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMassExample.mlab 2010-03-05 16:24:00 UTC (rev 242) @@ -0,0 +1,117 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module WEMInitialize { + internal { + frame = "653 429 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "482 339 322 391" + sizeHint = "322 391" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInitialize + isProcessing = FALSE + elapsedTime = 0 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + initialPosition = "5 3 2" + initialDeformation = "1 1 1" + initModel = Dodecahedron + mirrorFaces = FALSE + generateEdges = TRUE + selectedTab = 0 + } +} +module WEMCenterOfMass { + internal { + frame = "633 333 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "506 237 341 66" + sizeHint = "341 66" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = WEMCenterOfMass + isProcessing = FALSE + elapsedTime = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + listenToFinishingNotifications = TRUE + listenToRepaintNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + centerOfMass = "5 3 2" + inverseCenterOfMass = "-5 -3 -2" + } +} +connections { + WEMCenterOfMass.inWEM = WEMInitialize.outWEM +} +networkModel { + parentItems { + 0 { + MLABNetworkModelItem MLABNoteItem { + uniqueId = 7 + objectName = "" + parentUniqueId = 0 + frame = "398 316 200 200" + backgroundColor { + r = 252 + g = 242 + b = 2 + a = 255 + } + text = "The center of mass of the input WEM is computed. Change the translation field in the WEMInitialize module to see changes in the centroid position." + titleText = Comment + isCollapsed = False + } + } + } +} Property changes on: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMCenterOfMass/WEMCenterOfMassExample.mlab ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + LF Added: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.html =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.html (rev 0) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.html 2010-03-05 16:24:00 UTC (rev 242) @@ -0,0 +1,65 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#InputFields">Input</a> <a href="#Parameters">Parameters</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>WEMNodesToFile</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>Outputs the node coordinates of the input WEM to a textfile +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect WEM and press save. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Every line in the file represents a point. Coordinates are separated by spaces. When transformix option is enabled two extra lines are added at the start of the file. One with the text 'point' and one with the number of points. +</blockquote> + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>inWEM</b> + Input WEM. + </li> + </ul> + +</blockquote> + + + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>filename</b> + Output filename. + </li> + <li> + <b>transformixCompatible</b> + Turn this option on if you want to output transformix compatible point files. + </li> + </ul> + +</blockquote> + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>Not available. +</blockquote> + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMNodesToFile/WEMNodesToFile.html ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.html =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.html (rev 0) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.html 2010-03-05 16:24:00 UTC (rev 242) @@ -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="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>WEMSelectPatches</h2> + + + + + + + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>inWEM</b> + Input WEM. + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outWEM</b> + Output WEM with only the selected patches. + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>patchStartIndex</b> + Index of start patch to select. + </li> + <li> + <b>patchEndIndex</b> + Index of end patch to select. + </li> + <li> + <b>onePatch</b> + When enabled, only one path (at the start index) is selected. + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatches.html ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatchesExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatchesExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatchesExample.mlab 2010-03-05 16:24:00 UTC (rev 242) @@ -0,0 +1,468 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoDepthPeelRenderer { + internal { + frame = "661 -35 152 56" + moduleGroupName = "" + } + fields { + instanceName = SoDepthPeelRenderer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + useFBO = TRUE + useDepthPeeling = TRUE + useStencilBuffer = FALSE + layers = 4 + simulatedAlpha = 1 + opaqueBackgroundPass = TRUE + sceneDepthCompare = FALSE + debugLayers = FALSE + changeLayerColor = FALSE + layer1Color = "1 1 1" + layer2Color = "1 1 1" + layer3Color = "1 1 1" + layer4Color = "1 1 1" + layer5Color = "1 1 1" + layer6Color = "1 1 1" + layer7Color = "1 1 1" + layer8Color = "1 1 1" + } +} +module SoExaminerViewer { + internal { + frame = "669 -131 136 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "802 187 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + stereoViewing = FALSE + stereoOffset = 3 + height = 0.7853981853 + position = "1.448529362678528 -0.2509514689445496 1.818761587142944" + orientation = "0.3550490140914917 0.1323456764221191 0.9254322648048401 2.151066064834595" + nearDistance = 1.120393872 + farDistance = 3.559265137 + focalDistance = 2.338612318 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module SoWEMRenderer { + internal { + frame = "673 45 128 56" + moduleGroupName = "" + windows { + window _default { + geometry = "257 295 318 416" + sizeHint = "318 416" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoWEMRenderer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + useHighlightSelected = FALSE + usePolygonOffset = TRUE + useShapeHints = TRUE + allowHits = TRUE + parameterOverwriteMode = OVERWRITE_MODE_ALL + overwriteColorMode = FALSE + overwriteFaceParameters = FALSE + overwriteEdgeParameters = FALSE + overwriteNodeParameters = FALSE + overwriteBoundingBoxParameters = FALSE + colorMode = WEM_COLOR_GENERAL + drawFaces = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + drawEdges = FALSE + edgeColor = "0 0 0" + drawNodes = FALSE + nodeColor = "1 1 1" + drawBoundingBoxes = FALSE + boundingBoxColor = "1 1 1" + drawFaceNormals = FALSE + drawNodeNormals = FALSE + faceNormalColor = "1 1 1" + nodeNormalColor = "1 1 1" + faceNormalScaling = 1 + nodeNormalScaling = 1 + faceAlphaValue = 1 + faceShininessValue = 1 + lineWidth = 1 + pointSize = 1 + useEdgeColoringMode = FALSE + nodeRenderingMode = WEM_NODE_RENDERING_NORMAL + boundingBoxMode = WEM_BOUNDING_BOX_AXIS_ALIGNED + primitiveValueLists = LUT + selectedPrimitiveValueList = LUT + primitiveValueListValid = FALSE + selectedTab = 0 + } +} +module WEMSelectPatches { + internal { + frame = "665 133 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "612 683 179 95" + sizeHint = "179 95" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMSelectPatches + isProcessing = FALSE + elapsedTime = 0 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + copyInputWEMs = FALSE + listenToFinishNotifications = TRUE + forwardRepaintNotifications = TRUE + forwardSelectionNotifications = TRUE + progress = 0 + useInputWEMToCreateOutputWEM = FALSE + triangulationMode = Strip + modifyAttributes = FALSE + patchStartIndex = 0 + patchEndIndex = 0 + onePatch = TRUE + } +} +module WEMMerge { + internal { + frame = "665 205 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "252 325 322 391" + sizeHint = "322 391" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "513 422 499 472" + sizeHint = "260 224" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMMerge + isProcessing = FALSE + elapsedTime = 0.01499999966 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + copyInputWEMs = TRUE + listenToFinishNotifications = TRUE + forwardRepaintNotifications = TRUE + forwardSelectionNotifications = TRUE + triangulationMode = Strip + modifyAttributes = FALSE + selectedTab = 0 + outputTabSelected = TRUE + } +} +module WEMInitialize { + internal { + frame = "737 333 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "354 428 322 391" + sizeHint = "322 391" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInitialize1 + isProcessing = FALSE + elapsedTime = 0 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + initialPosition = "0 0 0" + initialDeformation = "1 1 1" + initModel = Cube + mirrorFaces = FALSE + generateEdges = TRUE + selectedTab = 0 + } +} +module WEMInitialize { + internal { + frame = "629 333 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "99 378 322 391" + sizeHint = "322 391" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInitialize + isProcessing = FALSE + elapsedTime = 0.01600000076 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + initialPosition = "0 0 0" + initialDeformation = "1 1 1" + initModel = Dodecahedron + mirrorFaces = FALSE + generateEdges = TRUE + selectedTab = 0 + } +} +connections { + SoDepthPeelRenderer.children = SoWEMRenderer.self + SoExaminerViewer.children = SoDepthPeelRenderer.self + SoWEMRenderer.inWEM = WEMSelectPatches.outWEM + WEMSelectPatches.inWEM = WEMMerge.outWEM + WEMMerge.inWEM = WEMInitialize.outWEM + WEMMerge.inWEM1 = WEMInitialize1.outWEM +} +networkModel { + parentItems { + 0 { + MLABNetworkModelItem MLABNoteItem { + uniqueId = 15 + objectName = "" + parentUniqueId = 0 + frame = "411 -132 200 200" + backgroundColor { + r = 252 + g = 242 + b = 2 + a = 255 + } + text = "In this example two WEMs are merged, which results in two patches. One of the patches is subsequently selected using the WEMSelectPatches module." + titleText = Comment + isCollapsed = False + } + } + } +} Property changes on: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMSelectPatches/WEMSelectPatchesExample.mlab ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + LF Added: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.html =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.html (rev 0) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.html 2010-03-05 16:24:00 UTC (rev 242) @@ -0,0 +1,79 @@ +<!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="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>WEMVolume</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>Computes the volumes of the WEM patches and determines the min and max volume and a volume curve. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect WEM. +</blockquote> + + + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>inWEM</b> + Input WEM. + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outputVolumeCurve</b> + Output volume curve. + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>minVolume</b> + Minimum patch volume. + </li> + <li> + <b>maxVolume</b> + Maximum patch volume. + </li> + <li> + <b>minVolumePatchIndex</b> + Index of patch with minimum volume. + </li> + <li> + <b>maxVolumePatchIndex</b> + Index of patch with maximum volume. + </li> + </ul> + +</blockquote> + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>See example network. +</blockquote> + + + + + +</body> +</html> Property changes on: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolume.html ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolumeExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolumeExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolumeExample.mlab 2010-03-05 16:24:00 UTC (rev 242) @@ -0,0 +1,517 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module WEMModify { + internal { + frame = "721 465 96 64" + moduleGroupName = "" + windows { + window _default { + geometry = "-38 185 562 625" + sizeHint = "562 625" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Scale1_35 + isProcessing = FALSE + elapsedTime = 0.03099999949 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + copyInputWEMs = TRUE + listenToFinishNotifications = TRUE + forwardRepaintNotifications = TRUE + forwardSelectionNotifications = TRUE + triangulationMode = Strip + modifyAttributes = FALSE + WEMs = "2@" + selectedWEMs = "" + modifyFieldsValid = TRUE + modifyAllPatches = TRUE + scale = "1.35 1.35 1.35" + translate = "0 0 0" + center = FALSE + rotation = "0 0 1 0" + transformMatrix = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + useTransformMatrix = FALSE + mirrorFaces = FALSE + triangulateFaces = FALSE + closeBoundaries = FALSE + setNodeColor = FALSE + nodeColor = "1 1 1" + setNodeAlpha = FALSE + nodeAlpha = 1 + nodeValueMode = None + nodeValue = 0 + clampNodeMinValue = FALSE + minClampValue = 0 + clampNodeMaxValue = FALSE + maxClampValue = 4095 + selectedTab = 0 + outputTabSelected = TRUE + } +} +module WEMModify { + internal { + frame = "673 465 96 64" + moduleGroupName = "" + windows { + window _default { + geometry = "-38 185 562 625" + sizeHint = "562 625" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Scale1_3 + isProcessing = FALSE + elapsedTime = 0 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + copyInputWEMs = TRUE + listenToFinishNotifications = TRUE + forwardRepaintNotifications = TRUE + forwardSelectionNotifications = TRUE + triangulationMode = Strip + modifyAttributes = FALSE + WEMs = "2@" + selectedWEMs = "" + modifyFieldsValid = TRUE + modifyAllPatches = TRUE + scale = "1.3 1.3 1.3" + translate = "0 0 0" + center = FALSE + rotation = "0 0 1 0" + transformMatrix = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + useTransformMatrix = FALSE + mirrorFaces = FALSE + triangulateFaces = FALSE + closeBoundaries = FALSE + setNodeColor = FALSE + nodeColor = "1 1 1" + setNodeAlpha = FALSE + nodeAlpha = 1 + nodeValueMode = None + nodeValue = 0 + clampNodeMinValue = FALSE + minClampValue = 0 + clampNodeMaxValue = FALSE + maxClampValue = 4095 + selectedTab = 0 + outputTabSelected = TRUE + } +} +module Diagram2D { + internal { + frame = "625 221 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "207 189 444 576" + sizeHint = "444 576" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 3 + autoRangeX = TRUE + minY = 2.181694746 + maxY = 7.363222599 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = FALSE + diagramTitleString = "" + borderH = 29 + autoBorderH = TRUE + borderV = 25 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 1 1" + lineStyle = Solid + markerType = None + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = -0.235135138 + mousePosY = 7.620158195 + mousePosValid = TRUE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = TRUE + } +} +module WEMModify { + internal { + frame = "601 465 96 64" + moduleGroupName = "" + windows { + window _default { + geometry = "518 236 562 625" + sizeHint = "562 625" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Scale1_5 + isProcessing = FALSE + elapsedTime = 0 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + copyInputWEMs = TRUE + listenToFinishNotifications = TRUE + forwardRepaintNotifications = TRUE + forwardSelectionNotifications = TRUE + triangulationMode = Strip + modifyAttributes = FALSE + WEMs = "2@" + selectedWEMs = "" + modifyFieldsValid = TRUE + modifyAllPatches = TRUE + scale = "1.5 1.5 1.5" + translate = "0 0 0" + center = FALSE + rotation = "0 0 1 0" + transformMatrix = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + useTransformMatrix = FALSE + mirrorFaces = FALSE + triangulateFaces = FALSE + closeBoundaries = FALSE + setNodeColor = FALSE + nodeColor = "1 1 1" + setNodeAlpha = FALSE + nodeAlpha = 1 + nodeValueMode = None + nodeValue = 0 + clampNodeMinValue = FALSE + minClampValue = 0 + clampNodeMaxValue = FALSE + maxClampValue = 4095 + selectedTab = 0 + outputTabSelected = TRUE + } +} +module WEMMerge { + internal { + frame = "609 389 144 56" + moduleGroupName = "" + } + fields { + instanceName = WEMMerge + isProcessing = FALSE + elapsedTime = 0 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + copyInputWEMs = FALSE + listenToFinishNotifications = TRUE + forwardRepaintNotifications = TRUE + forwardSelectionNotifications = TRUE + triangulationMode = Strip + modifyAttributes = FALSE + selectedTab = 0 + outputTabSelected = TRUE + } +} +module WEMInitialize { + internal { + frame = "581 549 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "482 339 322 391" + sizeHint = "322 391" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = WEMInitialize + isProcessing = FALSE + elapsedTime = 0 + id = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = FALSE + removePreviousWEMs = TRUE + label = "" + description = "" + show = TRUE + editable = TRUE + colorMode = "General " + drawFaces = TRUE + useFaceAmbientColor = TRUE + faceAmbientColor = "0.2666670083999634 0.2666670083999634 0.2666670083999634" + useFaceDiffuseColor = TRUE + faceDiffuseColor = "0.792156994342804 0.792156994342804 0.792156994342804" + useFaceSpecularColor = TRUE + faceSpecularColor = "0.06666699796915054 0.06666699796915054 0.06666699796915054" + faceAlphaValue = 1 + faceShininessValue = 1 + drawFaceNormals = FALSE + faceNormalsColor = "1 1 1" + faceNormalsScale = 1 + drawEdges = FALSE + edgeColor = "0 0 0" + usePolygonOffset = FALSE + lineWidth = 1 + useEdgeColoringMode = FALSE + drawNodes = FALSE + nodeColor = "1 1 1" + drawNodeNormals = FALSE + nodeNormalsColor = "1 1 1" + nodeNormalsScale = 1 + pointSize = 1 + nodeRenderingMode = Normal + drawBoundingBoxes = FALSE + boundingBoxMode = "Axis Aligned" + boundingBoxColor = "1 1 1" + initialPosition = "0 0 0" + initialDeformation = "1 1 1" + initModel = Dodecahedron + mirrorFaces = FALSE + generateEdges = TRUE + selectedTab = 0 + } +} +module WEMVolume { + internal { + frame = "629 309 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "666 189 250 112" + sizeHint = "250 112" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = WEMVolume + isProcessing = FALSE + elapsedTime = 0 + autoApply = TRUE + autoUpdate = TRUE + autoClear = TRUE + listenToFinishingNotifications = TRUE + listenToRepaintNotifications = TRUE + listenToSelectionChangedNotifications = TRUE + minVolume = 2.181694746 + maxVolume = 7.363222599 + minVolumePatchIndex = 0 + maxVolumePatchIndex = 1 + } +} +connections { + Scale1_35.inWEM = WEMInitialize.outWEM + Scale1_3.inWEM = WEMInitialize.outWEM + Diagram2D.inCurveList = WEMVolume.outputVolumeCurve + Scale1_5.inWEM = WEMInitialize.outWEM + WEMMerge.inWEM = WEMInitialize.outWEM + WEMMerge.inWEM1 = Scale1_5.outWEM + WEMMerge.inWEM2 = Scale1_3.outWEM + WEMMerge.inWEM3 = Scale1_35.outWEM + WEMVolume.inWEM = WEMMerge.outWEM +} +networkModel { + parentItems { + 0 { + MLABNetworkModelItem MLABNoteItem { + uniqueId = 18 + objectName = "" + parentUniqueId = 0 + frame = "898 296 200 200" + backgroundColor { + r = 252 + g = 242 + b = 2 + a = 255 + } + text = "We merge some WEMs and subsequently compute the volume of the patches. Check the Diagram2D window for the volume curve." + titleText = Comment + isCollapsed = False + } + } + } +} Property changes on: trunk/Community/General/Modules/ML/MLWEMCommunityModules/WEMVolume/WEMVolumeExample.mlab ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-03-05 16:13:11
|
Revision: 241 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=241&view=rev Author: coertmetz Date: 2010-03-05 16:13:04 +0000 (Fri, 05 Mar 2010) Log Message: ----------- CM: Changed include to make them match with the subfolder structure. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp 2010-03-05 16:02:19 UTC (rev 240) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp 2010-03-05 16:13:04 UTC (rev 241) @@ -15,10 +15,10 @@ #include "mlLibraryInitMacros.h" // Include all module headers ... -#include "mlLinearInterpolateXMarkerList.h" -#include "mlTransformXMarkerList.h" -#include "mlXMarkerListFromFile.h" -#include "mlXMarkerListToFile.h" +#include "InterpolateXMarkerList/mlLinearInterpolateXMarkerList.h" +#include "TransformXMarkerList/mlTransformXMarkerList.h" +#include "XMarkerListFile/mlXMarkerListFromFile.h" +#include "XMarkerListFile/mlXMarkerListToFile.h" ML_START_NAMESPACE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-03-05 16:02:29
|
Revision: 240 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=240&view=rev Author: coertmetz Date: 2010-03-05 16:02:19 +0000 (Fri, 05 Mar 2010) Log Message: ----------- CM: Moved modules to subdirectories, to uniform the community sources structure. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro Added Paths: ----------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.h Removed Paths: ------------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.h Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,151 @@ +//---------------------------------------------------------------------------------- +//! The ML module class LinearInterpolateXMarkerList. +/*! +// \file mlLinearInterpolateXMarkerList.cpp +// \author Coert Metz +// \date 2009-09-09 +// +// Linearly interpolate an XMarkerList +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "mlLinearInterpolateXMarkerList.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(LinearInterpolateXMarkerList, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +LinearInterpolateXMarkerList::LinearInterpolateXMarkerList () + : BaseOp(0, 0) +{ + ML_TRACE_IN("LinearInterpolateXMarkerList::LinearInterpolateXMarkerList ()"); + + // Suppress calls of handleNotification on field changes to + // avoid side effects during initialization phase. + handleNotificationOff(); + + // Get reference to the container for parameters/fields. + FieldContainer &fields = *getFieldContainer(); + + // Add fields to the module and set their values. + _inputXMarkerListFld = fields.addBase("inputXMarkerList"); + _inputXMarkerListFld->setBaseValue(NULL); + _outputXMarkerListFld = fields.addBase("outputXMarkerList"); + _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); + + // Sample distance for output XMarkerList + _sampleDistanceFld = fields.addFloat("sampleDistance"); + _sampleDistanceFld->setFloatValue(0.5f); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void LinearInterpolateXMarkerList::handleNotification (Field *field) +{ + ML_TRACE_IN("LinearInterpolateXMarkerList::handleNotification ()"); + + // Clear output XMarkerList + _outputXMarkerList.clear(); + + Base * baseValue = _inputXMarkerListFld->getBaseValue(); + if (baseValue && BASE_IS_A(baseValue, XMarkerList)) { + XMarkerList markers = *(XMarkerList*)baseValue; + + if (markers.size()>1 && markers.isModified()) { + // Compute length XMarkerList + double length = 0.0; + for (size_t i=0; i<markers.size()-1; ++i) { + length += (markers[i].pos-markers[i+1].pos).length(); + } + + // Check sample distance setting + if (_sampleDistanceFld->getFloatValue()<=0.0f) { + _sampleDistanceFld->setFloatValue(1.0f); + } + // Get sample distance setting + const float sampleDistance = _sampleDistanceFld->getFloatValue(); + + // Add first point + _outputXMarkerList.appendItem(markers[0]); + + // The stepsize is the sampledistance + double stepSize = sampleDistance; + // Centerline length already processed + double curLength = 0.0; + // Current line segment position + unsigned int segmentPos = 0; + + // Get first position + vec3 currentPos = markers[0].pos.getVec3(); + while (curLength < length && segmentPos<markers.size()-1) { + // Determine direction + vec3 direction = (vec6(markers[segmentPos+1].pos-markers[segmentPos].pos)).getVec3(); + direction.normalize(); + // Determine segment length + double segmentLength=(markers[segmentPos+1].pos-markers[segmentPos].pos).length(); + double curSegmentLength=0.0; + // Step in direction until next input point + while (curSegmentLength+stepSize<segmentLength) { + currentPos = currentPos + stepSize * direction; + curSegmentLength += stepSize; + curLength += stepSize; + _outputXMarkerList.appendItem(XMarker (currentPos)); + stepSize = sampleDistance; + } + // Determine rest length + stepSize = segmentLength-curSegmentLength; + // Update currentpos + currentPos = currentPos + stepSize * direction; + curLength+=stepSize; + stepSize = sampleDistance - stepSize; + + // Increment current line segment position + ++segmentPos; + } + } + } + + // Notify attached modules + _outputXMarkerListFld->notifyAttachments(); +} + +ML_END_NAMESPACE + Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.h (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.h) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/InterpolateXMarkerList/mlLinearInterpolateXMarkerList.h 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,93 @@ +//---------------------------------------------------------------------------------- +//! The ML module class LinearInterpolateXMarkerList. +/*! +// \file mlLinearInterpolateXMarkerList.h +// \author Coert Metz +// \date 2009-09-09 +// +// Linearly interpolate an XMarkerList +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __mlLinearInterpolateXMarkerList_H +#define __mlLinearInterpolateXMarkerList_H + + +// Local includes +#ifndef __MLXMarkerListCommunityModulesSystem_H +#include "MLXMarkerListCommunityModulesSystem.h" +#endif + +// ML includes +#include "mlOperatorIncludes.h" + +#include "mlXMarkerList.h" + +ML_START_NAMESPACE + + +//! Linearly interpolate an XMarkerList +class MLXMARKERLISTCOMMUNITYMODULES_EXPORT LinearInterpolateXMarkerList : public BaseOp +{ +public: + + //! Constructor. + LinearInterpolateXMarkerList (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + +private: + + // ---------------------------------------------------------- + //! \name Module field declarations + //@{ + // ---------------------------------------------------------- + + //! Input and output XMarkerList fields + BaseField *_inputXMarkerListFld; + BaseField *_outputXMarkerListFld; + XMarkerList _outputXMarkerList; + + //! Sample distance output XMarkerList + FloatField *_sampleDistanceFld; + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(LinearInterpolateXMarkerList) +}; + + +ML_END_NAMESPACE + +#endif // __mlLinearInterpolateXMarkerList_H + Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro 2010-03-05 15:52:47 UTC (rev 239) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro 2010-03-05 16:02:19 UTC (rev 240) @@ -30,18 +30,18 @@ HEADERS += \ MLXMarkerListCommunityModulesInit.h \ MLXMarkerListCommunityModulesSystem.h \ - mlTransformXMarkerlist.h \ - mlLinearInterpolateXMarkerList.h \ - mlXMarkerListFromFile.h \ - mlXMarkerListToFile.h + TransformXMarkerList/mlTransformXMarkerlist.h \ + InterpolateXMarkerList/mlLinearInterpolateXMarkerList.h \ + XMarkerListFile/mlXMarkerListFromFile.h \ + XMarkerListFile/mlXMarkerListToFile.h SOURCES += \ MLXMarkerListCommunityModulesInit.cpp \ - mlTransformXMarkerlist.cpp \ - mlLinearInterpolateXMarkerList.cpp \ - mlXMarkerListFromFile.cpp \ - mlXMarkerListToFile.cpp + TransformXMarkerList/mlTransformXMarkerlist.cpp \ + InterpolateXMarkerList/mlLinearInterpolateXMarkerList.cpp \ + XMarkerListFile/mlXMarkerListFromFile.cpp \ + XMarkerListFile/mlXMarkerListToFile.cpp # additional files that are NOT compiled RELATEDFILES += \ Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.cpp) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,164 @@ +//---------------------------------------------------------------------------------- +//! The ML module class TransformXMarkerList. +/*! +// \file mlTransformXMarkerList.cpp +// \author Coert Metz +// \date 2006-04-20 +// +// Transform all XMarkers of an XMarkerList with the given matrix or elementary +// transforms +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#ifndef __mlTransformXMarkerList_H +#include "mlTransformXMarkerList.h" +#endif + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(TransformXMarkerList, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +TransformXMarkerList::TransformXMarkerList (void) + : BaseOp(0, 0) +{ + ML_TRACE_IN("TransformXMarkerList::TransformXMarkerList()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Input and output XMarkerList + _inputXMarkerList = fields->addBase("inputXMarkerList"); + _outputXMarkerList = fields->addBase("outputXMarkerList"); + _outputXMarkerList->setBaseValue(&_outXMarkerList); + + // Bool field to enable/disable transformation + _transformEnabled = fields->addBool("transformEnabled"); + _transformEnabled->setBoolValue(true); + + // Fields for elementary transforms + _center = fields->addVec3f("center"); + _center->setVec3fValue(vec3(0)); + _scaleOrientation = new RotationField("scaleOrientation"); + _scaleOrientation->setRotationValue(vec3(0, 0, 1), 0); + fields->addField(_scaleOrientation); + _scale = fields->addVec3f("scale"); + _scale->setVec3fValue(vec3(1)); + _rotation = new RotationField("rotation"); + _rotation->setRotationValue(vec3(0, 0, 1), 0); + fields->addField(_rotation); + _translation = fields->addVec3f("translation"); + _translation->setVec3fValue(vec3(0)); + _elTrans = fields->addBool("useElementaryTransforms" ); + _elTrans->setBoolValue (true); + + // Transformation matrix field + _matrix = fields->addMatrix("matrix"); + + // Option for homogenous coordinates + _homogeneousFld = fields->addBool("divideByHomogeneousCoordinate"); + _homogeneousFld->setBoolValue(false); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void TransformXMarkerList::handleNotification (Field * /*field*/) +{ + ML_TRACE_IN("TransformXMarkerList::handleNotification()"); + + // Compose transformation matrix + if (_elTrans->getBoolValue()) { + mat4 matrix = identity3D<mat4::ComponentType>(); + vec3 center = _center->getVec3fValue(); + Rotation scaleRot = _scaleOrientation->getRotationValue(); + vec3 scale = _scale->getVec3fValue(); + Rotation rot = _rotation->getRotationValue(); + vec3 trans = _translation->getVec3fValue(); + Rotation invScaleRot = scaleRot; + invScaleRot.conjugate(); + + matrix = translation3D<mat4::ComponentType>(trans+center)* + rot.getMatrix()* + invScaleRot.getMatrix()* + scaling3D<mat4::ComponentType>(scale)* + scaleRot.getMatrix()* + translation3D<mat4::ComponentType>(-center); + + _matrix->setMatrixValue (matrix); + } + + // Do not transform if not enabled ... + mat4 matrix = _matrix->getMatrixValue(); + if (!_transformEnabled->getBoolValue()) + matrix = mat4::getIdentity(); + + // Transform XMarkers + Base *baseValue = _inputXMarkerList->getBaseValue(); + if (baseValue && BASE_IS_A(baseValue,XMarkerList)) { + XMarkerList *inXMarkerList = (XMarkerList *) baseValue; + // Clear output list + _outXMarkerList.clearList(); + for (int i=0; i<int(inXMarkerList->getSize()); ++i) { + // Get marker position and transform it + XMarker marker = inXMarkerList->at (i); + vec4 vMarker = vec4 (marker.x(), marker.y(), marker.z(), 1.0); + vMarker = matrix * vMarker; + // If homogeneous coordinates divide by last element + if (_homogeneousFld->getBoolValue() && vMarker[3] != 0.0) { + marker.x() = vMarker[0]/vMarker[3]; + marker.y() = vMarker[1]/vMarker[3]; + marker.z() = vMarker[2]/vMarker[3]; + } else { + marker.x() = vMarker[0]; + marker.y() = vMarker[1]; + marker.z() = vMarker[2]; + } + // Add marker to output list + _outXMarkerList.appendItem (marker); + } + // Select XMarker which is selected in input list and notify attachments + _outXMarkerList.doSelectItem(inXMarkerList->getCurrentIndex()); + _outputXMarkerList->notifyAttachments(); + } +} + +ML_END_NAMESPACE Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.h) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,111 @@ +//---------------------------------------------------------------------------------- +//! The ML module class TransformXMarkerList. +/*! +// \file mlTransformXMarkerList.h +// \author Coert Metz +// \date 2006-04-20 +// +// Transform all XMarkers of an XMarkerList with the given matrix or elementary transforms +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __mlTransformXMarkerList_H +#define __mlTransformXMarkerList_H + +// Local includes +#ifndef __MLXMarkerListCommunityModulesSystem_H +#include "MLXMarkerListCommunityModulesSystem.h" +#endif + +// ML includes +#ifndef __mlOperatorIncludes_H +#include "mlOperatorIncludes.h" +#endif + +#include "mlLinearAlgebra.h" +#include "mlRotationField.h" +#include "mlXMarkerList.h" + + +ML_START_NAMESPACE + + +//! Transform all XMarkers of an XMarkerList with the given matrix or elementary transforms +class MLXMARKERLISTCOMMUNITYMODULES_EXPORT TransformXMarkerList : public BaseOp +{ +public: + + //! Constructor. + TransformXMarkerList (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + +private: + + // ---------------------------------------------------------- + //! \name Module field declarations + //@{ + // ---------------------------------------------------------- + + //! Input and output XMarkerList field + BaseField *_inputXMarkerList; + BaseField *_outputXMarkerList; + XMarkerList _outXMarkerList; + + //! Bool field to enable/disable marker transformation + BoolField *_transformEnabled; + + //! Transformation matrix field + MatrixField *_matrix; + + //! Elementary transforms fields + Vec3fField *_center; + RotationField *_scaleOrientation; + Vec3fField *_scale; + RotationField *_rotation; + Vec3fField *_translation; + BoolField *_elTrans; + + //! Field to enable homogeneous coordinates + BoolField *_homogeneousFld; + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(TransformXMarkerList) + +}; + +ML_END_NAMESPACE + +#endif // __mlTransformXMarkerList_H Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.cpp) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,183 @@ +////---------------------------------------------------------------------------------- +//! The ML module class XMarkerListFromFile. +/*! +// \file mlXMarkerListFromFile.cpp +// \author Coert Metz +// \date 2007-06-22 +// +// Read XMarkers from a text file +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "mlXMarkerListFromFile.h" +#include <fstream> + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(XMarkerListFromFile, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +XMarkerListFromFile::XMarkerListFromFile (void) + : BaseOp(1, 0) +{ + ML_TRACE_IN("XMarkerListFromFile::XMarkerListFromFile()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Add filename field + _filenameFld = fields->addString("filename"); + _filenameFld->setStringValue(""); + + // Add bool fields to select elements to import + _positionXFld = fields->addBool("importPositionX"); + _positionXFld->setBoolValue(true); + _positionYFld = fields->addBool("importPositionY"); + _positionYFld->setBoolValue(true); + _positionZFld = fields->addBool("importPositionZ"); + _positionZFld->setBoolValue(true); + _positionTFld = fields->addBool("importPositionT"); + _positionTFld->setBoolValue(false); + _vectorXFld = fields->addBool("importVectorX"); + _vectorXFld->setBoolValue(false); + _vectorYFld = fields->addBool("importVectorY"); + _vectorYFld->setBoolValue(false); + _vectorZFld = fields->addBool("importVectorZ"); + _vectorZFld->setBoolValue(false); + _typeFld = fields->addBool("importType"); + _typeFld->setBoolValue(false); + + // Add input coordinate system field + const char *_inputCoordinateSystemFldValues[] = { "world", "voxel" }; + _inputCoordinateSystemFld = fields->addEnum("inputCoordinateSystem", _inputCoordinateSystemFldValues, 2); + _inputCoordinateSystemFld->setEnumValue(1); + + // Add field to let the module skip some element before reading the markers from file + _skipElementsFld = fields->addInt("numElementsToSkip"); + _skipElementsFld->setIntValue(0); + + // Output XMarkerList + _outputXMarkerListFld = fields->addBase("outputXMarkerList"); + _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); + + // Update fields + _updateFld = fields->addNotify("update"); + _autoUpdateFld = fields->addBool("autoUpdate"); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void XMarkerListFromFile::handleNotification (Field *field) +{ + ML_TRACE_IN("XMarkerListFromFile::handleNotification()") + + if (field==_updateFld || _autoUpdateFld->getBoolValue()) { + _outputXMarkerList.clear(); + + // Check if an input image is connected when coordinate system is set to voxel + if (_inputCoordinateSystemFld->getEnumValue()==1 && !getUpdatedInImg(0)) { + std::cout << "When you select voxel as input coordinate system you should provide an input image!" << std::endl; + return; + } + + // Check filename + std::string filename = _filenameFld->getStringValue(); + if (filename != "") { + // Open file + std::fstream file_op(filename.c_str(), std::ios::in); + // Check if file is open + if (file_op.is_open()) { + mat4 toWorld = mat4::getIdentity(); + // Skip number of lines + for (int i=0; i<_skipElementsFld->getIntValue(); ++i) { + std::string dummy; + file_op >> dummy; + } + + // Read XMarkers from text file + while (true) { + XMarker marker; + std::vector<std::string> tokens (8, "0"); + if (_positionXFld->getBoolValue()) if ( !(file_op >> tokens[0]) ) break; + if (_positionYFld->getBoolValue()) if ( !(file_op >> tokens[1]) ) break; + if (_positionZFld->getBoolValue()) if ( !(file_op >> tokens[2]) ) break; + if (_positionTFld->getBoolValue()) if ( !(file_op >> tokens[3]) ) break; + if (_vectorXFld->getBoolValue()) if ( !(file_op >> tokens[4]) ) break; + if (_vectorYFld->getBoolValue()) if ( !(file_op >> tokens[5]) ) break; + if (_vectorZFld->getBoolValue()) if ( !(file_op >> tokens[6]) ) break; + if (_typeFld->getBoolValue()) if ( !(file_op >> tokens[7]) ) break; + vec3 voxel (atof (tokens[0].c_str()), atof(tokens[1].c_str()), atof(tokens[2].c_str())); + // When coordinates in file are in world coordinates, we are done + vec3 world = voxel; + vec3 vec; + vec[0] = atof (tokens[4].c_str()); + vec[1] = atof (tokens[5].c_str()); + vec[2] = atof (tokens[6].c_str()); + int type = atoi (tokens[7].c_str()); + // When coordinates in file are in voxel coordinates, we need to convert both the + // position and the vector to world coordinates + if (_inputCoordinateSystemFld->getEnumValue()) { + getUpdatedInImg(0)->transformToWorldCoord(voxel+vec3(0.5, 0.5, 0.5), world); + vec3 vecWOrld; + getUpdatedInImg(0)->transformToWorldCoord(voxel+vec+vec3(0.5, 0.5, 0.5), vecWOrld); + vec = vecWOrld - world; + } + marker.pos[0] = world[0]; + marker.pos[1] = world[1]; + marker.pos[2] = world[2]; + marker.pos[4] = atof(tokens[3].c_str()); + marker.vec = vec; + marker.type = type; + // Add marker to output list + _outputXMarkerList.appendItem(marker); + } + } else { + std::cout << "Cannot open file (" << filename << ")!" << std::endl; + } + } + + _outputXMarkerListFld->notifyAttachments(); + } +} + +ML_END_NAMESPACE Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.h) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,103 @@ +//---------------------------------------------------------------------------------- +//! The ML module class XMarkerListFromFile. +/*! +// \file mlXMarkerListFromFile.h +// \author Coert Metz +// \date 2007-06-22 +// +// Read XMarkers from a text file +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __mlXMarkerListFromFile_H +#define __mlXMarkerListFromFile_H + +// Local includes +#ifndef __MLXMarkerListCommunityModulesSystem_H +#include "MLXMarkerListCommunityModulesSystem.h" +#endif + +// ML includes +#include "mlOperatorIncludes.h" +#include "mlXMarkerList.h" + +ML_START_NAMESPACE + +//! Read XMarkers from a text file +class MLXMARKERLISTCOMMUNITYMODULES_EXPORT XMarkerListFromFile : public BaseOp { +public: + //! Constructor. + XMarkerListFromFile (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + +private: + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + // Input filename + StringField *_filenameFld; + + // Enum to choose between world/voxel coordinate input + EnumField *_inputCoordinateSystemFld; + + // Update fields + NotifyField *_updateFld; + BoolField* _autoUpdateFld; + + // Field to select elements to import + BoolField *_positionXFld; + BoolField *_positionYFld; + BoolField *_positionZFld; + BoolField *_positionTFld; + BoolField *_vectorXFld; + BoolField *_vectorYFld; + BoolField *_vectorZFld; + BoolField *_typeFld; + + // Skip a certain number of line at the start of the file + IntField *_skipElementsFld; + + // OutputXMarkerList and corresponding field + BaseField *_outputXMarkerListFld; + XMarkerList _outputXMarkerList; + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(XMarkerListFromFile) +}; + +ML_END_NAMESPACE + +#endif // __mlXMarkerListFromFile_H Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.cpp (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.cpp) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.cpp 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,278 @@ +//---------------------------------------------------------------------------------- +//! The ML module class XMarkerListToFile. +/*! +// \file mlXMarkerListToFile.cpp +// \author Coert Metz +// \date 2007-07-06 +// +// Save XMarkers to a text file +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "mlXMarkerListToFile.h" +#include <fstream> + +ML_START_NAMESPACE + +#include <set> + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(XMarkerListToFile, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +XMarkerListToFile::XMarkerListToFile (void) + : BaseOp(1, 0) +{ + ML_TRACE_IN("XMarkerListToFile::XMarkerListToFile()") + + // Coordinate system and separator options + const char *_outputCoordinateSystemFldValues[] = { "world", "voxel","pos:voxel, vec:world"}; + const char *_coordinateSeparatorFldValues[] = { "space", "newline" }; + + // Get field container + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Add filename field + _filenameFld = fields->addString("filename"); + _filenameFld->setStringValue(""); + + // Add enum to choose output coordinate system + _outputCoordinateSystemFld = fields->addEnum("outputCoordinateSystem", _outputCoordinateSystemFldValues, 3); + _outputCoordinateSystemFld->setEnumValue(1); + + // Add enum to choose coordinate separator + _coordinateSeparatorFld = fields->addEnum("coordinateSeparator", _coordinateSeparatorFldValues, 2); + _coordinateSeparatorFld->setEnumValue(0); + + // Add input XMarkerList field containing the markers to write to file + _inputXMarkerListFld = fields->addBase("inputXMarkerList"); + _inputXMarkerListFld->setBaseValue(NULL); + + // Add bools to select elements for the export + _positionXFld = fields->addBool("exportPositionX"); + _positionXFld->setBoolValue(true); + _positionYFld = fields->addBool("exportPositionY"); + _positionYFld->setBoolValue(true); + _positionZFld = fields->addBool("exportPositionZ"); + _positionZFld->setBoolValue(true); + _positionTFld = fields->addBool("exportPositionT"); + _positionTFld->setBoolValue(false); + _vectorXFld = fields->addBool("exportVectorX"); + _vectorXFld->setBoolValue(false); + _vectorYFld = fields->addBool("exportVectorY"); + _vectorYFld->setBoolValue(false); + _vectorZFld = fields->addBool("exportVectorZ"); + _vectorZFld->setBoolValue(false); + _typeFld = fields->addBool("exportType"); + _typeFld->setBoolValue(false); + + // Add field to enable/disable output of only one marker per voxel + _maxOneMarkerPerVoxelFld = fields->addBool("maxOneMarkerPerVoxel"); + _maxOneMarkerPerVoxelFld->setBoolValue(false); + + // Enable/disable elastix (transformix) format + _transformixFormatFld = fields->addBool("elastixFormat"); + _transformixFormatFld->setBoolValue(false); + + // Add save button + _saveFld = fields->addNotify("save"); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void XMarkerListToFile::handleNotification (Field *field) +{ + ML_TRACE_IN("XMarkerListToFile::handleNotification()") + + if (field==_saveFld) { + // When voxel is selected as output coordinate system, an image should be + // connected for the worldToVoxel matrix + if (_outputCoordinateSystemFld->getEnumValue() && !getUpdatedInImg(0)) { + std::cout << "When you select voxel as output coordinate system you should provide an input image!" << std::endl; + return; + } + + // Get coordinate separator + std::stringstream coordinateSeparator; + if (_coordinateSeparatorFld->getEnumValue()) { + coordinateSeparator << std::endl; + } else { + coordinateSeparator << " "; + } + + // Check XMarkerList input + Base *baseInput = _inputXMarkerListFld->getBaseValue(); + if (baseInput && BASE_IS_A(baseInput, XMarkerList)) { + // Get XMarkerList + XMarkerList markers = * (XMarkerList*) baseInput; + // Get and check filename + std::string filename = _filenameFld->getStringValue(); + if (filename=="") { + std::cout << "You should provide a filename for the output!" << std::endl; + return; + } + // Open file + std::fstream file_op(filename.c_str(), std::ios::out); + // Check if file is open + if (!file_op.is_open()) { + std::cout << "Cannot write output file!" << std::endl; + return; + } + + // transformix format? + if (_transformixFormatFld->getBoolValue()) { + if (!_outputCoordinateSystemFld->getEnumValue()) { + file_op << "point" << std::endl; + } else { + file_op << "index" << std::endl; + } + file_op << markers.size() << std::endl; + } + + // Check which elements to export + const bool posX = _positionXFld->getBoolValue(); + const bool posY = _positionYFld->getBoolValue(); + const bool posZ = _positionZFld->getBoolValue(); + const bool posT = _positionTFld->getBoolValue(); + const bool vecX = _vectorXFld->getBoolValue(); + const bool vecY = _vectorYFld->getBoolValue(); + const bool vecZ = _vectorZFld->getBoolValue(); + const bool type = _typeFld->getBoolValue(); + + // Vector storing occupied voxel position + std::set<vec3> voxelsOccupied; + const bool onePerVoxel = _maxOneMarkerPerVoxelFld->getBoolValue(); + + // Write markers to file + for (XMarkerList::iterator it = markers.begin(); it != markers.end(); ++it) { + // Get marker + XMarker marker = *it; + // Get world coordinates of marker + const vec3 world = marker.pos.getVec3(); + vec3 voxel = world; + vec3 vec = marker.vec; + if (_outputCoordinateSystemFld->getEnumValue() == 1) { + // Output position and vector in voxel coordinates + getUpdatedInImg(0)->transformToVoxelCoord(world, voxel); + getUpdatedInImg(0)->transformToVoxelCoord(world+vec, vec); + vec = vec - voxel; + // Floor voxel coordinates + voxel[0] = int (voxel[0]); + voxel[1] = int (voxel[1]); + voxel[2] = int (voxel[2]); + } else { + // Output position in voxel coordinates and vector in world coordinates + if (_outputCoordinateSystemFld->getEnumValue() == 2) { + getUpdatedInImg(0)->transformToVoxelCoord(world, voxel); + // Floor voxel coordinates + voxel[0] = int (voxel[0]); + voxel[1] = int (voxel[1]); + voxel[2] = int (voxel[2]); + } + } + + // Check if voxel position already ocupied + bool allowInsert = true; + if(onePerVoxel) { + if(voxelsOccupied.find(voxel) != voxelsOccupied.end()) + allowInsert = false; + else + voxelsOccupied.insert(voxel); + } + + // Output marker + if(allowInsert) { + if (posX) { + file_op << voxel[0]; + if (posT || posY || posZ || vecX || vecY || vecZ || type) { + file_op << coordinateSeparator.str(); + } + } + if (posY) { + file_op << voxel[1]; + if (posT || posZ || vecX || vecY || vecZ || type) { + file_op << coordinateSeparator.str(); + } + } + if (posZ) { + file_op << voxel[2]; + if (posT || vecX || vecY || vecZ || type) { + file_op << coordinateSeparator.str(); + } + } + if (posT) { + file_op << marker.pos[4]; + if (vecX || vecY || vecZ || type) { + file_op << coordinateSeparator.str(); + } + } + if (vecX) { + file_op << vec[0]; + if (vecY || vecZ || type) { + file_op << coordinateSeparator.str(); + } + } + if (vecY) { + file_op << vec[1]; + if (vecZ || type) { + file_op << coordinateSeparator.str(); + } + } + if (vecZ) { + file_op << vec[2]; + if (vecZ || type) { + file_op << coordinateSeparator.str(); + } + } + if (type) { + file_op << marker.type; + } + file_op << std::endl; + } + } + } else { + std::cout << "Input is not a valid XMarkerList!" << std::endl; + return; + } + } +} + +ML_END_NAMESPACE Copied: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.h (from rev 230, trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.h) =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListToFile.h 2010-03-05 16:02:19 UTC (rev 240) @@ -0,0 +1,115 @@ +//---------------------------------------------------------------------------------- +//! The ML module class XMarkerListToFile. +/*! +// \file mlXMarkerListToFile.h +// \author Coert Metz +// \date 2007-07-06 +// +// Save XMarkerList to a text file +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __mlXMarkerListToFile_H +#define __mlXMarkerListToFile_H + + +// Local includes +#ifndef __MLXMarkerListCommunityModulesSystem_H +#include "MLXMarkerListCommunityModulesSystem.h" +#endif + +// ML includes +#include "mlOperatorIncludes.h" +#include "mlXMarkerList.h" + +ML_START_NAMESPACE + +//! Read XMarkers from a text file +class MLXMARKERLISTCOMMUNITYMODULES_EXPORT XMarkerListToFile : public BaseOp +{ +public: + + //! Constructor. + XMarkerListToFile (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + +private: + + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + //! Filename of file to save markers to + StringField *_filenameFld; + + //! Coordinate system of output markers (world or voxel) + //! When voxel is selected, the module converts the markers to + //! voxel coordinates before writing them to file + //! The last option is pos:voxel, vec:world, which only convert + //! the marker position to voxel coordinates before exporting the marker. + EnumField *_outputCoordinateSystemFld; + + //! Field to chose between space or newline as coordinate separator + EnumField *_coordinateSeparatorFld; + + //! Field for input XMarkerList + BaseField *_inputXMarkerListFld; + + //! Fields to select elements to export + BoolField *_positionXFld; + BoolField *_positionYFld; + BoolField *_positionZFld; + BoolField *_positionTFld; + BoolField *_vectorXFld; + BoolField *_vectorYFld; + BoolField *_vectorZFld; + BoolField *_typeFld; + + //! Bool field for transformix format (first line: number of points, second line: point or index) + BoolField *_transformixFormatFld; + + //! Enable/disable output of only one marker per voxel coordinate + BoolField *_maxOneMarkerPerVoxelFld; + + //! Save button + NotifyField *_saveFld; + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(XMarkerListToFile) +}; + +ML_END_NAMESPACE + +#endif // __mlXMarkerListToFile_H Deleted: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp 2010-03-05 15:52:47 UTC (rev 239) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp 2010-03-05 16:02:19 UTC (rev 240) @@ -1,151 +0,0 @@ -//---------------------------------------------------------------------------------- -//! The ML module class LinearInterpolateXMarkerList. -/*! -// \file mlLinearInterpolateXMarkerList.cpp -// \author Coert Metz -// \date 2009-09-09 -// -// Linearly interpolate an XMarkerList -*/ -//---------------------------------------------------------------------------------- - -/* ================================================================================= - 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. - =================================================================================*/ - -// Local includes -#include "mlLinearInterpolateXMarkerList.h" - -ML_START_NAMESPACE - - -//! Implements code for the runtime type system of the ML -ML_BASEOP_CLASS_SOURCE(LinearInterpolateXMarkerList, BaseOp); - -//---------------------------------------------------------------------------------- -//! Constructor -//---------------------------------------------------------------------------------- -LinearInterpolateXMarkerList::LinearInterpolateXMarkerList () - : BaseOp(0, 0) -{ - ML_TRACE_IN("LinearInterpolateXMarkerList::LinearInterpolateXMarkerList ()"); - - // Suppress calls of handleNotification on field changes to - // avoid side effects during initialization phase. - handleNotificationOff(); - - // Get reference to the container for parameters/fields. - FieldContainer &fields = *getFieldContainer(); - - // Add fields to the module and set their values. - _inputXMarkerListFld = fields.addBase("inputXMarkerList"); - _inputXMarkerListFld->setBaseValue(NULL); - _outputXMarkerListFld = fields.addBase("outputXMarkerList"); - _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); - - // Sample distance for output XMarkerList - _sampleDistanceFld = fields.addFloat("sampleDistance"); - _sampleDistanceFld->setFloatValue(0.5f); - - // Reactivate calls of handleNotification on field changes. - handleNotificationOn(); -} - -//---------------------------------------------------------------------------------- -//! Handle field changes of the field field. -//---------------------------------------------------------------------------------- -void LinearInterpolateXMarkerList::handleNotification (Field *field) -{ - ML_TRACE_IN("LinearInterpolateXMarkerList::handleNotification ()"); - - // Clear output XMarkerList - _outputXMarkerList.clear(); - - Base * baseValue = _inputXMarkerListFld->getBaseValue(); - if (baseValue && BASE_IS_A(baseValue, XMarkerList)) { - XMarkerList markers = *(XMarkerList*)baseValue; - - if (markers.size()>1 && markers.isModified()) { - // Compute length XMarkerList - double length = 0.0; - for (size_t i=0; i<markers.size()-1; ++i) { - ... [truncated message content] |
From: <rha...@us...> - 2010-03-05 15:52:54
|
Revision: 239 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=239&view=rev Author: rhameeteman Date: 2010-03-05 15:52:47 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH * Added module: FileIterator Added Paths: ----------- trunk/Community/General/Modules/Macros/FileIO/ trunk/Community/General/Modules/Macros/FileIO/FileIterator.def trunk/Community/General/Modules/Macros/FileIO/FileIterator.mlab trunk/Community/General/Modules/Macros/FileIO/FileIterator.script trunk/Community/General/Modules/Macros/FileIO/html/ trunk/Community/General/Modules/Macros/FileIO/html/FileIterator.html trunk/Community/General/Modules/Macros/FileIO/networks/ trunk/Community/General/Modules/Macros/FileIO/networks/FileIteratorExample.mlab Added: trunk/Community/General/Modules/Macros/FileIO/FileIterator.def =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/FileIterator.def (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/FileIterator.def 2010-03-05 15:52:47 UTC (rev 239) @@ -0,0 +1,56 @@ +//---------------------------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------------------------- +//! FileIterator module definition +/*! +// \file FileIterator.def +// \author Reinhard Hameeteman +// \date 2009-11-02 +*/ +//---------------------------------------------------------------------------------- + +MacroModule FileIterator { + genre = "File" + group = BIGR + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Iterate over a file list" + keywords = "file directory iterate list dir" + seeAlso = "FileDirectory FieldIterator MakeName LoadAny FileInformation" + documentation = $(LOCAL)/html/FileIterator.html + exampleNetwork = "$(LOCAL)/networks/FileIteratorExample.mlab" + externalDefinition = "$(LOCAL)/FileIterator.script" +} // MacroModule FileIterator + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:45:22 +//# hash: hV+4r4zj6PTIKLyD5tkX4CP6T5dNIeKcZt3SCaFxKQnlGERrTft9zXRsTMewBSmi06NffmPL/IR8G4Bnmg3UfA== +//# MeVis end Added: trunk/Community/General/Modules/Macros/FileIO/FileIterator.mlab =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/FileIterator.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/FileIterator.mlab 2010-03-05 15:52:47 UTC (rev 239) @@ -0,0 +1,260 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module Negation { + internal { + frame = "721 317 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "409 439 468 190" + sizeHint = "468 190" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Negation + inToggle = FALSE + outToggle = TRUE + outToggleInt = 1 + inInta = 0 + outInta = 1 + inIntb = -1 + outIntb = 1 + inIntc = -1 + outIntc = 0 + inIntd = 1 + outIntd = -1 + inFloat = 1 + outFloat = -1 + } + internalFields = "" +} +module FieldBypass { + internal { + frame = "597 317 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "319 620 190 298" + sizeHint = "190 298" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = FieldBypass1 + inputString0 = "" + inputString1 = "" + inputString2 = "" + inputString3 = "" + inputString4 = "" + inputNumber = 0 + outputString = "" + noBypass = TRUE + onlyIfChanged = TRUE + } +} +module LoadAny { + internal { + frame = "597 149 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "785 250 482 605" + sizeHint = "482 605" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LoadAny + name = "" + trueName = "" + verbose = FALSE + analyzeHeader = TRUE + allowBioFormats = FALSE + textOut = "" + loaderName = "" + writerNames = "" + formatInfo = "" + shortFileHeader = "" + fileHeader = "" + status = "" + } + internalFields = "" +} +module FieldBypass { + internal { + frame = "285 313 104 64" + moduleGroupName = "" + windows { + window _default { + geometry = "463 545 190 298" + sizeHint = "190 298" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FileList + inputString0 = "" + inputString1 = "" + inputString2 = "" + inputString3 = "" + inputString4 = "" + inputNumber = -1 + outputString = "" + noBypass = FALSE + onlyIfChanged = TRUE + } +} +module MakeName { + internal { + frame = "593 397 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "536 279 507 508" + sizeHint = "507 508" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MakeName + inputName = "" + extensions = ".*" + extRegExp = FALSE + outputTemplate = "" + outputName = "" + predefined = void + dicomTagA = PatientsName + dicomTagB = PatientID + dicomTagC = InstitutionName + dicomTagD = Modality + dicomTagE = AcquisitionDate + dicomTagF = AcquisitionTime + dicomValueA = "" + dicomValueB = "" + dicomValueC = "" + dicomValueD = "" + dicomValueE = "" + dicomValueF = "" + userStringS = "" + userStringT = "" + trimSpaces = TRUE + } + internalFields = "" +} +module FileInformation { + internal { + frame = "585 237 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "659 332 271 374" + sizeHint = "271 374" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FileInformation + path = "" + dirname = "" + filename = "" + basename = "" + extension = "" + type = "" + size = 0 + createDate = "" + exists = FALSE + isDirectory = FALSE + isReadable = FALSE + isWritable = TRUE + } + internalFields = "" +} +module FileDirectory { + internal { + frame = "149 317 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "4 111 509 575" + sizeHint = "509 583" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FileDirectory + rootPath = "" + recursive = FALSE + maxRecursionDepth = -1 + fileType = Files + joinImagePairs = FALSE + include = "" + includeRegExp = FALSE + predefined = void + exclude = "" + excludeRegExp = FALSE + ignoreCase = TRUE + fileList = "" + dirMode = Absolute + } + internalFields = "" +} +module FieldIterator { + internal { + frame = "449 317 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "136 235 422 321" + sizeHint = "422 321" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FieldIterator + fieldNames = "" + fieldValues = "" + fieldSeparator = [,;] + valueSeparator = "\\n\\r|\\r\\n|[\\n\\r\\\\]" + valueHeader = FALSE + numValues = 0 + indexTranslation = 0 + curIndex = -1 + curValue = "" + newValueEnable = FALSE + verbose = FALSE + delay = 1 + loop = FALSE + running = FALSE + autoReset = FALSE + } + internalFields = "" +} +connections { + FieldBypass1.inputString0 = FieldIterator.curValue + FieldBypass1.noBypass = Negation.outToggle + LoadAny.name = FieldBypass1.outputString + FileList.inputString0 = FileDirectory.fileList + MakeName.inputName = FieldIterator.curValue + FileInformation.path = FieldIterator.curValue + FieldIterator.fieldValues = FileList.outputString +} +networkModel = "" Added: trunk/Community/General/Modules/Macros/FileIO/FileIterator.script =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/FileIterator.script (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/FileIterator.script 2010-03-05 15:52:47 UTC (rev 239) @@ -0,0 +1,460 @@ +//---------------------------------------------------------------------------------- +// +// 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 FileIterator +/*! +// \file FileIterator.script +// \author Reinhard Hameeteman +// \date 2009-11-02 +// +// Iterate over a file list +*/ +//---------------------------------------------------------------------------------- + + +Interface { + Inputs {} + Outputs { + Field outImage { internalName = LoadAny.outImage } + Field outBase { internalName = LoadAny.outBase } + Field outInventor { internalName = LoadAny.outInventor } + } + + Parameters { + Field enableOutput { internalName = Negation.inToggle } + + // File directory + Field rootPath { internalName = FileDirectory.rootPath } + Field recursive { internalName = FileDirectory.recursive } + Field maxRecursionDepth { internalName = FileDirectory.maxRecursionDepth } + Field fileType { internalName = FileDirectory.fileType } + Field joinImagePairs { internalName = FileDirectory.joinImagePairs } + Field include { internalName = FileDirectory.include } + Field includeRegExp { internalName = FileDirectory.includeRegExp } + Field predefined { internalName = FileDirectory.predefined } + Field exclude { internalName = FileDirectory.exclude } + Field excludeRegExp { internalName = FileDirectory.excludeRegExp } + Field ignoreCase { internalName = FileDirectory.ignoreCase } + Field dirMode { internalName = FileDirectory.dirMode } + Field update { internalName = FileDirectory.update} + Field clear { internalName = FileDirectory.clear } + + // Field Iterator + Field fieldNames { internalName = FieldIterator.fieldNames } + Field fieldValues { internalName = FieldIterator.fieldValues } + Field fileList { internalName = FieldIterator.fieldValues } + Field externalList { internalName = FileList.inputString1 } + + Field numValues { internalName = FieldIterator.numValues } + Field indexTranslation { internalName = FieldIterator.indexTranslation} + Field curIndex { internalName = FieldIterator.curIndex} + Field curValue { internalName = FieldIterator.curValue} + Field firstValue { internalName = FieldIterator.firstValue} + Field prevValue { internalName = FieldIterator.prevValue } + Field nextValue { internalName = FieldIterator.nextValue} + Field lastValue { internalName = FieldIterator.lastValue} + Field reset { internalName = FieldIterator.reset} + Field newValue { internalName = FieldIterator.newValue} + Field newValueEnable { internalName = FieldIterator.newValueEnable} + Field verbose { internalName = FieldIterator.verbose} + + Field start { internalName = FieldIterator.start} + Field stop { internalName = FieldIterator.stop } + Field delay { internalName = FieldIterator.delay } + Field loop { internalName = FieldIterator.loop} + Field running { internalName = FieldIterator.running} + Field autoReset { internalName = FieldIterator.autoReset } + + // FileInformation + Field dirname { internalName = FileInformation.dirname } + Field filename { internalName = FileInformation.filename } + Field basename { internalName = FileInformation.basename } + Field extension { internalName = FileInformation.extension } + + // Make Name + Field outputTemplate { internalName = MakeName.outputTemplate } + Field outputName { internalName = MakeName.outputName } + Field userStringS { internalName = MakeName.userStringS } + Field userStringT { internalName = MakeName.userStringT } + Field trimSpaces { internalName = MakeName.DicomTags.trimSpaces } + } +} + + +Commands { + +} + +Window { + style FileIterator_General { derive = BIGRStyle } + name = mainWindow + tooltip = "By pressing Ctrl-D you get the full interface to all the underlaying modules" + Vertical Iterate { + expandY = No + Horizontal { + expandX = Yes + expandY = No + Box "Selection" { + Horizontal { + alignX = Left + Button prevValue { title = "Previous" alignGroupX = buttonC1 } + Button nextValue { title = "Next" alignGroupX = buttonC2 } + } + Horizontal { + alignX = Left + Button firstValue { title = "First" alignGroupX = buttonC1 } + Button lastValue { title = "Last" alignGroupX = buttonC2 } + Button reset { title = "Reset" alignGroupX = buttonC3 } + } + Horizontal {} + } + Box Auto { + Horizontal { + alignX = Left + Button start { } + Button stop { } + } + Horizontal { + Field delay { + title = "Delay" + step = 0.1 + format = "%.2f" + } + Label { title = sec } + Empty { width = 5 } + } + Horizontal { + CheckBox running { edit = no alignGroupX = autog1 } + CheckBox autoReset { dependsOn = !loop alignGroupX = autog1 } + } + } + } + Box "Current Selection" { + Horizontal { + alignX = left + instanceName = ListNavigation + Field curIndex { + alignGroupX = selectionC1 + title = "Current Index:" + step = 1 + } + Field numValues { title = "Values:" edit = no } + CheckBox loop {} + CheckBox verbose {} + } + + Field curValue { + title = "Current File:" + edit = no + expandX = Yes + editAlign = left + alignGroupX = selectionC1 + } + + Horizontal { + alignX = left + Field newValue { + title = "New Value" + editField = no + alignGroupX = selectionC1 + } + Label { title = "(Triggered on new value selection)" } + CheckBox newValueEnable { title = Enable } + } + + Field dirname { + title = Directory: + edit = No + trim = Center + } + Field filename { + title = Filename: + edit = No + } + Field basename { + title = Basename: + edit = No + } + Field extension { + title = "File Extension:" + edit = No + } + } + } // Category Iterate + + + Vertical Selection { + Box "File Set Selection" { layout = Vertical + droppedFileCommand = "*js: ctx.field("rootPath").value = arguments[0]; *" + Field rootPath { + title = "Root Path:" + trim = center + browseButton = yes + browseMode = directory + } + Vertical { expandX = no + Horizontal { + CheckBox recursive { title = "Include Subdirectories" } + Field maxRecursionDepth { + title = "Maximum Search Depth (-1 for no limit):" + step = 1 + tooltip = "Maximum subdirectory depth for the subdirectory inclusion. For unlimited depth, select a negative value." + dependsOn = recursive + } + } + CheckBox joinImagePairs { title = "Join Image Pairs" expandX = no } + Horizontal { + alignY = center + expandX = NO + Label { title = "File Type:" } + ButtonBar fileType { + show = radio + direction = horizontal + items { + item Files { title = "Plain Files" } + item Dirs { title = Directories } + item All { title = "All Entries" } + } + } + } + } + } // Box "File Set Selection" + + Box "Filename Patterns" { layout = Vertical + margin = 0 + expandX = yes + Horizontal { + Field include { + } + CheckBox includeRegExp { + title = "Regular expression" + expandX = no + } + } + Horizontal { + alignX = left + Label { + title = "Set Pattern:" + expandX = no + } + ButtonBar predefined { + expandX = no + show = All + direction = horizontal + items { + item All { title = "All Files" } + item Images {} + item Dicom {} + } + } + } + Horizontal { + Field exclude { alignGroup = ag1 } + CheckBox excludeRegExp { + title = "Regular Expression" + expandX = no + } + } + Horizontal { + CheckBox ignoreCase { title = "Ignore Case" } + Horizontal { + alignX = Right + Button FileDirectory.update {} + } + } + } // Box "Filename Patterns" + } + Vertical "List" { + tooltip = "You can also connect an external list to the Files label" + FieldLabel externalList { title = "Files:" } + TextView fileList { + tooltip = "Be carefull with the line numbers! Subtract 1 for the index number!" + title = "" + autoApply = Yes + showLineNumbers = Yes + vscroller = Auto + hscroller = Auto + } + } + Vertical Name { + Box "User String Template Variables" { + layout = Vertical + Field userStringS { title = "User String $S:" alignGroupX = nameC1 } + Field userStringT { title = "User String $T:" alignGroupX = nameC1 } + } + Box "Output Template" { layout = Vertical + tooltip = "* + <table cellpadding=0 cellspacing=0 border=0> + <tr><td colspan=3><b>Output template variables:</b></td></tr> + <tr><td><tt>$n</tt></td><td>-</td><td>Complete input name</td></tr> + <tr><td><tt>$f</tt></td><td>-</td><td>Filename portion of input name</td></tr> + <tr><td><tt>$d</tt></td><td>-</td><td>Directory portion of input name</td></tr> + <tr><td><tt>$e</tt></td><td>-</td> + <td>Extension of input name, as defined in extensions field</td></tr> + <tr><td><tt>$b</tt></td><td>-</td> + <td>Basename portion of input name, i.e. filename without extension</td></tr> + <tr></tr> + + <tr><td><tt>$S/T</tt></td><td>-</td><td>User string <tt>S/T</tt></td></tr> + <tr></tr> + <tr><td><tt>$#</tt></td><td>-</td><td>Filename counter value</td></tr> + <tr><td colspan=3><b>Filename counter formatting:</b></td></tr> + <tr><td>$n#</td><td>-</td><td>Use a minimum of n digits, padded with zeros.<br> + Counter is zero-based if n starts with 0, otherwise one-based.</td></tr> + </table> + <b>Directory Macros:</b><br> + Common ILAB directory macros can be used in both <b>Input Name</b> and + <b>Output Template</b> fields, e.g.<br> + <table cellpadding=0 cellspacing=0 border=0> + <tr><td><tt>$<b></b>(NETWORK)</tt></td><td>-</td> + <td>Directory containing the network document</td></tr> + <tr><td><tt>$<b></b>(HOME)</tt></td><td>-</td> + <td>User's home directory</td></tr> + </table> + *" + Field outputTemplate { + title = "Template:" + alignGroupX = nameC1 + } + Horizontal { + Field = MakeName.extensions { + alignGroupX = nameC1 + } + CheckBox MakeName.extRegExp { + expandX = no + title = "Regular Expression" + } + } + Horizontal { + alignX = left + Label { + expandX = no + title = "Set Pattern:" + alignGroupX = nameC1 + } + ButtonBar MakeName.predefined { + expandX = no + show = all + direction = horizontal + items { + item All { title = "All Files" } + item Images {} + item Dicom {} + } + } + FieldListener MakeName.predefined { + command = "*py:ctx.field("MakeName.extensions").value={'All':'.*','Images':'\\.di?co?m \\.dic \\.tiff? \\.hdr \\.img \\.ima \\.raw \\.p[gpn]m \\.png \\.jpe?g','Dicom':'.dcm .dic .dicom'}[ctx.field('MakeName.predefined').value] *" + } + FieldListener MakeName.predefined { + command = "*py:ctx.field("MakeName.extRegExp").value={'All':False,'Images':True,'Dicom':False}[ctx.field('MakeName.predefined').value]*" + } + } + } + Box "Output Name" { + layout = Horizontal + Field outputName { title = "Name:" alignGroupX = nameC1 } + Button MakeName.update {} + } + } + + Vertical Output { + CheckBox enableOutput {} + Vertical { + alignY = Top + dependsOn = enableOutput + CheckBox LoadAny.analyzeHeader{ + title = "Use Header Analysis" + tooltip = "Enables a heuristic to identify file formats correctly, e.g. if no or only a number is available as file extensions" + } + CheckBox LoadAny.allowBioFormats { + title = "Allow BioFormatsLoad" + tooltip = "If this flag is on and the module exists then the BioFormatsLoad module is also used for data loading" + } + Field LoadAny.loaderName { + title = "Loader:" + tooltip = "Module used to open the file" + edit = No + } + Field LoadAny.writerNames { + title = "Writers:" + tooltip = "Module(s) which could be used to save the file" + edit = No + } + Field LoadAny.formatInfo { + tooltip = "Shows information about the format of the opened file" + edit = No + } + Field LoadAny.shortFileHeader { + title = "Short Header:" + tooltip = "First 48 (or less if null-chars are found) characters from the file." + edit = No + } + TextView LoadAny.status { + tooltip = "Shows general information, notes, errors etc. about the load process" + edit = No + console = Yes + visibleRows = 3 + expandY = Yes + } + } + } + EventFilter { + filter = KeyPress + control = mainWindow + command = "*py:if ( args[0]['key'] == 'D' and args[0]['ctrlKey']): ctx.showWindow('Debug')*" + } +} + +Window Debug { + TabView { + TabViewItem FileDirectory { + Panel { module = FileDirectory } + } + TabViewItem FieldIterator { + Panel { module = FieldIterator } + } + TabViewItem FileInformation { + Panel { module = FileInformation } + } + TabViewItem MakeName { + Panel { module = MakeName } + } + TabViewItem LoadAny { + Panel { module = LoadAny } + } + } + +} + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:45:26 +//# hash: AjNnlaLECriO9N+6KUWXSpSd3Zumzkz+0GuZrH5v9At2vtI3GMwGF4Fo21O0zzE7zIbQD0/hEIh+B17bHmUlbw== +//# MeVis end Added: trunk/Community/General/Modules/Macros/FileIO/html/FileIterator.html =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/html/FileIterator.html (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/html/FileIterator.html 2010-03-05 15:52:47 UTC (rev 239) @@ -0,0 +1,45 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>FileIterator</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module is simply a combination of the following modules: FileDirectory, FileInformation, FieldIterator, MakeName and LoadAny. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Use the Selection tab to select the files or connect an external list to the Files field in the List tab and use the Iterate tab to loop over the list. Additionally a new name can be created on the Name tab and the file can automatically be read if the EnableOutput field is selected on the Output tab +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Beware that the shown line numbers in the List tab start with 1, whereas the iterator starts with 0. This is due to a limitation of the ListView control. +</blockquote> + + + + + + + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>The example network show a loop over the MeVisLab demo data dir. +</blockquote> + + + + + +</body> +</html> Added: trunk/Community/General/Modules/Macros/FileIO/networks/FileIteratorExample.mlab =================================================================== --- trunk/Community/General/Modules/Macros/FileIO/networks/FileIteratorExample.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/FileIO/networks/FileIteratorExample.mlab 2010-03-05 15:52:47 UTC (rev 239) @@ -0,0 +1,198 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module View2D { + internal { + frame = "-55 -179 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "146 274 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = FALSE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 1 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 197.9167023 + lutWidth = 495.0903015 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0.9973145127296448 -0.07323814928531647 -55.70792007446289" + } + internalFields = "" +} +module FileIterator { + internal { + frame = "-51 -27 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "530 479 549 401" + sizeHint = "505 408" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FileIterator + enableOutput = TRUE + rootPath = $(DemoDataPath) + recursive = FALSE + maxRecursionDepth = -1 + fileType = Files + joinImagePairs = FALSE + include = ".*\\.di?co?m .*\\.dic .*\\.tiff? .*\\.hdr .*\\.img .*\\.ima .*\\.raw .*\\.p[gpn]m" + includeRegExp = TRUE + predefined = Images + exclude = "" + excludeRegExp = FALSE + ignoreCase = TRUE + dirMode = Absolute + fieldNames = "" + fieldValues = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Abdomen1_MRA.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Abdomen1_MRA.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Carotid1_MRA.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Carotid1_MRA.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.contour.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.contour.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/DTISubImg.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/DTISubImg.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dualecho.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dualecho.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dwi.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dwi.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head4_t1.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head4_t1.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Leg1_MRA_fl3d_US.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Leg1_MRA_fl3d_US.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.tumorMask.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.tumorMask.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_LiverMask.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_LiverMask.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_MRT_venous.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_MRT_venous.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/LungNodule.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/LungNodule.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Lymphnode.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Lymphnode.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Pat6.jrjr.Segmente.tiff +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/PIDunknown.134x124x46.roi.ul.tiff +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture_tags.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture_tags.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Thorax1_CT.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Thorax1_CT.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Tumor1_Head_t1.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Tumor1_Head_t1.small.tif" + fileList = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Abdomen1_MRA.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Abdomen1_MRA.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Carotid1_MRA.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Carotid1_MRA.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.contour.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.contour.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/DTISubImg.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/DTISubImg.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dualecho.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dualecho.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dwi.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dwi.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head4_t1.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head4_t1.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Leg1_MRA_fl3d_US.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Leg1_MRA_fl3d_US.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.tumorMask.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver1_CT_venous.small.tumorMask.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_LiverMask.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_LiverMask.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_MRT_venous.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Liver2_MRT_venous.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/LungNodule.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/LungNodule.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Lymphnode.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Lymphnode.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Pat6.jrjr.Segmente.tiff +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/PIDunknown.134x124x46.roi.ul.tiff +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture_tags.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Shoulder_Fracture_tags.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Thorax1_CT.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Thorax1_CT.small.tif +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Tumor1_Head_t1.small.dcm +C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Tumor1_Head_t1.small.tif" + externalList = "" + numValues = 41 + indexTranslation = 0 + curIndex = 0 + curValue = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Abdomen1_MRA.small.dcm" + newValueEnable = FALSE + verbose = FALSE + delay = 1 + loop = FALSE + running = FALSE + autoReset = FALSE + dirname = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/" + filename = Abdomen1_MRA.small.dcm + basename = Abdomen1_MRA.small + extension = .dcm + outputTemplate = "" + outputName = "" + userStringS = "" + userStringT = "" + trimSpaces = TRUE + } + internalFields = "" +} +connections { + View2D.inImage = FileIterator.outImage +} +networkModel = "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-05 15:49:56
|
Revision: 238 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=238&view=rev Author: rhameeteman Date: 2010-03-05 15:49:50 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added module: PythonExec Added Paths: ----------- trunk/Community/General/Modules/Macros/Command/PythonExec.def trunk/Community/General/Modules/Macros/Command/PythonExec.py trunk/Community/General/Modules/Macros/Command/PythonExec.script trunk/Community/General/Modules/Macros/Command/html/PythonExec.html trunk/Community/General/Modules/Macros/Command/networks/ trunk/Community/General/Modules/Macros/Command/networks/PythonExecExample.mlab Added: trunk/Community/General/Modules/Macros/Command/PythonExec.def =================================================================== --- trunk/Community/General/Modules/Macros/Command/PythonExec.def (rev 0) +++ trunk/Community/General/Modules/Macros/Command/PythonExec.def 2010-03-05 15:49:50 UTC (rev 238) @@ -0,0 +1,59 @@ +//---------------------------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------------------------- +//! PythonExec module definition +/*! +// \file PythonExec.def +// \author Reinhard Hameeteman +// \date 2008-08-01 +*/ +//---------------------------------------------------------------------------------- + +MacroModule PythonExec { + documentation = "$(LOCAL)/html/PythonExec.html" + group = "BIGR" + genre = "BIGR-Utils" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Run a python exec command" + keywords = "Run python execute command" + seeAlso = "RunCommand" + + externalDefinition = "$(LOCAL)/PythonExec.script" + exampleNetwork = "$(LOCAL)/networks/PythonExecExample.mlab" + scriptOnly = yes + +} // MacroModule PythonExec + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:43:44 +//# hash: kDj7mPBYFe7FDQcsLu3Kfkk2qX8/mG5ly0NmkoeNRlhfsxnhjZPQtMUz85BaCIhG2recG9W2c0Bs5T6XWNdc7Q== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Command/PythonExec.py =================================================================== --- trunk/Community/General/Modules/Macros/Command/PythonExec.py (rev 0) +++ trunk/Community/General/Modules/Macros/Command/PythonExec.py 2010-03-05 15:49:50 UTC (rev 238) @@ -0,0 +1,94 @@ +#---------------------------------------------------------------------------------- +# +# 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 PythonExec +#/*! +# \file PythonExec.py +# \author Reinhard Hameeteman +# \date 2008-08-01 +# +# Run a python exec command +#*/ +#---------------------------------------------------------------------------------- + +from mevis import * + +def Run( field = None): + if ( field != ctx.field("run") and not ctx.field('onArgChange').boolValue() ) : return + command = ctx.field("command").value + arg1 = ctx.field("arg1").stringValue() + arg2 = ctx.field("arg2").stringValue() + arg3 = ctx.field("arg3").stringValue() + command = command.replace("$1$", "\'" + arg1 + "\'") + command = command.replace("$2$", "\'" + arg2 + "\'") + command = command.replace("$3$", "\'" + arg3 + "\'") + result1 = None + result2 = None + command = command.replace("%1%", "result1") + command = command.replace("%2%", "result2") + command = command.strip(' ') + ctx.field("comString").value = command + command += '\n' + exec( command ) + + if result1 != None : + ctx.field("result1").value = str(result1) + else : + ctx.field("result1").value = "" + + if result2 != None : + ctx.field("result2").value = str(result2) + else : + ctx.field("result2").value = "" + return + +def FieldDroped( object ) : + command = ctx.field("command").value + if ( ( object.owner().fullName().find( 'FieldIterator' ) != -1 or + object.owner().fullName().find( 'FileIterator' ) != -1 ) and + object.name == 'newValue' ) : + moduleName = object.owner().name + command += "\nfor i"+moduleName+" in range( nw.field('" + moduleName+".numValues').value ) :" + command += "\n if MLAB.shouldStop() : break" + command += "\n nw.field('"+moduleName+".curIndex').value = i"+moduleName + command += "\n print nw.field('"+moduleName+".curValue').stringValue()" + else: + if object.getType() == 'Trigger' : + command += "\nnw.field('" + object.fullName() + "').touch()" + else : + command += "\nnw.field('" + object.fullName() + "').value" + ctx.field("command").value = command + return + + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +#//# owner: EMC +#//# date: 2010-03-02T15:43:17 +#//# hash: NtsQwmIoHApwmvZwjf01gFGP/xf2e2MV4HIASngxqixLl7/lxZxlYnIYRFE/zrNHt4RTV4gTRbF0r+waZ58irw== +#//# MeVis end Added: trunk/Community/General/Modules/Macros/Command/PythonExec.script =================================================================== --- trunk/Community/General/Modules/Macros/Command/PythonExec.script (rev 0) +++ trunk/Community/General/Modules/Macros/Command/PythonExec.script 2010-03-05 15:49:50 UTC (rev 238) @@ -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 PythonExec +/*! +// \file PythonExec.script +// \author Reinhard Hameeteman +// \date 2008-08-01 +// +// Run a python exec command +*/ +//---------------------------------------------------------------------------------- + + +Interface { + Inputs {} + Outputs {} + Parameters { + Field command { type = string value = "nw = ctx.parent()" } + Field arg1 { type = string value = "" } + Field arg2 { type = string value = "" } + Field arg3 { type = string value = "" } + Field run { type = trigger } + Field onArgChange { type = bool value = false } + Field result1 { type = string value = "" } + Field result2 { type = string value = "" } + Field comString { type = string value = "" } + } +} + + +Commands { + source = $(LOCAL)/PythonExec.py + FieldListener { + listenField = run + listenField = arg1 + listenField = arg2 + listenField = arg3 + command = Run + } +} + +Window { + Vertical { + expandY = Yes + expandY = Yes + TabView { + expandY = Yes + TabViewItem Edit { + expandY = Yes + frameShape = NoFrame + frameShadow = Plain + TextView command { + autoApply = Yes + title = "" + droppedObjectCommand = FieldDroped + syntaxHighlighting = Python + showLineNumbers = Yes + tooltip = "Drop any field on this window +and it will be added as nw.field(<fieldName>).value +Trigger fields are added as nw.field(<fieldName>).touch() +FieldIterator.newValue and FileIterator.newValue and will +add a loop over all values of the iterator." + } + } + TabViewItem Args { + Field arg1 { title = "Arg1 ($1$):"} + Field arg2 { title = "Arg2 ($2$):"} + Field arg3 { title = "Arg3 ($3$):"} + Field result1 { title = "Result1 (%1%):" } + Field result2 { title = "Result2 (%2%):" } + } + TabViewItem Executed { + expandY = Yes + frameShape = NoFrame + frameShadow = Plain + TextView comString { edit = No title = "" } + } + } + Horizontal { + alignX = Left + FieldLabel run {} + Button run {} + CheckBox onArgChange { title = "Listen to Arg changes" } + } + } +} + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:44:14 +//# hash: gBsc339guXrCCCq3h0RrOrZoUGFuc3Bw1G6Fs/CzP2jvX5Egl3fedwHrYoZBpwtuHYttOu3p5j0b6OUbZeYNxg== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Command/html/PythonExec.html =================================================================== --- trunk/Community/General/Modules/Macros/Command/html/PythonExec.html (rev 0) +++ trunk/Community/General/Modules/Macros/Command/html/PythonExec.html 2010-03-05 15:49:50 UTC (rev 238) @@ -0,0 +1,118 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#Parameters">Parameters</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2>PythonExec</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This macro enables you to run some python code from within the network. So you don't have to write a seperate script file. If you have more extensive code it's bad practice to use this module for that. + + +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote> + Simply write the python code you want to execute in the box on the Edit tab and press Run. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote> + On pressing Run this module wil call the Python exec() function with the specified command. + It is possible to supply the command with several arguments. This is done by replacing the + all occurences of $1$ in the given command by the string of the Arg1 field (and vice versa + for $2$ and $3$), i.e. if Arg1 has the value 2.0 $1 will be replaced by '2.0' (including the + quotes). So if you want the float value, you have to use float($1$).<br/><br/> + + Returning values is done in a similar maner: All occurences of %1% are returned to result1 and + similar holds for %2%.<br/><br/> + + If you add nw = ctx.parent() to the command, you can use it just like the network attached + python file except that you have to use nw. in stead of ctx. So the following command:<br/><br/> + nw = ctx.parent() <br/> + print nw.field('PythonExec.command').value<br/> + <br/> + will print the command itself when Run is pressed. <br/> + + Since you have access to all network fields from within the command, you can also directly get arguments from the network or modify fields, e.g. :<br/> + nw = ctx.parent()<br/> + nw.field('PythonExec.result1').value = 'Directly modified by PythonExec'<br/><br/> + + To use a field from your network, you can simply drag and drop it on the command box. This will add a new line with the statement:<br/><br/> + nw.field([fieldName]).value<br/><br/> + Or if you drop a trigger field:<br/><br/> + nw.field([fieldName]).touch()<br/><br/> + If you drop the newValue field of a FieldIterator the following lines are added<br/><br/> + for i<ModuleName> in range( nw.field('[ModuleName].numValues').value ) :<br/> +   nw.field('[ModuleName].curIndex').value = i<ModuleName><br/> +   print nw.field('[ModuleName].curValue').stringValue()<br/><br/> + This makes it easy to create a loop over all iterator values and perform some operations in between the iterations. This also + holds for the FileIterator module. +</blockquote> + + + + + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>command</b> + The command(s) that should be executed + </li> + <li> + <b>arg1</b> + argument1 + </li> + <li> + <b>arg2</b> + argument2 + </li> + <li> + <b>arg3</b> + argument1 + </li> + <li> + <b>run</b> + Execute the command + </li> + <li> + <b>onArgChange</b> + React to argument changes + </li> + <li> + <b>result1</b> + result1 + </li> + <li> + <b>result2</b> + result2 + </li> + <li> + <b>comString</b> + Command as it is executes after replacing the argument strings + </li> + </ul> + +</blockquote> + + + +<h3><a NAME=Example></a>Example</h3> +<blockquote>The example shows how to get a string with all mean slice values of an image. +</blockquote> + + + + + +</body> +</html> Added: trunk/Community/General/Modules/Macros/Command/networks/PythonExecExample.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Command/networks/PythonExecExample.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/Command/networks/PythonExecExample.mlab 2010-03-05 15:49:50 UTC (rev 238) @@ -0,0 +1,307 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module Diagram2D { + internal { + frame = "393 -83 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "429 246 444 576" + sizeHint = "444 576" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 63 + autoRangeX = TRUE + minY = 259.3625488 + maxY = 956.9255371 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = FALSE + diagramTitleString = "" + borderH = 33 + autoBorderH = TRUE + borderV = 25 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 1 1" + lineStyle = Solid + markerType = None + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = 0 + mousePosY = 0 + mousePosValid = FALSE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = FALSE + } +} +module Range { + internal { + frame = "197 13 72 56" + moduleGroupName = "" + windows { + window _default { + geometry = "370 587 442 108" + sizeHint = "442 108" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Range + start = 0 + step = 1 + end = 64 + middle = 32 + relative = TRUE + integer = TRUE + range = "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63" + separator = " " + } + internalFields = "" +} +module StringToCurve { + internal { + frame = "385 13 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "547 145 336 91" + sizeHint = "336 91" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StringToCurve + curveString = "955.176513671875 956.925537109375 950.982421875 945.0361328125 937.6103515625 930.153564453125 928.977783203125 927.785888671875 930.303955078125 932.82763671875 930.53369140625 928.241455078125 921.0595703125 913.87939453125 908.54541015625 903.200927734375 900.691650390625 898.159423828125 894.191650390625 890.198974609375 887.007080078125 883.803955078125 889.07373046875 894.328857421875 895.89501953125 897.44189453125 889.763671875 882.036865234375 861.442626953125 840.826171875 815.659912109375 790.4619140625 766.968505859375 743.43701171875 722.00341796875 700.532958984375 678.9228515625 657.30078125 634.110107421875 610.89306640625 583.388671875 555.8486328125 533.311279296875 510.740234375 493.096923828125 475.440185546875 458.28515625 441.1123046875 425.444091796875 409.766357421875 398.38330078125 386.984375 382.2021484375 377.4267578125 379.9697265625 382.510986328125 390.544189453125 398.563232421875 411.876953125 425.189697265625 431.133544921875 437.060791015625 451.616455078125 466.14697265625;272.7990397491574 283.8545863641376 272.3791245321892 279.1414014710544 263.7289910831796 266.4359690780305 259.362553312208 269.5667800283241 267.6955082221714 284.598780760108 280.1051892727626 294.3791024697958 284.8654458049222 295.358745225483 290.1756099821293 301.9886273467234 291.5073869865938 300.8481250698702 286.9688511021999 290.2143382206303 274.5096615502168 276.5771776256615 281.0959989374742 296.8163461681954 303.4052528588923 324.908433487996 335.3475252549168 359.5073224288191 359.3990794295823 372.4886028804017 375.4592301679794 394.0436412671822 405.9883380490239 432.5663925267374 438.0389415040961 456.0712118930458 459.9532703400227 477.6332635160285 481.6912541328434 498.5441072782352 498.1433134560727 513.1120630938154 510.5358888481086 522.9258598020032 521.3463486663181 530.0275223451472 523.970112332007 527.1428255880454 521.3861615676448 524.5665941500482 517.2068947434404 515.3059550892337 505.8328353265814 500.1320719409691 500.221782374506 504.181115466524 509.8897460372884 521.5081804971718 533.3928881548361 553.8302247551263 554.7669851409909 560.9413668651749 557.3313547055786 568.0660973602244" + indexString = "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63" + valueSeparator = " " + curveSeparator = ; + } +} +module Comment { + internal { + frame = "173 277 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "515 430 256 209" + sizeHint = "256 209" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Comment + comment = "Press run in the PythonExec module to start a loop over all slices. The result is then returned in the second tab, which is a list of all mean slice values of the image and all standard deviations. +This string is converted to two Curves using StringToCurve" + } + internalFields = "" +} +module ImageStatistics { + internal { + frame = "525 113 120 64" + moduleGroupName = "" + windows { + window _default { + geometry = "506 122 449 586" + sizeHint = "487 586" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ImageStat + innerMin = 0 + innerMax = 1 + autoUpdate = TRUE + perSlice = TRUE + currentSlice = 63 + resultsValid = TRUE + voxelsOutOfRange = 0 + useMask = FALSE + maskStatus = "" + } +} +module Info { + internal { + frame = "309 117 56 56" + moduleGroupName = "" + windows { + window _default { + geometry = "867 488 564 371" + sizeHint = "564 371" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Info + pagedImgInfo = Ok + bypassIndex = -1 + inPlaceIndex = -1 + } +} +module View2D { + internal { + frame = "409 117 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "695 214 200 200" + sizeHint = "200 200" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = FALSE + view2DExtensionsOn = TRUE + startSlice = 63 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 2047.5 + lutWidth = 4095 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 63.5" + } + internalFields = "" +} +module LocalImage { + internal { + frame = "401 285 96 56" + moduleGroupName = "" + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module PythonExec { + internal { + frame = "177 117 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "100 495 572 340" + sizeHint = "301 263" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = PythonExec + command = "*nw = ctx.parent() +mean = '' +stddev = '' +for i in range( int($1$) ) : + nw.field('View2D.startSlice').value = i + mean += nw.field("ImageStat.totalMean").stringValue() + ' ' + stddev += nw.field('ImageStat.totalStdDev').stringValue() + ' ' + MLAB.processInventorQueue() +%1% = mean.strip() + ';' + stddev.strip() +*" + arg1 = 64 + arg2 = "" + arg3 = "" + onArgChange = FALSE + result1 = "955.176513671875 956.925537109375 950.982421875 945.0361328125 937.6103515625 930.153564453125 928.977783203125 927.785888671875 930.303955078125 932.82763671875 930.53369140625 928.241455078125 921.0595703125 913.87939453125 908.54541015625 903.200927734375 900.691650390625 898.159423828125 894.191650390625 890.198974609375 887.007080078125 883.803955078125 889.07373046875 894.328857421875 895.89501953125 897.44189453125 889.763671875 882.036865234375 861.442626953125 840.826171875 815.659912109375 790.4619140625 766.968505859375 743.43701171875 722.00341796875 700.532958984375 678.9228515625 657.30078125 634.110107421875 610.89306640625 583.388671875 555.8486328125 533.311279296875 510.740234375 493.096923828125 475.440185546875 458.28515625 441.1123046875 425.444091796875 409.766357421875 398.38330078125 386.984375 382.2021484375 377.4267578125 379.9697265625 382.510986328125 390.544189453125 398.563232421875 411.876953125 425.189697265625 431.133544921875 437.060791015625 451.616455078125 466.14697265625;272.7990397491574 283.8545863641376 272.3791245321892 279.1414014710544 263.7289910831796 266.4359690780305 259.362553312208 269.5667800283241 267.6955082221714 284.598780760108 280.1051892727626 294.3791024697958 284.8654458049222 295.358745225483 290.1756099821293 301.9886273467234 291.5073869865938 300.8481250698702 286.9688511021999 290.2143382206303 274.5096615502168 276.5771776256615 281.0959989374742 296.8163461681954 303.4052528588923 324.908433487996 335.3475252549168 359.5073224288191 359.3990794295823 372.4886028804017 375.4592301679794 394.0436412671822 405.9883380490239 432.5663925267374 438.0389415040961 456.0712118930458 459.9532703400227 477.6332635160285 481.6912541328434 498.5441072782352 498.1433134560727 513.1120630938154 510.5358888481086 522.9258598020032 521.3463486663181 530.0275223451472 523.970112332007 527.1428255880454 521.3861615676448 524.5665941500482 517.2068947434404 515.3059550892337 505.8328353265814 500.1320719409691 500.221782374506 504.181115466524 509.8897460372884 521.5081804971718 533.3928881548361 553.8302247551263 554.7669851409909 560.9413668651749 557.3313547055786 568.0660973602244" + result2 = "" + comString = "*nw = ctx.parent() +mean = '' +stddev = '' +for i in range( int('64') ) : + nw.field('View2D.startSlice').value = i + mean += nw.field("ImageStat.totalMean").stringValue() + ' ' + stddev += nw.field('ImageStat.totalStdDev').stringValue() + ' ' + MLAB.processInventorQueue() +result1 = mean.strip() + ';' + stddev.strip() +*" + } + internalFields = "" +} +connections { + Diagram2D.inCurveList = StringToCurve.outCurveList + Range.end = Info.sizeZ + StringToCurve.curveString = PythonExec.result1 + StringToCurve.indexString = Range.range + ImageStat.input0 = LocalImage.outImage + ImageStat.currentSlice = View2D.startSlice + Info.input0 = LocalImage.outImage + View2D.inImage = LocalImage.outImage + PythonExec.arg1 = Info.sizeZ +} +networkModel = "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-05 15:47:52
|
Revision: 237 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=237&view=rev Author: rhameeteman Date: 2010-03-05 15:47:46 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Rename of directory in order to put in some more modules Added Paths: ----------- trunk/Community/General/Modules/Macros/Command/ Removed Paths: ------------- trunk/Community/General/Modules/Macros/CommandBox/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-05 14:58:55
|
Revision: 236 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=236&view=rev Author: rhameeteman Date: 2010-03-05 14:58:48 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added Fields modules: FieldTrigger FieldWriter SetReSet * Added Strings module: FormatFloat Added Paths: ----------- trunk/Community/General/Modules/Macros/Fields/ trunk/Community/General/Modules/Macros/Fields/FieldTrigger.def trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py trunk/Community/General/Modules/Macros/Fields/FieldTrigger.script trunk/Community/General/Modules/Macros/Fields/FieldWriter.def trunk/Community/General/Modules/Macros/Fields/FieldWriter.mlab trunk/Community/General/Modules/Macros/Fields/FieldWriter.py trunk/Community/General/Modules/Macros/Fields/FieldWriter.script trunk/Community/General/Modules/Macros/Fields/SetReSet.def trunk/Community/General/Modules/Macros/Fields/SetReSet.py trunk/Community/General/Modules/Macros/Fields/SetReSet.script trunk/Community/General/Modules/Macros/Fields/html/ trunk/Community/General/Modules/Macros/Fields/html/FieldTrigger.html trunk/Community/General/Modules/Macros/Fields/html/FieldWriter.html trunk/Community/General/Modules/Macros/Fields/html/SetReSet.html trunk/Community/General/Modules/Macros/Fields/networks/ trunk/Community/General/Modules/Macros/Fields/networks/FieldTriggerExample.mlab trunk/Community/General/Modules/Macros/Strings/ trunk/Community/General/Modules/Macros/Strings/FormatFloat.def trunk/Community/General/Modules/Macros/Strings/FormatFloat.py trunk/Community/General/Modules/Macros/Strings/FormatFloat.script trunk/Community/General/Modules/Macros/Strings/html/ trunk/Community/General/Modules/Macros/Strings/html/FormatFloat.html trunk/Community/General/Modules/Macros/Strings/networks/ trunk/Community/General/Modules/Macros/Strings/networks/FormatFloatExample.mlab Added: trunk/Community/General/Modules/Macros/Fields/FieldTrigger.def =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldTrigger.def (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/FieldTrigger.def 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,31 @@ +//---------------------------------------------------------------------------------- +//! FieldTrigger module definition +/*! +// \file FieldTrigger.def +// \author Reinhard Hameeteman +// \date 2007-05-01 +// +*/ +//---------------------------------------------------------------------------------- + +MacroModule FieldTrigger { + genre = "Fields" + author = "Reinhard Hameeteman" + group = BIGR + status = "work-in-progress" + comment = "Triggers trigger fields of a network in a user specified order" + keywords = "Trigger button push script touch" + seeAlso = "" + + externalDefinition = "$(LOCAL)/FieldTrigger.script" + scriptOnly = yes + +} // MacroModule FieldTrigger + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-03T14:51:36 +//# hash: ADkpvGoQSMQ0PCLQs6//i2ClVVJ25U2s6atAiBM3p4SmWGmu/8P2WH+jp60VrEJ2YpglD1oggz+B1xPFok9FoQ== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/FieldTrigger.py 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,191 @@ +#---------------------------------------------------------------------------------- +# +# 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. +# +#---------------------------------------------------------------------------------- +# +# | +# | +# | +# | Description: +# | Python methods for FieldTrigger.script +# | +# | +# | Author(s) : Reinhard Hameeteman +# | Creation date : 05/2007 +# | +#---------------------------------------------------------------------------------- + +# Python module import +from mevis import * + +def WindowWakeup(): + BuildModuleTreeView() + return + +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() ) + ctx.field('moduleList').value = ','.join(moduleList) + return + +def BuildModuleTreeView( field = None ): + UpdateModuleList() + fieldTreeView = ctx.control("fieldListBox"); + fieldTreeView.clearItems(); + + # insert dummy object + rootItem = fieldTreeView.insertItem("") + + fieldTreeView.setSorting(0, True); #sort by Module + fieldTreeView.setRootIsDecorated( True ) + + modules = ctx.field("moduleList").value.split(',') + network = ctx.parent() + for module in modules : + moduleItem = fieldTreeView.insertItem(rootItem, module); + moduleItem.setText(0, module) + fieldTreeView.ensureItemVisible(moduleItem); + # Prevent error when this is the only module + if network.hasModule( module ) : + currentModule = network.module( module ) + + # insert fields as child of modules + fields = currentModule.parameters() + for iField in fields : + if ( currentModule.field( iField ).getType() == 'Trigger' or + ctx.field('allFields').boolValue() ) : + fieldItem = fieldTreeView.insertItem(moduleItem, moduleItem, iField) + fieldItem.setText(0, iField) + + # remove the dummy + fieldTreeView.removeItem( rootItem ) + return + +def AddFields( item = None ): + fieldTreeView = ctx.control("fieldListBox"); + selectedFieldsTreeView = ctx.control("selectedFieldsView"); + selectedFields = ctx.field('selectedFields') + + sfs = selectedFields.value.split(','); + sfids = selectedFieldsTreeView.selectedItemIds(); + insertpos = 0; + if len(sfids) > 0: + insertpos = sfids[0]; + else: + if len(sfs) > 0: + insertpos = len(sfs) - 1; + + output = '' + for i in range(0,len(sfs)): + output += sfs[i] + ","; + if i == insertpos: + for field in fieldTreeView.selectedItemIds() : + selectedItem = fieldTreeView.itemForId( field ) + fieldName = str( selectedItem.text(0) ) + if selectedItem.parent(): + moduleName = str( selectedItem.parent().text(0) ) + output += moduleName + '.' + fieldName + "," + + selectedFields.value = output.rstrip(","); + return output; + +def FieldDroped( object ) : + fieldName = object.fullName() + # Don't allow this module to be triggered + if ( fieldName.find( ctx.field('instanceName').value ) == -1 and + ( ctx.field( 'parent:'+fieldName ).getType() == 'Trigger' or + ctx.field('allFields').boolValue() ) ) : + ctx.field('selectedFields').value += ',' + fieldName + return + +def DeleteFields( field = None ): + listView = ctx.control('selectedFieldsView') + newString = ctx.field('selectedFields').value + for iId in listView.selectedItemIds() : + item = listView.itemForId( iId ) + module = item.text(0) + field = item.text(1) + fieldString = ',' + module + '.' + field + newString = newString.replace(fieldString,'') + ctx.field('selectedFields').value = newString + return + +def KeyPressed( event=None ): + if event['key']=='Up' and event['shiftKey'] : + MoveItemUp() + elif event['key']=='Down' and event['shiftKey'] : + MoveItemDown() + return + +def MoveItemUp() : + selectedFields = ctx.field("selectedFields").stringValue().split(',') + listView = ctx.control('selectedFieldsView') + currentItem = '.'.join( listView.currentItem().texts() ) + currentItemIdx = selectedFields.index( currentItem ) + if currentItemIdx > 1 : + selectedFields.remove( currentItem ) + selectedFields.insert( currentItemIdx-1, currentItem ) + ctx.field("selectedFields").value = ','.join( selectedFields ) + return + +def MoveItemDown() : + selectedFields = ctx.field("selectedFields").stringValue().split(',') + listView = ctx.control('selectedFieldsView') + currentItem = '.'.join( listView.currentItem().texts() ) + currentItemIdx = selectedFields.index( currentItem ) + if currentItemIdx < len( selectedFields )-1 : + selectedFields.remove( currentItem ) + selectedFields.insert( currentItemIdx+1, currentItem ) + ctx.field("selectedFields").value = ','.join( selectedFields ) + return + +def TriggerFields( arg ): + network = ctx.parent() + fieldList = ctx.field('selectedFields').value.split(',') + sleep = ctx.field("sleep").intValue() + eachIter = ctx.field("sleepEachStep").boolValue() + for iRepetition in range( ctx.field('repetition').value ): + ctx.field("currentIteration").value=iRepetition + for iField in fieldList[1:] : + if (MLAB.shouldStop() ) : + break + ctx.field('parent:'+iField).touch() + MLAB.processEvents() + MLAB.processInventorQueue() + if eachIter : MLAB.sleep(sleep) + MLAB.processEvents() + MLAB.processInventorQueue() + MLAB.sleep(sleep) + return + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +#//# owner: EMC +#//# date: 2010-03-03T14:51:40 +#//# hash: coVMpF1OpLnh/Aq1AXmPuWl4n/kpEa2aLF1QJq5AOncdkqez6UhJXMrSPyy97eIAOYYnAAagI3NevWdPsmaM6w== +#//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/FieldTrigger.script =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldTrigger.script (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/FieldTrigger.script 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,159 @@ +//---------------------------------------------------------------------------------- +// +// 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 FieldTrigger +/*! +// \file FieldTrigger.script +// \author Reinhard Hameeteman +// \date 2007-05-01 +// +// // Triggers trigger fields of a network in a user specified order +*/ +//---------------------------------------------------------------------------------- + + +Interface { + Inputs {} + + Parameters { + Field moduleList { type = string value = " " } + Field selectedModule { type = string values = "" } + Field fieldList { type = string value = "Fields"} + Field allFields { type = bool value = false } + Field selectedFields { type = string value = "Module.Field" } + Field start { type = trigger } + Field stop { type = trigger } + Field sleep { type = int } + Field sleepEachStep { type = bool value = False } + Field repetition { type = int value = 1 } + Field currentIteration { type = int value = 0 } + } +} // Interface + + +Commands { + source = "$(LOCAL)/FieldTrigger.py" + FieldListener start { command = TriggerFields } +} + + +Window { + w = 600 + Vertical { + expandY = yes + margin = 5 + Horizontal { + alignX = left + Button start { title = "&Start" } + Button stop { title = "&Stop" globalStop = yes } + } + Horizontal { Field sleep { alignGroup = g1 } CheckBox sleepEachStep { title = "After each trigger" } } + Horizontal { + Field repetition { title = "Repeat" alignGroup = g1} + Label {title = times } + } + Field currentIteration { edit=False alignGroup = g1 } + Field allFields { + tooltip = "If not checked, only Trigger fields are allowed" + } + + FieldListener allFields { command = BuildModuleTreeView } + + Horizontal { + margin = 0 + expandY = yes + + // Module and Field selection + Vertical { + margin = 0 + expandY = yes + ListView { + name = fieldListBox + values = "Select fields" + resizeMode = last + sortByColumn = 0 + visibleRows = 10 + layout = "tl,l" + richText = true + selectionMode = extended + rowSeparator = "," + expandY = yes + doubleClickedCommand = AddFields + } + } + + // Add and delete buttons + Vertical { + expandX = no + Button { + tooltip = "Update the module list" + image = $(MLAB_MeVisLab_Standard)/Modules/IDE/images/refresh.png + command = BuildModuleTreeView + } + Button { + tooltip = "Add field to trigger list" + image="$(MLAB_MeVisLab_Standard)/Modules/IDE/images/connectRightOff.png" + command = AddFields + } + Button { + tooltip = "Remove field from trigger list" + command = DeleteFields + image="$(MLAB_MeVisLab_Standard)/Modules/IDE/images/connectLeftOn.png" + style { + colors { buttonText = red } + titleFont { weight = Bold } + } + } + } + droppedObjectCommand = FieldDroped + Vertical { + expandY = Yes + // Selected Fields + ListView selectedFields { + name = selectedFieldsView + columnSeparator = "." + rowSeparator = "," + selectionMode = Single + doubleClickedCommand = DeleteFields + } + EventFilter { + filter = KeyPress + control = selectedFieldsView + command = KeyPressed + } + } + } + } + Execute = WindowWakeup +} +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-03T14:51:32 +//# hash: Y6g/HIpreauLUmNWg5upWR7/x/1Q8vafFEkI+JvruUzIUWoqQlg/uLr7Aufp9/yWvbF3USzuRbxCj+jjyrUQ+g== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/FieldWriter.def =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldWriter.def (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/FieldWriter.def 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,29 @@ +//---------------------------------------------------------------------------------- +//! FieldWriter module definition +/*! +// \file FieldWriter.def +// \author Reinhard Hameeteman +// \date 2007-02-28 +// +*/ +//---------------------------------------------------------------------------------- + +MacroModule FieldWriter { + genre = Fields + author = "Reinhard Hameeteman" + group = BIGR + status = "work-in-progress" + comment = "Save the parameters of a field in the network to a .csv file" + keywords = "Field write save Excel CSV" + seeAlso = "SettingsManager" + documentation = "$(LOCAL)/html/FieldWriter.html" + externalDefinition = "$(LOCAL)/FieldWriter.script" +} // MacroModule FieldWriter + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-03T13:57:00 +//# hash: fh3AVNXiAVToLXQm0z+5bge2nX0m0PJ+rOyGBxex2CPXxcqTjYFrOFPnWr2OaiUGxnPlMCP41ri3pyZjuuOaCw== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/FieldWriter.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldWriter.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/FieldWriter.mlab 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,6 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +connections = "" +networkModel = "" Added: trunk/Community/General/Modules/Macros/Fields/FieldWriter.py =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldWriter.py (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/FieldWriter.py 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,152 @@ +#---------------------------------------------------------------------------------- +# +# 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. +# +#---------------------------------------------------------------------------------- +# +# | +# | Description: +# | Python methods for FieldWriter.script +# | +# | +# | Author(s) : Reinhard Hameeteman +# | Creation date : 02/2007 +# | +# _______________________________________________________________________ + +from mevis import * + +def FieldDroped( object ) : + ctx.field('selectedFields').value += ',' + object.fullName() + return + +def DeleteFields(): + listView = ctx.control('selectedFieldsView') + newString = 'Module.Field' + itemId = listView.firstItem().id() + lastId = listView.lastItem().id() + while ( itemId <= lastId ) : + item = listView.itemForId( itemId ) + if ( not listView.isSelected( item ) ): + newString += ',' + '.'.join( item.texts() ) + itemId += 1 + ctx.field('selectedFields').value = newString + return + +def KeyPressed( event=None ): + if event['key']=='Up' and event['shiftKey'] : + MoveItemUp() + elif event['key']=='Down' and event['shiftKey'] : + MoveItemDown() + return + +def MoveItemUp() : + selectedFields = ctx.field("selectedFields").stringValue().split(',') + listView = ctx.control('selectedFieldsView') + currentItem = '.'.join( listView.currentItem().texts() ) + currentItemIdx = selectedFields.index( currentItem ) + if currentItemIdx > 1 : + selectedFields.remove( currentItem ) + selectedFields.insert( currentItemIdx-1, currentItem ) + ctx.field("selectedFields").value = ','.join( selectedFields ) + return + +def MoveItemDown() : + selectedFields = ctx.field("selectedFields").stringValue().split(',') + listView = ctx.control('selectedFieldsView') + currentItem = '.'.join( listView.currentItem().texts() ) + currentItemIdx = selectedFields.index( currentItem ) + if currentItemIdx < len( selectedFields )-1 : + selectedFields.remove( currentItem ) + selectedFields.insert( currentItemIdx+1, currentItem ) + ctx.field("selectedFields").value = ','.join( selectedFields ) + return + +def SaveFields( arg ): + fileName = ctx.field('fileName').value + network = ctx.parent() + writeHeader = ctx.field('writeHeader').value + if ( fileName == '' ): + fileName = MLABFileDialog.getSaveFileName(ctx.localPath(),"", "Save statistics"); + ctx.field('fileName').value = fileName + if ( fileName <> '' ) : + file = None + if ( ctx.field('append').value == True ) : + # Check if file exists, and set writeheader + # We only want to write the header the first time + if ( MLABFileManager.exists( fileName ) ): + writeHeader = False + file = open(fileName, 'a') + else : + file = open(fileName, 'w') + if ( writeHeader == True ) : + header = ctx.field('selectedFields').value + header = header.lstrip('Module.Field,') + header = header.replace(',' , ctx.field('separationCharacter').stringValue() ) + header += '\n' + file.write( header ) + fieldList = ctx.field('selectedFields').value.split(',') + file.write( GetValues() ) + if ( ctx.field('append').value == True ): + file.write( '\n' ) + file.close() + return + +def GetValues( arg=None): + selectedFields = ctx.field('selectedFields').stringValue().lstrip('Module.Field,') + outputString = '' + if len(selectedFields) > 0: + fieldList = selectedFields.split(',') + separationCharacter = '' + if (ctx.field('separationCharacter').stringValue() == '\\n'): + separationCharacter = '\n' + else: + separationCharacter = ctx.field('separationCharacter').stringValue() + num = len(fieldList) + nw = ctx.parent() + for iField in fieldList : + value = nw.field( iField ).stringValue() + outputString += value + outputString += separationCharacter + outputString = outputString[:-len( separationCharacter )] + outputString += '\n' + return outputString + +def GetOutput( arg = None ): + selectedFields = ctx.field('selectedFields').stringValue().lstrip('Module.Field,') + outputString = '' + if ( ctx.field("writeHeader").boolValue() and not ctx.field("append").boolValue() ) : + outputString = selectedFields + '\n' + outputString += GetValues() + ctx.field('outputString').value = outputString + + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +#//# owner: EMC +#//# date: 2010-03-03T13:57:05 +#//# hash: jaOyUudq5VM0RhaS8GuH++82FVmv0N0Koj/cTW3Ih0bm4NW4v4i1eD9/hl2qMXzolmsqBcWSGE/EBDJKmMy5Fg== +#//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/FieldWriter.script =================================================================== --- trunk/Community/General/Modules/Macros/Fields/FieldWriter.script (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/FieldWriter.script 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,136 @@ +//---------------------------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------------------------- +// Write field values to file +// +// \file FieldWriter.script +// \author Reinhard Hameeteman +// \date 2/2007 +// \bug +// \warning +// +//---------------------------------------------------------------------------------- + + +// --- Interface + +Interface { + Parameters { + Field fileName { type = string } + Field moduleList { type = string value = " " } + Field selectedModule { type = string values = "" } + Field fieldList { type = string value = "Fields"} + Field selectedFields { type = string value = "Module.Field" } + Field writeHeader { type = bool value = true } + Field append { type = bool value = true } + Field separationCharacter { type = string value="," } + Field save { type = trigger } + Field update { type = trigger } + Field outputString { type = string } + Field userString1 { type = string value = "" } + Field userString2 { type = string value = "" } + Field userString3 { type = string value = "" } + Field userString4 { type = string value = "" } + Field userString5 { type = string value = "" } + } +} // Interface + + +Commands { + source = "$(LOCAL)/FieldWriter.py" + FieldListener { + listenField = selectedFields + listenField = update + command = GetOutput + } + FieldListener save { command = SaveFields } + +} + + +Window { + w = 600 + droppedObjectCommand = FieldDroped + TabView { + TabViewItem "Field selection" { + expandY = yes + margin = 5 + Horizontal { + margin = 0 + Field fileName { alignGroup = g1 } + FieldLabel save { title = Save } + Button save { + title = "" + image=$(MLAB_MeVisLab_Standard)/Modules/IDE/images/filesave.png + } + } + Horizontal { + alignX = Left + CheckBox writeHeader { dependsOn = !append } + CheckBox append { } + Field separationCharacter { expandX=no } + } + // Selected Fields + Vertical { + expandY = Yes + ListView selectedFields { + name = selectedFieldsView + columnSeparator = "." + rowSeparator = "," + selectionMode = Single + doubleClickedCommand = DeleteFields + } + EventFilter { + filter = KeyPress + control = selectedFieldsView + command = KeyPressed + } + } + } + TabViewItem "Output" { + tabSelectedCommand = GetOutput + expandY = yes + Button update {} + TextView outputString { edit = No } + } + TabViewItem "User strings" { + Field userString1 {} + Field userString2 {} + Field userString3 {} + Field userString4 {} + Field userString5 {} + } + } +} + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-03T13:57:09 +//# hash: aIY7dsNPukCN4WNN6YhaNw1G2ZBCZmwghKjOJVYlAqRAkA+HlCwwW+6yoL+HTdrKq5Lwx47Af0z15PjQcfkzfA== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/SetReSet.def =================================================================== --- trunk/Community/General/Modules/Macros/Fields/SetReSet.def (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/SetReSet.def 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,57 @@ +//---------------------------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------------------------- +//! SetReSet module definition +/*! +// \file SetReSet.def +// \author Reinhard Hameeteman +// \date 2007-11-14 +*/ +//---------------------------------------------------------------------------------- + +MacroModule SetReSet { + genre = Fields + group = BIGR + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Bool field that can set using a trigger and reset using an other trigger" + keywords = "set reset trigger bool" + seeAlso = "" + documentation = $(LOCAL)/html/SetReSet.html + externalDefinition = "$(LOCAL)/SetReSet.script" + scriptOnly = yes + +} // MacroModule SetReSet + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:38:50 +//# hash: IEtoqfjRk/KqaSlu7P1Fel9XaYd5iA4S6G1vQq+CawRMklpQ40YC3HDUKyFngdhEVj8f6CoeVYX3rpYEc/JVxw== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/SetReSet.py =================================================================== --- trunk/Community/General/Modules/Macros/Fields/SetReSet.py (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/SetReSet.py 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,69 @@ +#---------------------------------------------------------------------------------- +# +# 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 SetReSet +#/*! +# \file SetReSet.py +# \author Reinhard Hameeteman +# \date 2007-11-14 +# +# Bool field that can set using a trigger and reset using an other trigger +#*/ +#---------------------------------------------------------------------------------- + +from mevis import * + +def Set(arg=None): + if not ctx.field('value').boolValue() : + ctx.field('OnTrigger').touch() + UpdateInt() + ctx.field('value').value = True + return + +def ReSet(arg=None): + if ctx.field('value').boolValue() : + ctx.field('OffTrigger').touch() + UpdateInt() + ctx.field('value').value = False + return + +def UpdateInt(): + if ctx.field('value').boolValue() : + ctx.field('intValue').value = 1 + else : + ctx.field('intValue').value = 0 + return + + + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +#//# owner: EMC +#//# date: 2010-03-02T15:38:22 +#//# hash: pB7po7LaG2YD5tk4q8ZnChLDpDSdCiwEOZFaN2pCU4Al6TGjVQPiOX0Ca4Bxmmw43SlF4xqFZnCPNGI/KvPigg== +#//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/SetReSet.script =================================================================== --- trunk/Community/General/Modules/Macros/Fields/SetReSet.script (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/SetReSet.script 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,83 @@ +//---------------------------------------------------------------------------------- +// +// 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 SetReSet +/*! +// \file SetReSet.script +// \author Reinhard Hameeteman +// \date 2007-11-14 +// +// Bool field that can set using a trigger and reset using an other trigger +*/ +//---------------------------------------------------------------------------------- + + +Interface { + Inputs {} + Outputs {} + Parameters { + Field value { type = bool value = false } + Field intValue { type = int value = 0 } + Field set { type = trigger } + Field reset { type = trigger } + Field OnTrigger { type = trigger } + Field OffTrigger { type = trigger } + } +} + + +Commands { + source = $(LOCAL)/SetReSet.py + FieldListener set { command = Set } + FieldListener reset { command = ReSet } +} + +Window { + Vertical { + Horizontal { + FieldLabel set { alignGroup = g1 } + Button set { alignGroup = g2 } + FieldLabel OnTrigger { title = On alignGroup = g3 } + Field value { edit = no alignGroup = g4 } + } + Horizontal { + FieldLabel reset { alignGroup = g1 } + Button reset {alignGroup = g2 } + FieldLabel OffTrigger { title = Off alignGroup = g3 } + Field intValue { edit = no alignGroup = g4 } + } + } +} + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:39:24 +//# hash: i/STUTHmiyU973Ust+kuFnS7VZFncMnbR1iQwqSIO655wOqSdMqwZkV7if+M8c06l27LaXEHQtySQEtvmpv2JA== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Fields/html/FieldTrigger.html =================================================================== --- trunk/Community/General/Modules/Macros/Fields/html/FieldTrigger.html (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/html/FieldTrigger.html 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,85 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>FieldTrigger</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>You can use this module to trigger fields in a specified order. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote> + You can select the fields in the left tree view of all modules in the current network. Double clicking or pressing the right arrow will select the field and add it to the selected fields view in the right panel. You can also simply drag and drop a field on the GUI. Double clicking a field in the right panel or pressing the left arrow removes the field from the list. Using Shift-Up/Down you can move a selected field up and down in the list.<br/> + You can specify a sleep time in seconds, which is the time between each trigger (if AfterEachTrigger is selected) or between two repetitions.<br/> + After each trigger the following commands are issued:<br/> + MLAB.processEvents()<br/> + MLAB.processInventorQueue()<br/> + Triggering is done with a touch() on the selected fields. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Pressing the round arrow will update the field tree in the left panel. +</blockquote> + + + + + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>allFields</b> + Check to see a list off all fields in the network. If not checked only the trigger fields are listed. + </li> + <li> + <b>selectedFields</b> + List of selected fields. + </li> + <li> + <b>start</b> + Start triggering the selected fields. + </li> + <li> + <b>stop</b> + Stop the triggering. + </li> + <li> + <b>sleep</b> + Waiting time in seconds. + </li> + <li> + <b>sleepEachStep</b> + Wait after each trigger. If not checked wait after each sequence. + </li> + <li> + <b>repetition</b> + Repeate the trigger sequence. + </li> + <li> + <b>currentIteration</b> + Current iteration. + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/Macros/Fields/html/FieldWriter.html =================================================================== --- trunk/Community/General/Modules/Macros/Fields/html/FieldWriter.html (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/html/FieldWriter.html 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,77 @@ +<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> +<html> + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> + <meta name="Description" content="TransposeMatrix module help file"> + <title>MevisLab TransposeMatrix</title> + </head> + <body> + <center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a + href="#Details">Details</a> <a href="#Inputs">Inputs</a> <a + href="#Outputs">Outputs</a> <a href="#Parameters">Parameters</a> <a + href="#Example">Example</a> <a href="#Tips&Tricks">Tips&Tricks</a> <a + href="#KnownBugs">Known Bugs</a> + <hr width="100%"></center> + + <h2>FieldWriter</h2> + + <h3> <a name="Purpose"></a>Purpose</h3> + + <blockquote> + <b>FieldWriter </b> Writes the field values of slected fields in a network to a text file. + </blockquote> + + <h3> <a name="Usage"></a>Usage</h3> + + <blockquote> + <p>Drag the fields to the GUI to add them to the selected fields, supply a filename and a seperation character and press Save. + </blockquote> + + <h3> <a name="Details"></a>Details</h3> + + <blockquote> + The order of the selected fields can be changed by selecting a field and pressing Shift-Up or Shift-Down to move the field up + or down in the list. Double clicking on a field removes it from the list. If WriteHeader is enabled the first time the values + are written to the file, also a line with the field names is written. If Append is selected the values are appended to the + file (and thus no header is writen). The seperation character that is written between the field values can be specified. Using + \n will add a newline after each value. Using the default comma, you can easily create comma seperated value files which can be + read in many other application (e.g. Excel).<br/> + The output can be inspected in the Output tab. The UserStrings tab offers the possibily to add user specified strings to the + output. Simpy add these fields to the selected fields.<br/> + Pressing Save with no fileName specified will show a File Dialog window which allows you to select an output file. + </blockquote> + + <h3> <a name="Inputs"></a>Inputs</h3> + + <blockquote>None</blockquote> + + <h3> <a name="Outputs"></a>Outputs</h3> + + <blockquote>None</blockquote> + + <h3> <a name="Parameters"></a>Parameters</h3> + + <dl> + <dl> + <dl> + <li><b>File name:</b> Guess what.</li> + <li><b>Save:</b> Triggers a save action.</li> + <li><b>Write Header:</b>If checked the field names are written as a separate line the first time the file is written.</li> + <li><b>Append:</b>Appends the values to the file.</li> + <li><b>Separation Character:</b>Character(s) used to seperate field values. Using \n will add a newline</li> + </dl> + </dl> + </dl> + + <h3> <a name="Example"></a>Example</h3> + <blockquote>None</blockquote> + + <h3> <a name="Tips&Tricks"></a>Tips & Tricks</h3> + <blockquote>None</blockquote> + + <h3> <a name="KnownBugs"></a>Known Bugs</h3> + <blockquote>None</blockquote> + </body> +</html> Added: trunk/Community/General/Modules/Macros/Fields/html/SetReSet.html =================================================================== --- trunk/Community/General/Modules/Macros/Fields/html/SetReSet.html (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/html/SetReSet.html 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,71 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>SetReSet</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module can be use to see if some Field in a network has changed. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Press Set to Set the value. Press Reset to reset it +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>The OnTrigger, the OffTrigger and the Int value are only triggered when the value changes. Value is set to True every time Set is pressed. +</blockquote> + + + + + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>value</b> + Bool value set on pressing Set + </li> + <li> + <b>intValue</b> + Int value set to 1 when Set is pressed the first time and to 0 when Reset pressed for the first time. This field only changes if Value changes. + </li> + <li> + <b>set</b> + Set value + </li> + <li> + <b>reset</b> + ResetValue + </li> + <li> + <b>OnTrigger</b> + Triggered when switching to the value to On + </li> + <li> + <b>OffTrigger</b> + Triggered when switching to the value to Off + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/Macros/Fields/networks/FieldTriggerExample.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Fields/networks/FieldTriggerExample.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/Fields/networks/FieldTriggerExample.mlab 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,20 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module View2D { + internal { + frame = "-39 -211 80 56" + } +} +module FieldTrigger { + internal { + frame = "-39 -115 80 56" + } +} +module LocalImage { + internal { + frame = "-47 -27 96 56" + } +} +connections = "" Added: trunk/Community/General/Modules/Macros/Strings/FormatFloat.def =================================================================== --- trunk/Community/General/Modules/Macros/Strings/FormatFloat.def (rev 0) +++ trunk/Community/General/Modules/Macros/Strings/FormatFloat.def 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,58 @@ +//---------------------------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------------------------- +//! FormatString module definition +/*! +// \file FormatFloat.def +// \author Coert Metz +// \date 2009-12-17 +*/ +//---------------------------------------------------------------------------------- + +MacroModule FormatFloat { + author = "Coert Metz" + genre = Fields + group = BIGR + status = "work-in-progress" + comment = "Convert a number into a string with a specified formatting" + keywords = "string float number convert format" + seeAlso = "StringUtils Arithmetic0" + scriptOnly = yes + documentation = "$(LOCAL)/html/FormatFloat.html" + exampleNetwork = "$(LOCAL)/networks/FormatFloatExample.mlab" + externalDefinition = "$(LOCAL)/FormatFloat.script" + +} // MacroModule FormatFloat + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:41:34 +//# hash: Dheq4ZrMRwATSPr+k03ED9whtof0vOPqxMYu4xARR0YGdXsF9pNJwl3Qh9CFiE2C394d8Z8kQ8qcMmJGJ7RhFA== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Strings/FormatFloat.py =================================================================== --- trunk/Community/General/Modules/Macros/Strings/FormatFloat.py (rev 0) +++ trunk/Community/General/Modules/Macros/Strings/FormatFloat.py 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,60 @@ +#---------------------------------------------------------------------------------- +# +# 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 FormatFloat +#/*! +# \file FormatFloat.py +# \author Coert Metz +# \date 2009-12-17 +# +# +#*/ +#---------------------------------------------------------------------------------- + +from mevis import * + +def format(arg=None): + stringValue = ctx.field("value").stringValue() + stringList = stringValue.split() + outString = '' + format = ctx.field("format").stringValue() + for string in stringList : + try: + value = float(string) + outString += format % value + ' ' + except : + outString += ' ' + ctx.field("output").setStringValue( outString ) + + +#//# MeVis signature v1 +#//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +#//# owner: EMC +#//# date: 2010-03-02T15:42:06 +#//# hash: j1fPczysk9vjNXYra25GV4Y0k1s89bpmE98sonFO1uK029kq+/57WKvMqOwLfvZTxhavOk8hn3tHCm7tvSLdJA== +#//# MeVis end Added: trunk/Community/General/Modules/Macros/Strings/FormatFloat.script =================================================================== --- trunk/Community/General/Modules/Macros/Strings/FormatFloat.script (rev 0) +++ trunk/Community/General/Modules/Macros/Strings/FormatFloat.script 2010-03-05 14:58:48 UTC (rev 236) @@ -0,0 +1,78 @@ +//---------------------------------------------------------------------------------- +// +// 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 FormatFloat +/*! +// \file FormatFloat.script +// \author Coert Metz +// \date 2... [truncated message content] |
From: <rha...@us...> - 2010-03-05 14:50:52
|
Revision: 235 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=235&view=rev Author: rhameeteman Date: 2010-03-05 14:50:27 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH * Added project MLCMFields with one module: SyncFields Added Paths: ----------- trunk/Community/General/Modules/ML/MLCMFields/ trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def trunk/Community/General/Modules/ML/MLCMFields/SyncFields/ trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab trunk/Community/General/Sources/ML/MLCMFields/ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h trunk/Community/General/Sources/ML/MLCMFields/SyncFields/ trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h Added: trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def (rev 0) +++ trunk/Community/General/Modules/ML/MLCMFields/MLCMFields.def 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,73 @@ +//---------------------------------------------------------------------------------- +//! MLCMFields module definitions. +/*! +// \file MLCMFields.def +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule SyncFields +//---------------------------------------------------------------------------------- +MLModule SyncFields { + DLL = "MLCMFields" + group = BIGR + genre = Fields + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Sync float or vector depending on difference criterium" + keywords = "sync float vector loop break precision" + seeAlso = "SyncFloat SyncVector" + documentation = "$(LOCAL)/SyncFields/SyncFields.html" + exampleNetwork = "$(LOCAL)/SyncFields/SyncFieldsExample.mlab" + + Window { + expandY = No + Vertical { + name = MainWindow + expandY = No + style { + Prototype Field { expandX = yes alignGroup = g1 } + } + Box "Mode" { + expandY = No + Field on { alignX = Left } + Field mode { alignX = Left } + Field precision {} + } + Box Floats { + visibleOn = "*mode == "Float" || mode == "MultiFloat" *" + expandY = No + Field float0 {} + Field float1 {} + Field float2 { visibleOn = "* mode == "MultiFloat" *" } + Field float3 { visibleOn = "* mode == "MultiFloat" *" } + Field float4 { visibleOn = "* mode == "MultiFloat" *" } + Field float5 { visibleOn = "* mode == "MultiFloat" *" } + Field float6 { visibleOn = "* mode == "MultiFloat" *" } + Field float7 { visibleOn = "* mode == "MultiFloat" *" } + Field float8 { visibleOn = "* mode == "MultiFloat" *" } + Field float9 { visibleOn = "* mode == "MultiFloat" *" } + } + Box Vectors { + name = vectors + expandY = No + visibleOn = "*mode == "Vector" || mode == "MultiVector" *" + Field vector0 {} + Field vector1 {} + Field vector2 { visibleOn = "*mode == "MultiVector" *" } + Field vector3 { visibleOn = "*mode == "MultiVector" *" } + Field vector4 { visibleOn = "*mode == "MultiVector" *" } + Field vector5 { visibleOn = "*mode == "MultiVector" *" } + Field vector6 { visibleOn = "*mode == "MultiVector" *" } + Field vector7 { visibleOn = "*mode == "MultiVector" *" } + Field vector8 { visibleOn = "*mode == "MultiVector" *" } + Field vector9 { visibleOn = "*mode == "MultiVector" *" } + } + } + FieldListener mode { command = "*py:ctx.control('MainWindow').updateLayout();ctx.window().updateFrame()*" } + //FieldListener mode { command = "*py:ctx.window().updateFrame()*" } + } // Window +} // MLModule SyncFields Added: trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFields.html 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,37 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center> + +<hr WIDTH="100%"></center> +<h2>SyncFields</h2> + + + + + + + + + + + + + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMFields/SyncFields/SyncFieldsExample.mlab 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,199 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module AffineTransformation3d { + internal { + frame = "441 285 160 56" + moduleGroupName = "" + windows { + window _default { + geometry = "513 422 427 286" + sizeHint = "260 224" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = AffineTransformation3d + optParameters = "0 0 0 0 0 0.4 1 1 1 0 0 0 " + translationX = 0 + translationY = 0 + translationZ = 0 + rotationX = 0 + rotationY = 0 + rotationZ = 0.4 + shearingX = 0 + shearingY = 0 + shearingZ = 0 + scalingX = 1 + scalingY = 1 + scalingZ = 1 + matrix = "0.9210609940028851 0.3894183423086505 0 0 +-0.3894183423086505 0.9210609940028851 0 0 +0 0 1 0 +0 0 0 1" + transformationMode = Affine + isWorldTransformation = FALSE + worldVoxelTransformation = "1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1" + } +} +module OrthoView2D { + internal { + frame = "465 109 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "608 39 400 431" + sizeHint = "400 431" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = OrthoView2D1 + inventorInputOn = FALSE + layout = LAYOUT_AXIAL + filterMode = FILTER_LINEAR + synchronizeZoom = TRUE + synchronizePanning = FALSE + synchronizePosition = TRUE + useGlobalInputImage = TRUE + snapToCenter = FALSE + alternCubeLayout = FALSE + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + greyWidth = 2095 + greyCenter = 923.2999878 + annotationOn = TRUE + annotationSizeMode = ANNO_SHOW_DETAILED + annotationFontSize = ANNO_SIZE_AUTO + valueHighPrecision = FALSE + annoCoords = Voxel + showCurrentPos = TRUE + worldPosition = "30.3631706237793 31.50894927978516 43.5" + coloredMode = FALSE + } + internalFields = "" +} +module OrthoView2D { + internal { + frame = "237 109 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "135 37 400 431" + sizeHint = "400 431" + wasOpen = yes + wasActive = no + } + window _automatic { + geometry = "513 422 260 224" + sizeHint = "260 224" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = OrthoView2D + inventorInputOn = FALSE + layout = LAYOUT_AXIAL + filterMode = FILTER_LINEAR + synchronizeZoom = TRUE + synchronizePanning = FALSE + synchronizePosition = TRUE + useGlobalInputImage = TRUE + snapToCenter = FALSE + alternCubeLayout = FALSE + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + greyWidth = 2095.000244 + greyCenter = 923.3000488 + annotationOn = TRUE + annotationSizeMode = ANNO_SHOW_DETAILED + annotationFontSize = ANNO_SIZE_AUTO + valueHighPrecision = FALSE + annoCoords = Voxel + showCurrentPos = TRUE + worldPosition = "30.3631706237793 31.50894927978516 43.5" + coloredMode = FALSE + } + internalFields = "" +} +module LocalImage { + internal { + frame = "241 285 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "142 613 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module SyncFields { + internal { + frame = "353 205 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "617 228 183 201" + sizeHint = "183 201" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SyncFields + mode = Vector + on = TRUE + precision = 0.001000000047497451 + float0 = 0 + float1 = 0 + float2 = 0 + float3 = 0 + float4 = 0 + float5 = 0 + float6 = 0 + float7 = 0 + float8 = 0 + float9 = 0 + vector0 = "30.3631706237793 31.5089492797852 43.5 0 0 0" + vector1 = "30.3631706237793 31.5089492797852 43.5 0 0 0" + vector2 = "0 0 0 0 0 0" + vector3 = "0 0 0 0 0 0" + vector4 = "0 0 0 0 0 0" + vector5 = "0 0 0 0 0 0" + vector6 = "0 0 0 0 0 0" + vector7 = "0 0 0 0 0 0" + vector8 = "0 0 0 0 0 0" + vector9 = "0 0 0 0 0 0" + } +} +connections { + AffineTransformation3d.input0 = LocalImage.outImage + OrthoView2D1.image = AffineTransformation3d.output0 + OrthoView2D1.worldPosition = OrthoView2D.worldPosition + OrthoView2D.image = LocalImage.outImage + OrthoView2D.worldPosition = SyncFields.vector1 + SyncFields.vector0 = OrthoView2D1.worldPosition +} +networkModel = "" Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.bat 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" MLCMFields Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.pro 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,44 @@ +# ----------------------------------------------------------------------------- +# MLCMFields project profile +# +# \file MLCMFields.pro +# \author Reinhard Hameeteman +# \date 2010-03-05 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = MLCMFields + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# add dependencies of this project here + +CONFIG += dll ML + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + + +MLAB_PACKAGES += MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += MLCMFIELDS_EXPORTS + +HEADERS += \ + MLCMFieldsInit.h \ + MLCMFieldsSystem.h \ + SyncFields/mlSyncFields.h \ + +SOURCES += \ + MLCMFieldsInit.cpp \ + SyncFields/mlSyncFields.cpp \ + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/MLCMFields/MLCMFields.def + + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFields.sh 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Run this script to create a Makefile for your project +# + +# Check for Mac OS X +if [ "`uname -s`" = "Darwin" ]; then + +echo "Please use 'open -b de.mevis.MeVisLab.MacProfileTranslator MLCMFields.pro' or 'open MLCMFields.pro'" + +# Linux case +else + +# Print usage-info +function usage () { + echo "MLCMFields [-d|-r]" + echo "Creates Makefile.MLCMFields - run \"make -f Makefile.MLCMFields\" to build your module" + echo " -r : create Makefile for release-version (libMLCMFields.so)" + echo " -d : create Makefile for debug-version (libMLCMFields_d.so)" + exit 1 +} + +# Check arguments +if test "(" "$#" -gt "1" ")" -o "(" "(" "$#" = "1" ")" -a "(" "$1" != "-r" ")" -a "(" "$1" != "-d" ")" ")" +then + usage +fi + +# Switch debug/release/default +if [ "$1" = "-d" ];then + DEBUG=1 +elif [ "$1" = "-r" ];then + DEBUG=0 +else + DEBUG=$(cat /proc/$PPID/cmdline|grep -c MeVisLab_d) +fi + +if [ "$DEBUG" = "1" ];then + VERSION="Debug-Version" + MODE_FLAG="CONFIG-=release CONFIG+=debug" + EXT="_d" +else + VERSION="Release-Version" + MODE_FLAG="CONFIG-=debug CONFIG+=release" + EXT="" +fi + +echo "Creating Makefile.MLCMFields for $VERSION (libMLCMFields$EXT.so)" +qmake -t lib -o Makefile.MLCMFields $MODE_FLAG "CONFIG+=MeVisLab" MLCMFields.pro + +fi + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.cpp 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,40 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMFieldsInit.cpp +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "MLCMFieldsSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... +#include "SyncFields/mlSyncFields.h" + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int MLCMFieldsInit (void) +{ + ML_TRACE_IN("MLCMFieldsInit ()") + + SyncFields::initClass(); + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(MLCMFieldsInit) + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsInit.h 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMFieldsInit.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMFieldsInit_H +#define __MLCMFieldsInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int MLCMFieldsInit (void); + +ML_END_NAMESPACE + +#endif // __MLCMFieldsInit_H + + Added: trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/MLCMFieldsSystem.h 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLCMFieldsSystem.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMFieldsSystem_H +#define __MLCMFieldsSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef MLCMFIELDS_EXPORTS +// Use the MLCMFIELDS_EXPORT macro to export classes and functions +#define MLCMFIELDS_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define MLCMFIELDS_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define MLCMFIELDS_EXPORT +#endif + + +#endif // __MLCMFieldsSystem_H + + Added: trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.cpp 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,211 @@ +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! The ML module class SyncFields. +/*! +// \file mlSyncFields.cpp +// \author Reinhard Hameeteman +// \date 2008-11-04 +// +// Sync float or vector depending on difference criterium +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlSyncFields.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(SyncFields, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +SyncFields::SyncFields () + : BaseOp(0, 0) +{ + ML_TRACE_IN("SyncFields::SyncFields ()"); + + handleNotificationOff(); + FieldContainer *fieldC = getFieldContainer(); + + const char* syncModes[] = {"Float","MultiFloat","Vector","MultiVector"}; + f_Mode = fieldC->addEnum("mode",syncModes,4); + f_Mode->setEnumValue( FLOAT ); + + f_On = fieldC->addBool("on"); + f_On->setBoolValue( true ); + + f_Precision = fieldC->addDouble("precision"); + f_Precision->setDoubleValue( 1e-3f ); + + for (unsigned int iFloat=0; iFloat < NFIELDS; ++iFloat ){ + std::stringstream ss; + ss << iFloat; + std::string currentName = "float" + ss.str(); + m_FloatsFields.push_back(fieldC->addDouble(currentName.c_str()) ); + m_FloatsFields[iFloat]->setDoubleValue( 0.0f ); + } + + for (unsigned int iVector =0; iVector < NFIELDS; ++iVector ){ + std::stringstream ss; + ss << iVector; + std::string currentName = "vector" + ss.str(); + m_Vec6Fields.push_back( fieldC->addVec6f(currentName.c_str()) ); + m_Vec6Fields[iVector]->setVec6fValue( vec6() ); + } + + m_Updating = false; + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void SyncFields::handleNotification (Field *field) +{ + ML_TRACE_IN("SyncFields::handleNotification ()"); + + if ( m_Updating ||!f_On->getBoolValue() ) { + return; + } + + if ( field == f_Mode || field == f_On || field == f_Precision ) { + switch ( f_Mode->getEnumValue() ){ + case FLOAT: + case MULTIFLOAT: + this->handleNotification( m_FloatsFields[0] ); + break; + case VECTOR: + case MULTIVECTOR: + this->handleNotification( m_Vec6Fields[0] ); + break; + default: + break; + } + } else { + + m_Updating = true; + + mlDebug( "Handling notification from: " << field->getName() ); + + unsigned int nFields = NFIELDS; + + switch ( f_Mode->getEnumValue() ){ + case FLOAT : + nFields = 2; + case MULTIFLOAT: + { + std::vector< bool > changed(nFields,false); + const double precision = f_Precision->getDoubleValue(); + double newValue = 0.0; + // determine the changed field + for (unsigned int iFloat = 0; iFloat < nFields; ++iFloat){ + if ( field == m_FloatsFields[iFloat] ){ + changed[iFloat]= true; + newValue = m_FloatsFields[iFloat]->getDoubleValue(); + } else { + changed[iFloat] = false; + } + } + + // Prevent notifications while updating all values + handleNotificationOff(); + // updated fields if necessary + for (unsigned int iFloat = 0; iFloat < nFields; ++iFloat){ + if ( !changed[iFloat] && DiffTest(newValue, m_FloatsFields[iFloat]->getDoubleValue(), precision ) ){ + m_FloatsFields[iFloat]->setDoubleValue( newValue ); + changed[iFloat] = true; + } + } + handleNotificationOn(); + + for (unsigned int iFloat = 0; iFloat < nFields; ++iFloat){ + if ( changed[iFloat] ){ + m_FloatsFields[iFloat]->notifyAttachments(); + } + } + break; + } + case VECTOR: + nFields = 2; + case MULTIVECTOR: + { + std::vector< bool > changed(nFields,false); + const double precision = f_Precision->getDoubleValue(); + vec6 newValue; + for (unsigned int iVector = 0; iVector < nFields; ++iVector){ + if ( field == m_Vec6Fields[iVector] ){ + changed[iVector]= true; + newValue = m_Vec6Fields[iVector]->getVec6fValue(); + } else { + changed[iVector] = false; + } + } + // Prevent notifications while updating all values + handleNotificationOff(); + // Update fields if necessary + for (unsigned int iVector = 0; iVector < nFields; ++iVector){ + if ( !changed[iVector] && DiffTest(newValue, m_Vec6Fields[iVector]->getVec6fValue(), precision ) ){ + m_Vec6Fields[iVector]->setVec6fValue( newValue ); + changed[ iVector ] = true; + } + } + handleNotificationOn(); + + for (unsigned int iVector = 0; iVector < nFields; ++iVector){ + if ( changed[iVector] ){ + m_Vec6Fields[iVector]->notifyAttachments(); + } + } + break; + } + default: + break; + } + } + m_Updating = false; +} + +template< typename T > +bool SyncFields::DiffTest( const T first, const T last, const double precision ) +{ + unsigned int numComp = sizeof(first)/sizeof(first[0]); + for (unsigned int iComp=0; iComp < numComp; ++iComp){ + if ( abs(first[iComp] - last[iComp]) > precision) { + return true; + } + } + return false; +} +bool SyncFields::DiffTest( const double first, const double last, const double precision ) +{ + + return (abs(first - last) > precision); +} +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMFields/SyncFields/mlSyncFields.h 2010-03-05 14:50:27 UTC (rev 235) @@ -0,0 +1,85 @@ +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//---------------------------------------------------------------------------------- +//! The ML module class SyncFields. +/*! +// \file mlSyncFields.h +// \author Reinhard Hameeteman +// \date 2008-11-04 +// +// Sync float or vector depending on difference criterium +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlSyncFields_H +#define __mlSyncFields_H + + +// Local includes +#include "../MLCMFieldsSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +ML_START_NAMESPACE + +#define NFIELDS 10 + +//! Sync float or vector depending on difference criterium +class MLCMFIELDS_EXPORT SyncFields : public BaseOp +{ +public: + + //! Constructor. + SyncFields (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + + DoubleField *f_Precision; + EnumField *f_Mode; + BoolField *f_On; + std::vector< DoubleField* > m_FloatsFields; + std::vector< Vec6fField* > m_Vec6Fields; + + +private: + + template< typename T > bool DiffTest( const T first, const T last, const double precision ); + bool DiffTest( const double first, const double last, const double precision ); + bool m_Updating; + + enum {FLOAT=0, MULTIFLOAT, VECTOR, MULTIVECTOR }; + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(SyncFields) +}; + + +ML_END_NAMESPACE + +#endif // __mlSyncFields_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-05 14:24:44
|
Revision: 234 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=234&view=rev Author: rhameeteman Date: 2010-03-05 14:24:31 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added the following modules: nSyncViewer VectorFieldView View2DMPRPath Added Paths: ----------- trunk/Community/General/Modules/Macros/Viewers/ trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.def trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.script trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.def trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.mlab trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.py trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.script trunk/Community/General/Modules/Macros/Viewers/html/ trunk/Community/General/Modules/Macros/Viewers/html/VectorFieldView.html trunk/Community/General/Modules/Macros/Viewers/html/View2DMPRPath.html trunk/Community/General/Modules/Macros/Viewers/html/nSyncViewer.html trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.def trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.mlab trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.py trunk/Community/General/Modules/Macros/Viewers/nSyncViewer.script trunk/Community/General/Modules/Macros/Viewers/networks/ trunk/Community/General/Modules/Macros/Viewers/networks/VectorFieldViewExample.mlab trunk/Community/General/Modules/Macros/Viewers/networks/View2DMPRPathExample.mlab trunk/Community/General/Modules/Macros/Viewers/networks/nSyncViewerExample.mlab Added: trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.def =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.def (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.def 2010-03-05 14:24:31 UTC (rev 234) @@ -0,0 +1,57 @@ +//---------------------------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------------------------- +//! VectorFieldView module definition +/*! +// \file VectorFieldView.def +// \author Reinhard Hameeteman +// \date 2007-06-11 +*/ +//---------------------------------------------------------------------------------- + +MacroModule VectorFieldView { + genre = View2D + group = BIGR + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Displays a deformation grid and/or vectors of a field" + keywords = "mesh vector field deformation " + seeAlso = "soView2DDeformationGridView SoView2DVector" + exampleNetwork = $(LOCAL)/networks/VectorFieldViewExample.mlab + documentation = $(LOCAL)/html/VectorFieldView.html + externalDefinition = "$(LOCAL)/VectorFieldView.script" + +} // MacroModule VectorFieldView + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:33:15 +//# hash: saKgduCD/fA5JWzIG2+r69YEq3K0neBioTS3fjkKDBFVELuMq5RQsWExGvT0drKzCDm+SnELrDpzJqJoQrrCPA== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.mlab 2010-03-05 14:24:31 UTC (rev 234) @@ -0,0 +1,1050 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module TypeArithmetic1 { + internal { + frame = "-11 213 120 56" + moduleGroupName = Mesh + windows { + window _default { + geometry = "474 484 366 66" + sizeHint = "366 66" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = TypeArithmetic1 + operation = CompScale + parameterX = 0 + parameterY = 0 + value = -1 + } +} +module Negation { + internal { + frame = "777 -323 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "406 576 468 190" + sizeHint = "468 190" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Negation + inToggle = TRUE + outToggle = FALSE + outToggleInt = 0 + inInta = 0 + outInta = 1 + inIntb = -1 + outIntb = 1 + inIntc = -1 + outIntc = 0 + inIntd = 1 + outIntd = -1 + inFloat = 1 + outFloat = -1 + } + internalFields = "" +} +module Bypass { + internal { + frame = "565 473 72 64" + moduleGroupName = "" + } + fields { + instanceName = Vector + ignoreNextNotify = FALSE + noBypass = FALSE + } +} +module Bypass { + internal { + frame = "461 473 72 64" + moduleGroupName = "" + } + fields { + instanceName = Scalar + ignoreNextNotify = FALSE + noBypass = FALSE + } +} +module SoSeparator { + internal { + frame = "545 61 128 56" + moduleGroupName = MagnitudeOverlay + } + fields { + instanceName = SoSeparator2 + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module View2DExtensions { + internal { + frame = "989 133 136 56" + moduleGroupName = ShowVectorValue + windows { + window _default { + geometry = "528 153 660 669" + sizeHint = "660 669" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2DExtensions + slicerOn = TRUE + zoomOn = TRUE + panOn = TRUE + autoCenterOn = TRUE + position = "-3.984270095825195 -7.729000091552734 32.68109893798828" + positionMode = Off + lutOn = TRUE + lutMouseOn = TRUE + lutMouseButton1 = IGNORED + lutMouseButton2 = IGNORED + lutMouseButton3 = PRESSED + lutMouseShift = RELEASED + lutMouseCtrl = RELEASED + lutRangeMin = 0 + lutRangeMax = 1 + lutAlphaSync = TRUE + lutGreyCenter = 1 + lutGreyWidth = 1 + lutAlphaCenter = 1 + lutAlphaWidth = 1 + lutColorFactor = "1 1 1" + lutAlphaFactor = 1 + lutAutoDefault = TRUE + 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" + lutTrColE = "1 1 1" + lutTrColF = "1 1 1" + annotationOn = TRUE + annoCoords = Voxel + annoCTValue = AsIs + valueHighPrecision = FALSE + annotFontSize = ANNO_SIZE_AUTO + annotShowOrientation = ANNO_ORIENTATION_SIZE_WEIGHTED + annotVerticalRuler = TRUE + annotHorizontalRuler = FALSE + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationMode = ANNO_MODE_AUTO + annotShowAnnot = ANNO_SHOW_DETAILED + annotUserTopLeft = "$(PatientsName) +$(PatientID) $(PatientsSex) +$(PatientsBirthDate) +($(input00)): $(input05)" + 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)): + $(input05)" + annotShortTopRight = $(Modality) + annotShortBottomLeft = "Slice: $(slice)" + annotShortBottomRight = "LUT C/W: $(input03) / $(input04)" + annoInput03 = 1 + annoInput04 = 1 + annoInput05 = 1 + annoInput06 = 1 + annoInput07 = 1 + annoInput08 = 1 + annoInput09 = GV + annoMouseOn = TRUE + annoReadPixFloorPos = "1025 764 0" + annoReadPixVoxelPos = "1025.339965820312 764.1619873046875 0.5" + annoReadPixWorldPos = "1025.339965820312 764.1619873046875 0.5" + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + borderWidth = 1 + borderEvaluateFocus = FALSE + borderFocusColor = "1 1 1" + borderFocusWidth = 2 + mouseGrabberMode = FALSE + } + internalFields = "" +} +module FormatFloat { + internal { + frame = "865 133 96 56" + moduleGroupName = ShowVectorValue + windows { + window _default { + geometry = "203 457 400 102" + sizeHint = "400 102" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FormatFloat + format = %05.2f + value = "" + output = "" + } + internalFields = "" +} +module SoView2DPosition { + internal { + frame = "901 197 136 56" + moduleGroupName = ShowVectorValue + windows { + window _default { + geometry = "687 169 470 665" + sizeHint = "470 665" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DPosition + drawingOn = FALSE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = IGNORED + 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 = "-1 -1 -1" + firstSliceWorldPosition = "-1 -1 -1" + drawingModel = DRAWINGMODEL_CROSSHAIRS + drawingModelSize = -1 + 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" + updateOnPress = TRUE + updateOnMotion = TRUE + updateOnRelease = FALSE + cooperative = FALSE + colorBorder = FALSE + colorBorderWidth = 2 + } +} +module TypeArithmetic1 { + internal { + frame = "573 305 120 64" + moduleGroupName = MagnitudeOverlay + windows { + window _default { + geometry = "474 484 366 35" + sizeHint = "366 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = VectorLength + operation = VecLength + parameterX = 0 + parameterY = 0 + value = 0 + } +} +module SoGroup { + internal { + frame = "65 -99 96 56" + moduleGroupName = "" + } + fields { + instanceName = SoGroup2 + } +} +module SoView2D { + internal { + frame = "1 141 96 56" + moduleGroupName = Mesh + windows { + window _default { + geometry = "183 338 447 513" + sizeHint = "447 513" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2D1 + startSlice = 0 + sliceStep = 1 + numSlices = 1 + numXSlices = 1 + maxSlice = 0 + keepSlicesInView = FALSE + slab = 1 + lowerLeft = "0 0" + upperRight = "1 1" + margin = "2 2" + spacing = "4 4" + plane = "0 0 1 0" + sliceZoom = 1 + sliceZoomSynchronized = 1 + minSliceZoomKeyboard = 1 + sliceOrigin = "0 0" + viewingCenter = "0 0 0" + enableViewingCenter = FALSE + unzoomOnImageChange = FALSE + drawImageData = FALSE + timePoint = 0 + maxTimePoint = 0 + snapToCenter = FALSE + standardKeys = TRUE + standardKeysNumbers = TRUE + standardKeysNeedValidPosition = FALSE + passHandledFlagToInventor = FALSE + reverseExtensionDrawingOrder = FALSE + blendMode = BLEND_REPLACE + filterMode = FILTER_LINEAR + cacheMode = SLICE_CACHING_OFF + sliceAlignX = SLICE_ALIGNX_CENTER + sliceAlignY = SLICE_ALIGNY_CENTER + lutMode = LUT_BEST + useShaders = TRUE + applyLut = TRUE + zoomMode = VIEW2D_AUTO_ZOOM + zoomModeParameter = 1 + invertKeyPanningDirections = FALSE + overrideAspectRatio = FALSE + overrideAspectRatioValue = 1 + alphaFactor = 1 + baseColor = "1 1 1" + backgroundAlphaFactor = 0 + backgroundColor = "0 0 0" + cineCenterT = 0 + cineIntervalT = 0 + cineCenterZ = 0 + cineIntervalZ = 0 + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + cineFullRangeZ = TRUE + cineFullRangeT = TRUE + cineAlwaysReset = TRUE + status = "Nothing active" + deletingEnabled = TRUE + handle2DEvents = TRUE + handle3DEvents = TRUE + devicePixelSize = 1 + enableZBuffer = TRUE + enableZWrite = TRUE + } +} +module SoSeparator { + internal { + frame = "-55 61 112 56" + moduleGroupName = Mesh + } + fields { + instanceName = SoSeparator1 + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoToggle { + internal { + frame = "993 57 128 64" + moduleGroupName = ShowVectorValue + windows { + window _default { + geometry = "543 459 104 25" + sizeHint = "64 25" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ShowVectorValue + whichChild = -3 + on = TRUE + } +} +module GetVoxelValue { + internal { + frame = "1073 197 112 56" + moduleGroupName = ShowVectorValue + windows { + window _default { + geometry = "513 502 296 290" + sizeHint = "296 290" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = GetVoxelValue + position = "-1 -1 -1 0 0 0" + updateMode = AutoClear + coordinateType = World + } +} +module SoGroup { + internal { + frame = "473 -203 96 56" + moduleGroupName = "" + } + fields { + instanceName = SoGroup1 + } +} +module SoSeparator { + internal { + frame = "237 61 104 56" + moduleGroupName = Vectors + } + fields { + instanceName = SoSeparator + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoSwitch { + internal { + frame = "357 -103 120 64" + moduleGroupName = "" + windows { + window _default { + geometry = "642 474 173 90" + sizeHint = "173 90" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ShowMagnitude + whichChild = 0 + } +} +module SoView2D { + internal { + frame = "309 157 88 56" + moduleGroupName = Vectors + windows { + window _default { + geometry = "410 193 466 687" + sizeHint = "466 687" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2D + startSlice = 0 + sliceStep = 1 + numSlices = 1 + numXSlices = 1 + maxSlice = 0 + keepSlicesInView = FALSE + slab = 1 + lowerLeft = "0 0" + upperRight = "1 1" + margin = "2 2" + spacing = "4 4" + plane = "0 0 1 0" + sliceZoom = 1 + sliceZoomSynchronized = 1 + minSliceZoomKeyboard = 1 + sliceOrigin = "0 0" + viewingCenter = "0 0 0" + enableViewingCenter = FALSE + unzoomOnImageChange = FALSE + drawImageData = FALSE + timePoint = 0 + maxTimePoint = 0 + snapToCenter = FALSE + standardKeys = TRUE + standardKeysNumbers = TRUE + standardKeysNeedValidPosition = FALSE + passHandledFlagToInventor = FALSE + reverseExtensionDrawingOrder = FALSE + blendMode = BLEND_REPLACE + filterMode = FILTER_LINEAR + cacheMode = SLICE_CACHING_OFF + sliceAlignX = SLICE_ALIGNX_CENTER + sliceAlignY = SLICE_ALIGNY_CENTER + lutMode = LUT_BEST + useShaders = TRUE + applyLut = TRUE + zoomMode = VIEW2D_AUTO_ZOOM + zoomModeParameter = 1 + invertKeyPanningDirections = FALSE + overrideAspectRatio = FALSE + overrideAspectRatioValue = 1 + alphaFactor = 1 + baseColor = "1 1 1" + backgroundAlphaFactor = 0 + backgroundColor = "0 0 0" + cineCenterT = 0 + cineIntervalT = 0 + cineCenterZ = 0 + cineIntervalZ = 0 + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + cineFullRangeZ = TRUE + cineFullRangeT = TRUE + cineAlwaysReset = TRUE + status = "Nothing active" + deletingEnabled = TRUE + handle2DEvents = TRUE + handle3DEvents = TRUE + devicePixelSize = 1 + enableZBuffer = TRUE + enableZWrite = TRUE + } +} +module SoToggle { + internal { + frame = "189 153 104 64" + moduleGroupName = Vectors + } + fields { + instanceName = ViewVectors + whichChild = -1 + on = FALSE + } +} +module SoToggle { + internal { + frame = "-99 145 88 64" + moduleGroupName = Mesh + windows { + window _default { + geometry = "543 459 104 25" + sizeHint = "63 25" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ViewMesh + whichChild = -3 + on = TRUE + } +} +module SoMouseGrabber { + internal { + frame = "469 149 136 56" + moduleGroupName = MagnitudeOverlay + windows { + window _default { + geometry = "140 234 477 515" + sizeHint = "477 515" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMouseGrabber1 + on = TRUE + normalized = FALSE + clamp = TRUE + button1 = IGNORED + button2 = IGNORED + button3 = PRESSED + button1Pressed = FALSE + button2Pressed = FALSE + button3Pressed = FALSE + shift = PRESSED + ctrl = RELEASED + alt = RELEASED + shiftPressed = FALSE + ctrlPressed = FALSE + altPressed = FALSE + cursorShape = UNDEFINED_CURSOR + absX = 0 + absY = 0 + y = 1 + x = 1 + y = 1 + xmin = 0 + xmax = 1 + ymin = 0 + ymax = 1 + cursorPresent = FALSE + checkCursorPresent = FALSE + maskValid = FALSE + setEventHandled = FALSE + setWheelEventHandled = FALSE + flipX = FALSE + flipY = TRUE + swapXY = FALSE + sensitivity = 1 + wheelOverflow = FALSE + wheel = 0 + wheelStep = 1 + wheelMin = 0 + wheelMax = 100 + } +} +module SoRLLookUpTable { + internal { + frame = "517 209 136 64" + moduleGroupName = MagnitudeOverlay + windows { + window _default { + geometry = "632 337 612 532" + sizeHint = "612 532" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = overlayLut + _channelEditorState = "" + alphaCenter = 1 + alphaWidth = 1 + greyCenter = 1 + greyWidth = 1 + redCenter = 0.5 + redWidth = 1 + blueCenter = 0.5 + blueWidth = 1 + useColorRamps = FALSE + invertGrey = FALSE + invertAlpha = FALSE + colorFactor = "1 1 1" + alphaFactor = 1 + autoSetDefaultRamp = TRUE + setDefaultRampOnce = TRUE + inputImageValid = FALSE + rangeMin = 0 + rangeMax = 1 + widthMin = 0 + enableNegWidth = FALSE + widthMax = 1 + rangeStep = 0.004999999888 + rangeStepStep = 0.05000000075 + selectorX = 0 + selectorY = 0 + setInputMinMax = TRUE + useEditor = FALSE + useTraceColors = FALSE + trCol0 = "1 1 1" + trCol0Name = White + trCol0Alpha = 1 + trCol1 = "0.5019609928131104 0.5019609928131104 0.5019609928131104" + trCol1Name = Grey + trCol1Alpha = 1 + trCol2 = "0.8627449870109558 0 0.1725489944219589" + trCol2Name = Red + trCol2Alpha = 1 + trCol3 = "1 0.4627450108528137 0.4901959896087646" + trCol3Name = "Light Red" + trCol3Alpha = 1 + trCol4 = "0 0.8196079730987549 0.1607840061187744" + trCol4Name = Green + trCol4Alpha = 1 + trCol5 = "0.5607839822769165 1 0.4352940022945404" + trCol5Name = "Light Green" + trCol5Alpha = 1 + trCol6 = "0.1843139976263046 0.2392159998416901 0.9294120073318481" + trCol6Name = Blue + trCol6Alpha = 1 + trCol7 = "0.4901959896087646 0.5411760210990906 1" + trCol7Name = "Light Blue" + trCol7Alpha = 1 + trCol8 = "0.6313729882240295 0 0.67843097448349" + trCol8Name = "Dark Magenta" + trCol8Alpha = 1 + trCol9 = "0.8941180109977722 0.3803919851779938 1" + trCol9Name = Magenta + trCol9Alpha = 1 + trColA = "0 0.6823530197143555 0.756862998008728" + trColAName = "Dark Cyan" + trColAAlpha = 1 + trColB = "0.5019609928131104 1 0.9803919792175293" + trColBName = Cyan + trColBAlpha = 1 + trColC = "0.6156859993934631 0.6000000238418579 0.1960780024528503" + trColCName = "Dark Yellow" + trColCAlpha = 1 + trColD = "1 0.9764710068702698 0.3686270117759705" + trColDName = Yellow + trColDAlpha = 1 + trColE = "1 1 1" + trColEName = "Half Transparent" + trColEAlpha = 0.06274499744 + trColF = "1 1 1" + trColFName = Transparent + trColFAlpha = 0 + } +} +module SoView2DOverlay { + internal { + frame = "613 149 136 56" + moduleGroupName = MagnitudeOverlay + windows { + window _default { + geometry = "402 360 473 349" + sizeHint = "473 349" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DOverlay + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = TRUE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = TRUE + clipToSlice = TRUE + cursorShape = UNDEFINED_CURSOR + cacheTextures = TRUE + blendMode = BLEND_BLEND + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + inheritFilterMode = TRUE + alphaFactor = 1 + baseColor = "1 0 0" + useWorldCoords = FALSE + applyLut = TRUE + isCheckerTiling = FALSE + checkerTileSize = 2 + areCheckerTilesInverted = FALSE + } +} +module SoView2DVectorFieldView { + internal { + frame = "153 277 176 56" + moduleGroupName = Vectors + windows { + window _default { + geometry = "521 318 232 596" + sizeHint = "232 596" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DVectorFieldView + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = IGNORED + 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 + midpointSize = 0.05999999866 + vectorWidth = 0.1000000015 + vectorLength = 1 + vectorMinLength = 0 + midpointSegments = 10 + midpointAbsoluteSize = FALSE + vectorAbsoluteSize = TRUE + vectorColor = "1 0 0" + midpointColor = "1 1 0" + stepWidth = 10 + drawArrowTips = FALSE + arrowTipColor = "0 1 0" + arrowTipWidth = 0.200000003 + arrowTipHeight = 0.200000003 + normalizeVectors = FALSE + useComps2And3 = FALSE + } +} +module SoView2DDeformationGridView { + internal { + frame = "-167 277 208 56" + moduleGroupName = Mesh + windows { + window _default { + geometry = "204 416 222 297" + sizeHint = "222 297" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DDeformationGridView + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = IGNORED + 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 + stepWidth = 10 + gridColor = "0 0.6666666865348816 1" + gridPointColor = "1 1 1" + drawGridPoints = FALSE + gridPointSegments = 10 + gridPointAbsoluteSize = FALSE + gridPointSize = 0.05000000075 + } +} +module View2D { + internal { + frame = "469 -323 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "725 219 200 200" + sizeHint = "200 200" + wasOpen = no + wasActive = no + } + window Settings { + geometry = "56 258 278 378" + sizeHint = "278 378" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = TRUE + view2DExtensionsOn = FALSE + startSlice = -1 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_BLEND + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 1 + lutWidth = 1 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 0" + } + internalFields = "" +} +connections { + TypeArithmetic1.input0 = Vector.output0 + SoSeparator2.children = "SoMouseGrabber1.self overlayLut.self SoView2DOverlay.self" + View2DExtensions.inLUT = Scalar.output0 + View2DExtensions.annoInput05 = FormatFloat.output + FormatFloat.value = GetVoxelValue.outputStringValue + VectorLength.input0 = Vector.output0 + SoGroup2.children = "SoSeparator1.self SoSeparator.self" + SoView2D1.image = TypeArithmetic1.output0 + SoView2D1.startSlice = View2D.startSlice + SoView2D1.timePoint = View2D.timePoint + SoSeparator1.children = "ViewMesh.self SoView2D1.self" + ShowVectorValue.on = Negation.inToggle + ShowVectorValue.children = View2DExtensions.outNode + GetVoxelValue.input0 = Vector.output0 + GetVoxelValue.position = SoView2DPosition.worldPosition + SoGroup1.children = "ShowMagnitude.self ShowVectorValue.self" + SoSeparator.children = "ViewVectors.self SoView2D.self" + ShowMagnitude.children = "SoGroup2.self SoSeparator2.self" + SoView2D.image = Vector.output0 + SoView2D.startSlice = View2D.startSlice + SoView2D.timePoint = View2D.timePoint + ViewVectors.children = SoView2DVectorFieldView.self + ViewMesh.children = SoView2DDeformationGridView.self + SoMouseGrabber1.xmin = overlayLut.widthMin + SoMouseGrabber1.xmax = overlayLut.widthMax + SoMouseGrabber1.ymin = overlayLut.rangeMin + SoMouseGrabber1.ymax = overlayLut.rangeMax + overlayLut.inputImage = VectorLength.output0 + overlayLut.alphaCenter = overlayLut.greyCenter + overlayLut.alphaWidth = overlayLut.greyWidth + overlayLut.greyCenter = SoMouseGrabber1.y + overlayLut.greyWidth = SoMouseGrabber1.x + SoView2DOverlay.image = VectorLength.output0 + SoView2DVectorFieldView.stepWidth = SoView2DDeformationGridView.stepWidth + View2D.inImage = Scalar.output0 + View2D.inInvPreLUT = SoGroup1.self + View2D.inInvPostLUT = SoView2DPosition.self + View2D.view2DExtensionsOn = Negation.outToggle +} +networkModel { + parentItems { + 0 { + MLABNetworkModelItem MLABNetworkModelItemGroup { + uniqueId = 95 + objectName = MagnitudeOverlay + parentUniqueId = 0 + frame = "444 -14 330 408" + color { + r = 45 + g = 226 + b = 226 + a = 40 + } + } + MLABNetworkModelItem MLABNetworkModelItemGroup { + uniqueId = 128 + objectName = ShowVectorValue + parentUniqueId = 0 + frame = "840 -18 370 296" + color { + r = 255 + g = 255 + b = 0 + a = 40 + } + } + MLABNetworkModelItem MLABNetworkModelItemGroup { + uniqueId = 169 + objectName = Mesh + parentUniqueId = 0 + frame = "-192 -14 326 372" + color { + r = 85 + g = 170 + b = 255 + a = 40 + } + } + MLABNetworkModelItem MLABNetworkModelItemGroup { + uniqueId = 199 + objectName = Vectors + parentUniqueId = 0 + frame = "128 -14 294 372" + color { + r = 255 + g = 0 + b = 0 + a = 40 + } + } + } + } +} Added: trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.script =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.script (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/VectorFieldView.script 2010-03-05 14:24:31 UTC (rev 234) @@ -0,0 +1,173 @@ +//---------------------------------------------------------------------------------- +// +// 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 VectorFieldView +/*! +// \file VectorFieldView.script +// \author Reinhard Hameeteman +// \date 2007-06-11 +// +// Displays a deformation grid and/or vectors of a field +*/ +//---------------------------------------------------------------------------------- + + +Interface { + Inputs { + Field input0 { internalName = Scalar.input0 comment = "Scalar image" } + Field input1 { internalName = Vector.input0 comment = "Vector image" } + } + Outputs { + Field output0 { internalName = View2D.scene.self hidden = yes } + } + Parameters { + Field startSlice { internalName = View2D.startSlice } + } +} +Persistence { + fields = ViewMesh.on + fields = ShowVectorValue.on + Module SoView2DDeformationGridView { + fields = gridColor + fields = drawGridPoints + fields = gridPointColor + fields = gridPointAbsoluteSize + fields = gridPointSize + fields = gridPointSegments + fields = stepWidth + } + fields = ViewVectors.on + Module SoView2DVectorFieldView { + fields = vectorColor + fields = vectorWidth + fields = vectorLength + fields = vectorAbsoluteSize + fields = midpointColor + fields = midpointSize + fields = midpointSegments + fields = midpointAbsoluteSize + fields = drawArrowTips + fields = arrowTipColor + fields = arrowTipWidth + fields = arrowTipHeight + fields = stepWidth + fields = normalizeVectors + fields = useComps2And3 + } + fields = ShowMagnitude.whichChild + fields = View2D.view.drawImageData + Module SoView2DOverlay { + fields = timePoint + fields = drawingOn + fields = useWorldCoords + fields = renderOnSlab + fields = cacheTextures + fields = isCheckerTiling + fields = checkerTileSize + fields = areCheckerTilesInverted + fields = inheritFilterMode + fields = filterMode + fields = blendMode + fields = alphaFactor + fields = baseColor + } +} + +Commands { +} + +Window Viewer { + Vertical { + expandY = yes + Horizontal { + alignX = left + CheckBox ViewMesh.on { title = Grid dependsOn = !ShowMagnitude.whichChild } + CheckBox ViewVectors.on { title = Vector dependsOn = !ShowMagnitude.whichChild } + CheckBox ShowMagnitude.whichChild { title = Magnitude } + Field SoView2DDeformationGridView.stepWidth { + title = Step + step = 1 + stepStep = 5 + tooltip = "Step distance between shown grid lines." + } + Button { + title = "Settings" + command = "py:ctx.showWindow('Settings', ctx.window() )" + } + } + Viewer View2D.self { + tooltip = "Use shift-right mouse button to change the LUT of the overlay image" + type = SoRenderArea + } + } +} + + +Window Settings { + TabView { + name = TabViewControl + TabViewItem General { + alignY = top + Box OverlayContents { + CheckBox View2D.view.drawImageData { title = "Show scalar input" } + CheckBox ShowVectorValue.on { title = "Show cursor vector value" } + CheckBox ShowMagnitude.whichChild { title = "Use field magnitude as overlay" } + CheckBox ViewVectors.on { title = "Display vectors" } + CheckBox ViewMesh.on { title = "Display mesh" } + } + } + TabViewItem Magnitude { + name = MagnitudeTabControl + dependsOn = "* ShowMagnitude.whichChild == "1" *" + Panel { module = SoView2DOverlay } + } + TabViewItem Vectors { + name = VectorsTabControl + dependsOn = ViewVectors.on + alignY = top + Panel { module = SoView2DVectorFieldView } + } + TabViewItem Mesh { + name = MeshTabControl + dependsOn = ViewMesh.on + Panel { module = SoView2DDeformationGridView } + } + } + FieldListener ShowMagnitude.whichChild { + command = "*py: ctx.control('TabViewControl').setTabEnabled(1, ctx.field('ShowMagnitude.whichChild').value == 1 ); ctx.control('TabViewControl').setTabEnabled(2, not ctx.field('ShowMagnitude.whichChild').value == 1 ); ctx.control('TabViewControl').setTabEnabled(3, not ctx.field('ShowMagnitude.whichChild').value == 1 ); *"} + FieldListener ViewVectors.on { command = "*py: ctx.control('TabViewControl').setTabEnabled(2, ctx.field('ViewVectors.on').boolValue() ) *"} + FieldListener ViewMesh.on { command = "*py: ctx.control('TabViewControl').setTabEnabled(3, ctx.field('ViewMesh.on').boolValue() ) *"} + wakeupCommand = "*py: ctx.field('ShowMagnitude.whichChild').touch();ctx.field('ViewVectors.on').touch();ctx.field('ViewMesh.on').touch(); *" +} + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:36:49 +//# hash: D/uPHzT2SJLYdvz7N4vHzd5NmVKgp7PXLhPhCzqlo0OD0FDfvHdMEoWNP/BAkcSuidQW9g9jC4jZ/cG5bw86bA== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.def =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.def (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.def 2010-03-05 14:24:31 UTC (rev 234) @@ -0,0 +1,57 @@ +//---------------------------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------------------------- +//! View2DMPRPath module definition +/*! +// \file View2DMPRPath.def +// \author Reinhard Hameeteman +// \date 2009-06-05 +*/ +//---------------------------------------------------------------------------------- + +MacroModule View2DMPRPath { + genre = View2D + group = BIGR + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Combine MPRPath and View2D with the common user interaction" + keywords = "MPRPath View2D" + seeAlso = "MPRPath View2D" + documentation = $(LOCAL)/html/View2DMPRPath.html + exampleNetwork = $(LOCAL)/networks/View2DMPRPathExample.mlab + externalDefinition = "$(LOCAL)/View2DMPRPath.script" + +} // MacroModule View2DMPRPath + + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:35:48 +//# hash: oUBx1mlmqzhWrDaHZLPsUIYXFn5OkFWv+PmgA42R6JDuWbkaK8gRSQe8+B+ilRhXR2OZNAZ50HFCf8RJfsqJhg== +//# MeVis end Added: trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.mlab =================================================================== --- trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.mlab (rev 0) +++ trunk/Community/General/Modules/Macros/Viewers/View2DMPRPath.mlab 2010-03-05 14:24:31 UTC (rev 234) @@ -0,0 +1,791 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoView2D { + internal { + frame = "325 213 88 56" + moduleGroupName = "" + } + fields { + instanceName = SoView2D + startSlice = 0 + sliceStep = 1 + numSlices = 1 + numXSlices = 1 + maxSlice = 0 + keepSlicesInView = FALSE + slab = 1 + lowerLeft = "0 0" + upperRight = "1 1" + margin = "2 2" + spacing = "4 4" + plane = "0 0 1 0" + sliceZoom = 1 + sliceZoomSynchronized = 1 + minSliceZoomKeyboard = 1 + sliceOrigin = "0 0" + viewingCenter = "0 0 0" + enableViewingCenter = FALSE + unzoomOnImageChange = FALSE + drawImageData = TRUE + timePoint = 0 + maxTimePoint = 0 + snapToCenter = FALSE + standardKeys = TRUE + standardKeysNumbers = TRUE + standardKeysNeedValidPosition = FALSE + passHandledFlagToInventor = FALSE + reverseExtensionDrawingOrder = FALSE + blendMode = BLEND_REPLACE + filterMode = FILTER_LINEAR + cacheMode = SLICE_CACHING_OFF + sliceAlignX = SLICE_ALIGNX_CENTER + sliceAlignY = SLICE_ALIGNY_CENTER + lutMode = LUT_BEST + useShaders = TRUE + applyLut = TRUE + zoomMode = VIEW2D_AUTO_ZOOM + zoomModeParameter = 1 + invertKeyPanningDirections = FALSE + overrideAspectRatio = FALSE + overrideAspectRatioValue = 1 + alphaFactor = 1 + baseColor = "1 1 1" + backgroundAlphaFactor = 0 + backgroundColor = "0 0 0" + cineCenterT = 0 + cineIntervalT = 0 + cineCenterZ = 0 + cineIntervalZ = 0 + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + cineFullRangeZ = TRUE + cineFullRangeT = TRUE + cineAlwaysReset = TRUE + status = "" + deletingEnabled = TRUE + handle2DEvents = TRUE + handle3DEvents = TRUE + devicePixelSize = 1 + enableZBuffer = TRUE + enableZWrite = TRUE + } +} +module SoRenderArea { + internal { + frame = "245 65 152 64" + moduleGroupName = "" + } + fields { + instanceName = scene + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = off + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + } +} +module SoGroup { + internal { + frame = "217 213 96 56" + moduleGroupName = "" + } + fields { + instanceName = SoGroup + } +} +module SoView2DPosition { + internal { + frame = "205 289 136 64" + moduleGroupName = "" + windows { + window _default { + geometry = "114 175 470 665" + sizeHint = "470 665" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = pos + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 0.8667280077934265 0.2914040088653564" + 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 = "1 1 1" + firstSliceWorldPosition = "-1 -1 -1" + drawingModel = DRAWINGMODEL_CROSSHAIRS + drawingModelSize = -1 + blendOnto = 1 + blendOutside = 0 + lineWidth = 1 + colorAxes = FALSE + sagittalColor = "1 0 0" + coronalColor = "0.1725489944219589 0.8862749934196472 0.01176500041037798" + axialColor = "0.007842999882996082 0.9529410004615784 0.9686269760131836" + updateOnPress = TRUE + updateOnMotion = TRUE + updateOnRelease = TRUE + cooperative = FALSE + colorBorder = FALSE + colorBorderWidth = 2 + } +} +module Increment { + internal { + frame = "-7 473 96 64" + moduleGroupName = "" + windows { + window _default { + geometry = "740 846 151 85" + sizeHint = "151 85" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ArrowDown + currentValue = 0 + applyMin = FALSE + applyMax = FALSE + minValue = 0 + maxValue = 10 + increment = -1 + } + internalFields = "" +} +module Increment { + internal { + frame = "-3 545 88 64" + moduleGroupName = "" + windows { + window _default { + geometry = "737 730 151 85" + sizeHint = "151 85" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ArrowUp + currentValue = 0 + applyMin = FALSE + applyMax = FALSE + minValue = 0 + maxValue = 10 + increment = 1 + } + internalFields = "" +} +module SoKeyGrabber { + internal { + frame = "-167 517 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "688 345 380 226" + sizeHint = "380 226" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoKeyGrabber + on = TRUE + shiftPressed = FALSE + ctrlPressed = FALSE + altPressed = FALSE + lastKey = ANY + key0 = UP_ARROW + key1 = DOWN_ARROW + key2 = ANY + key3 = ANY + key4 = ANY + } +} +module FieldBypass { + internal { + frame = "149 517 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "441 656 190 280" + sizeHint = "190 280" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FieldBypass1 + inputString0 = 0 + inputString1 = 0 + inputString2 = 0 + inputString3 = "" + inputString4 = "" + inputNumber = -1 + outputString = 0 + noBypass = FALSE + onlyIfChanged = TRUE + } +} +module FieldSwitch { + internal { + frame = "161 421 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "940 324 291 315" + sizeHint = "259 315" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FieldSwitch + currentInput = 0 + currentOutput = 0 + input0 = 0 + input1 = "" + input2 = "" + input3 = "" + input4 = "" + input5 = "" + input6 = "" + input7 = "" + input8 = "" + input9 = "" + output0 = 0 + output1 = "" + output2 = "" + output3 = "" + output4 = "" + output5 = "" + output6 = "" + output7 = "" + output8 = "" + output9 = "" + } + internalFields = "" +} +module FieldBypass { + internal { + frame = "157 365 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "661 174 190 280" + sizeHint = "190 280" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = FieldBypass + inputString0 = 0 + inputString1 = 360 + inputString2 = "" + inputString3 = "" + inputString4 = "" + inputNumber = 0 + outputString = 0 + noBypass = FALSE + onlyIfChanged = TRUE + } +} +module SoExaminerViewer { + internal { + frame = "413 69 136 56" + moduleGroupName = "" + } + fields { + instanceName = SoExaminerViewer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = off + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = FALSE + perspective = TRUE + stereoViewing = FALSE + stereoOffset = 3 + height = 0 + position = "0 0 0" + orientation = "0 0 1 0" + nearDistance = 0 + farDistance = 0 + focalDistance = 0 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module Switch { + internal { + frame = "297 365 144 56" + moduleGroupName = "" + windows { + window _default { + geometry = "356 371 199 66" + sizeHint = "199 66" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Switch + currentInput = 0 + numberOfInputs = 5 + maxInput = 4 + } +} +module SoGroup { + internal { + frame = "421 217 120 64" + moduleGroupName = "" + } + fields { + instanceName = invPostViewerIn + } +} +module SoGroup { + internal { + frame = "61 209 104 64" + moduleGroupName = "" + } + fields { + instanceName = invPostLUTIn + } +} +module SoGroup { + internal { + frame = "-355 361 104 64" + moduleGroupName = "" + } + fields { + instanceName = invPreLUTIn + } +} +module PathToKeyFrame { + internal { + frame = "305 573 128 56" + moduleGroupName = "" + windows { + window _default { + geometry = "51 97 350 495" + sizeHint = "470 495" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = PathToKeyFrame + numSmoothes = 0 + outputResolution = 0 + autoPathDir = FALSE + allowReverseView = FALSE + numOutputKeys = 0 + pathLength = 0 + pathShift = "0 0 0" + projectionMode = Off + viewDir = "0 1 0" + viewLatitude = 0 + viewLongitude = 0 + projectPathAngle = 0 + maxProjectionDistance = 0 + pathPositionWorld = "0 0 0" + pathPositionRelative = 0 + inputPathPositionWorld = "0 0 0" + inputPathPositionRelative = 0 + inputPathLength = 0 + } +} +module MPRPath { + internal { + frame = "301 501 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "134 107 449 580" + sizeHint = "449 580" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = MPRPath + rotation = "-0.997501603966892 0.0163167111006986 0.0687336527643707 1.57859108282801" + translation = "-27.9044 -198.011 0" + plane = "-0.0851343759417393 -0.00752636682328935 -0.996341051967373 3.86592710107502" + enablePlaneEdit = FALSE + fillValue = 0 + fieldOfView = 30 + outputSize = 256 + outputDepth = 1 + aspectRatio = 1 + forceUpright = FALSE + inputSliceNo = 0 + interpolation = Trilinear + memoryAccess = VirtualVolume + currentKeyFrame = 0 + maxKeyFrame = 0 + pathAngle = 0 + curvedMprPlane = "0.052780131559947 -0.998601549849757 0.00303353756831747 197.229091801679" + alignAlongPath = FALSE + thicknessOfCurvedMPR = 1 + showUpVectors = FALSE + showFrame = TRUE + upVectorColor = "1 1 1" + imageColor = "1 1 1" + borderColor = "1 1 1" + borderOn = TRUE + drawImageOn = TRUE + manipulatorOn = TRUE + clipPlaneOn = FALSE + flipClipPlane = FALSE + clipPlaneOffset = 0 + axesOn = FALSE + alphaFactor = 1 + zBuffer = TRUE + blendMode = BLEND_REPLACE + } +} +module View2DExtensions { + internal { + frame = "-227 361 136 64" + moduleGroupName = "" + windows { + window _default { + geometry = "552 188 637 669" + sizeHint = "637 669" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "587 124 354 440" + sizeHint = "354 440" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = ext + slicerOn = TRUE + zoomOn = TRUE + panOn = TRUE + autoCenterOn = TRUE + position = "-3.984270095825195 -7.729000091552734 32.68109893798828" + positionMode = Off + lutOn = TRUE + lutMouseOn = TRUE + lutMouseButton1 = IGNORED + lutMouseButton2 = IGNORED + lutMouseButton3 = PRESSED + lutMouseShift = RELEASED + lutMouseCtrl = RELEASED + lutRangeMin = 0 + lutRangeMax = 1 + lutAlphaSync = TRUE + lutGreyCenter = 1 + lutGreyWidth = 1 + lutAlphaCenter = 1 + lutAlphaWidth = 1 + lutColorFactor = "1 1 1" + lutAlphaFactor = 1 + lutAutoDefault = TRUE + 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" + lutTrColE = "1 1 1" + lutTrColF = "1 1 1" + annotationOn = TRUE + annoCoords = World + annoCTValue = AsIs + valueHighPrecision = FALSE + annotFontSize = ANNO_SIZE_AUTO + annotShowOrientation = ANNO_ORIENTATION_SIZE_WEIGHTED + annotVerticalRuler = TRUE + annotHorizontalRuler = FALSE + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationMode = ANNO_MODE_USER + annotShowAnnot = ANNO_SHOW_DETAILED + annotUserTopLeft = "$(PatientsName) +$(PatientsBirthDate) $(PatientsSex) +$(PatientID) +($(input00)): +$(input02) GV" + annotUserTopRight = "$(InstitutionName) +$(ManufacturersModelName) +$(Modality)" + annotUserBottomLeft = "Slice: $(input09) +Timepoint: $(timepoint) +$(sizex),$(sizey),$(sizez),$(sizec),$(sizet) +$(voxelx),$(voxely),$(voxelz) +$(SeriesDescription) +$(ImageComments)" + annotUserBottomRight = "User Mode +Scan: $(AcquisitionDate) +LUT C/W: $(input07) / $(input08)" + annotShortTopLeft = "$(PatientsName) +($(input00)): + $(input01) GV" + annotShortTopRight = $(Modality) + annotShortBottomLeft = "Slice: $(input09)" + annotShortBottomRight = "LUT C/W: $(input03) / $(input04)" + annoInput03 = 1 + annoInput04 = 1 + annoInput05 = 1 + annoInput06 = 1 + annoInput07 = 1 + annoInput08 = 1 + annoInput09 = GV + annoMouseOn = TRUE + annoReadPixFloorPos = "1025 764 0" + annoReadPixVoxelPos = "1025.339965820312 764.1619873046875 0.5" + annoReadPixWorldPos = "1025.339965820312 764.1619873046875 0.5" + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + borderWidth = 1 + borderEvaluateFocus = FALSE + borderFocusColor = "1 1 1" + borderFocusWidth = 2 + mouseGrabberMode = FALSE + } + internalFields = "" +} +module SoMouseGrabber { + internal { + frame = "-63 365 128 56" + moduleGroupName = "" + windows { + window _default { + geometry = "-49 125 477 449" + sizeHint = "477 449" + wasOpen = no + wasActive = no + } + window _automatic { + geometry = "768 153 366 744" + sizeHint = "303 440" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMouseGrabber + on = TRUE + normalized = FALSE + clamp = TRUE + button1 = RELEASED + button2 = PRESSED + button3 = RELEASED + button1Pressed = FALSE + button2Pressed = FALSE + button3Pressed = FALSE + shift = RELEASED + ctrl = RELEASED + alt = RELEASED + shiftPressed = FALSE + ctrlPressed = FALSE + altPressed = FALSE + cursorShape = UNDEFINED_CURSOR + absX = 0 + absY = 0 + y = 0 + x = 0.5 + y = 0 + xmin = 0 + xmax = 1 + ymin = 0 + ymax = 0 + cursorPresent = FALSE + checkCursorPresent = FALSE + maskValid = FALSE + setEventHandled = FALSE + setWheelEventHandled = FALSE + flipX = FALSE + flipY = FALSE + swapXY = FALSE + sensitivity = 1 + wheelOverflow = FALSE + wheel = 0 + wheelStep = 1 + wheelMin = 0 + wheelMax = 0 + } +} +module SoGroup { + internal { + frame = "-195 205 152 56" + moduleGroupName = "" + } + fields { + insta... [truncated message content] |
From: <rha...@us...> - 2010-03-05 13:44:21
|
Revision: 233 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=233&view=rev Author: rhameeteman Date: 2010-03-05 13:44:11 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added project MLCMCoordinate containing two modules: WorldInfo BoxArithmetic Added Paths: ----------- trunk/Community/General/Modules/ML/MLCMCoordinate/ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab trunk/Community/General/Sources/ML/MLCMCoordinate/ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.h trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinate.bat trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinate.pro trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinate.sh trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateInit.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateInit.h trunk/Community/General/Sources/ML/MLCMCoordinate/MLCMCoordinateSystem.h trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/ trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.cpp trunk/Community/General/Sources/ML/MLCMCoordinate/WorldInfo/mlWorldInfo.h Added: trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmetic.html 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,61 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> + +<hr WIDTH="100%"></center> +<h2>BoxArithmetic</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module can be used to perform several operations on boxes. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Select the OperationMode and the appropriate Input for Box0 and Box1. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Box0 and Box1 can be obtained form input0 and input1 respectively or from the scalar, vector or box fileds. If you select input0 or input1, UseVoxelCenter can be used to use (0.5,0.5,0.5) as origin of the image (seems to be needed when connecting the output box to a SubImage module).<br/> +The following operations are available: +<table> +<tr><td>ExpandScalar:</td><td>Box.v1 = Box0.v1-Constant (applied to all components)</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+Constant (applied to all components)</td></tr> + +<tr><td>AddScalar:</td><td>Box.v1 = Box0.v1+Constant (applied to all components)</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+Constant (applied to all components)</td></tr> + +<tr><td>ExpandVector:</td><td>Box.v1 = Box0.v1-v1</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+v1</td></tr> + +<tr><td>AddVector:</td><td>Box.v1 = Box0.v1+v1</td></tr> +<tr><td> </td><td>Box.v2 = Box0.v1+v1</td></tr> + +<tr><td>InterSect:</td><td>Box = Box0 ∩ Box1</td></tr> + +<tr><td>Union:</td><td>Box = Box0 ∪ Box1</td></tr> +</table> +</blockquote> + + + + + + + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/BoxArithmetic/BoxArithmeticExample.mlab 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,170 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module View2D { + internal { + frame = "-87 -331 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "13 122 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = FALSE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 0 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 2047.5 + lutWidth = 4095 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 0 1 0.5" + } + internalFields = "" +} +module SubImage { + internal { + frame = "-155 -131 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "177 107 559 353" + sizeHint = "559 353" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SubImage + boxInput = "-10 -20 0 0 0 0 63.5 63.5 63.5 0 0 0" + autoApplyBox = TRUE + x = -10 + sx = 63.5 + modifyX = TRUE + y = -20 + sy = 63.5 + modifyY = TRUE + z = 0 + sz = 63.5 + modifyZ = TRUE + c = 0 + sc = 0 + modifyC = FALSE + t = 0 + st = 0 + modifyT = FALSE + u = 0 + su = 0 + modifyU = FALSE + fillValue = 0 + mode = WorldStartEnd + autoApply = TRUE + } +} +module BoxArithmetic { + internal { + frame = "-39 -131 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "635 123 424 636" + sizeHint = "530 636" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = BoxArithmetic + inputBox0 = "0 0 0 0 0 0 -1 -1 -1 -1 -1 -1" + inputBox1 = "0 0 0 0 0 0 -1 -1 -1 -1 -1 -1" + correctInput0 = FALSE + correctInput1 = TRUE + useVoxelCenter = TRUE + correctBox = FALSE + constant = 0 + v1 = "40 40 40 0 0 0" + v2 = "-10 -20 0 0 0 0" + x1 = 0 + y1 = 0 + z1 = 0 + c1 = 0 + t1 = 0 + u1 = 0 + x2 = -1 + y2 = -1 + z2 = -1 + c2 = -1 + t2 = -1 + u2 = -1 + operationMode = Unify + inputMode0 = Input0 + inputMode1 = Vectors + } +} +module LocalImage { + internal { + frame = "-119 -3 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "573 556 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Bone.tiff + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Bone.tiff" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +connections { + View2D.inImage = SubImage.output0 + SubImage.input0 = LocalImage.outImage + SubImage.boxInput = BoxArithmetic.outputBox + BoxArithmetic.input0 = LocalImage.outImage +} +networkModel = "" Added: trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/MLCMCoordinate.def 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,130 @@ +//---------------------------------------------------------------------------------- +//! MLCMCoordinate module definitions. +/*! +// \file MLCMCoordinate.def +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule WorldInfo +//---------------------------------------------------------------------------------- +MLModule WorldInfo { + DLL = "MLCMCoordinate" + group = "BIGR" + genre = "Info" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Adds World dimensions image information to the Info module" + keywords = "Info size world matrix voxel dimension extent" + seeAlso = "Info" + documentation = "$(LOCAL)/WorldInfo/WorldInfo.html" + exampleNetwork = "$(LOCAL)/WorldInfo/WorldInfoExample.mlab" + externalDefinition = "$(LOCAL)/WorldInfo/WorldInfo.script" +} // MLModule WorldInfo + + +//---------------------------------------------------------------------------------- +// MLModule BoxArithmetic +//---------------------------------------------------------------------------------- +MLModule BoxArithmetic { + DLL = "MLCMCoordinate" + group = "BIGR" + genre = "Geometry" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Perform simple calculations on a (image) box" + keywords = "box expand augment" + seeAlso = "VecBoxConvert" + documentation = "$(LOCAL)/BoxArithmetic/BoxArithmetic.html" + exampleNetwork = "$(LOCAL)/BoxArithmetic/BoxArithmeticExample.mlab" + + Description { + Field outputBox { persistent = No } + Field outputBox0 { persistent = No } + Field outputBox1 { persistent = No } + Field outputExtent { persistent = No } + Field outV1 { persistent = No } + Field outV2 { persistent = No } + } + Window { + Vertical { + Box Mode { + Horizontal { + Field operationMode {} + CheckBox useVoxelCenter { dependsOn = "* inputMode0 == "Input0" || inputMode1 == "Input1" *" } + } + } + Box "Input Selection" { + Horizontal { + alignX = Left + Label { title = "Box0:" alignGroupX = c1 } + ButtonBar inputMode0 { show = Radio } + CheckBox correctInput0 { title = Correct } + } + Horizontal { + alignX = Left + Label { title = "Box1:" alignGroupX = c1 } + ButtonBar inputMode1 { show = Radio } + CheckBox correctInput1 { title = Correct } + } + } + Box "Scalar Input" { + style { Prototype Field {parent = Field expandX = Yes} } + Vertical { + dependsOn = "* inputMode0 == "Scalars" || + inputMode1 == "Scalars" *" + Horizontal { + Field x1 {} + Field y1 {} + Field z1 {} + Field c1 {} + Field t1 {} + Field u1 {} + } + Horizontal { + Field x2 {} + Field y2 {} + Field z2 {} + Field c2 {} + Field t2 {} + Field u2 {} + } + } + Field constant { + expandX = No + dependsOn = "* operationMode == "ExpandScalar" || + operationMode == "AddScalar" *" + } + } + Box "Vector Input" { + dependsOn = "* operationMode == "AddVector" || + operationMode == "ExpandVector" || + inputMode0 == "Vectors" || + inputMode1 == "Vectors" *" + Field v1 { alignGroupX = c1 } + Field v2 { alignGroupX = c1 dependsOn = "* inputMode0 == "Vectors" || inputMode1 == "Vectors"*"} + } + Box "Box Input" { + Field inputBox0 { title = "Box0:" alignGroupX = c1 dependsOn = "* inputMode0 == "Box"*" } + Field inputBox1 { title = "Box1:" alignGroupX = c1 dependsOn = "* inputMode1 == "Box"*" } + } + Box "Output" { + style { Prototype Field { parent = Field edit = No alignGroupX = oc1 } } + Field outputBox0 { title = Box0 } + Field outputBox1 { title = Box1 } + Horizontal { + Field outputBox { title = Box: } + CheckBox correctBox { title = correct } + } + Field outputExtent { title = Size: } + Field outV1 { title = v1: } + Field outV2 { title = v2: } + } + } + } + +} // MLModule BoxArithmetic + Added: trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.html 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,44 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Details">Details</a> + <a href="#Example">Example</a> +<hr WIDTH="100%"></center> +<h2></h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module is an extension of the Info module. It has an extra tab with information about the world dimensions of the input image and has some extra fields with sizes as vectors. This help file only explains the World tab, for the other tabs please take a look at the help of the Info module. +</blockquote> + + + +<h3><a NAME=Details></a>Details</h3> +<blockquote>The different world coordinate parameters of the image can be determined as an axis aligned box or as a image aligned box. These two modes only differ if the VoxelToWorld matrix of the image has a rotation. If "UseVoxelCenter" is checked (0.5,0.5,0.5) is taken as origin otherwise (0,0,0) is used. Similarly for the extent (sizeX-0.5,sizeY-0.5,sizeZ-0.5) and (sizeX-1,sizeY-1,sizeZ-1) are used respectively. UseVoxelCenter may be of use for modules that use the voxel center as the origin of the image (ITK standard). If "IncludeAllVoxels" is checked the origin and extent are (0,0,0) and (sizeX,sizeY,sizeZ) respectively. This last option may be helpfull for visulasation of the image boundaries.<br/> + +Size = Extent-Origin<br/> +Center = 0.5*(box.v1+box.v2)<br/> +Box.v1 = Origin<br/> +Box.v2 = Extent<br/> +Rotation = rotation present in the VoxelToWorld matrix<br/> +</blockquote> + + +<h3><a NAME=Example></a>Example</h3> +<blockquote> + The example network show a visualisation of the different world parameters. + Toggle IncludeAllVoxels and UseVoxelCenter to see their effect. +</blockquote> + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfo.script 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,396 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! WorldInfo module definitions. +/*! +// \file WorldInfo.script +// \author Reinhard Hameeteman +// \date 2008-10-03 +*/ +//---------------------------------------------------------------------------------- + +Description { + Field sizeX { persistent = NO deprecatedName = "X" } + Field sizeY { persistent = NO deprecatedName = "Y" } + Field sizeZ { persistent = NO deprecatedName = "Z" } + Field sizeC { persistent = NO deprecatedName = "C" } + Field sizeT { persistent = NO deprecatedName = "T" } + Field sizeU { persistent = NO deprecatedName = "U" } + Field size { persistent = NO } + + Field pageSizeX { persistent = NO deprecatedName = "PX" } + Field pageSizeY { persistent = NO deprecatedName = "PY" } + Field pageSizeZ { persistent = NO deprecatedName = "PZ" } + Field pageSizeC { persistent = NO deprecatedName = "PC" } + Field pageSizeT { persistent = NO deprecatedName = "PT" } + Field pageSizeU { persistent = NO deprecatedName = "PU" } + Field pageSize { persistent = NO } + + Field minValue { persistent = NO deprecatedName = "Min" } + Field maxValue { persistent = NO deprecatedName = "Max" } + + Field voxelSizeX { persistent = NO deprecatedName = "VX" } + Field voxelSizeY { persistent = NO deprecatedName = "VY" } + Field voxelSizeZ { persistent = NO deprecatedName = "VZ" } + Field voxelSize { persistent = NO } + + Field originX { persistent = NO } + Field originY { persistent = NO } + Field originZ { persistent = NO } + Field origin { persistent = NO } + + Field extentX { persistent = NO } + Field extentY { persistent = NO } + Field extentZ { persistent = NO } + Field extent { persistent = NO } + + Field worldSizeX { persistent = NO } + Field worldSizeY { persistent = NO } + Field worldSizeZ { persistent = NO } + Field worldSize { persistent = NO } + + Field centerX { persistent = NO } + Field centerY { persistent = NO } + Field centerZ { persistent = NO } + Field center { persistent = NO } + + Field box { persistent = No } + Field voxelVolume { persistent = NO deprecatedName = "VoxelVol" } + Field totalVolume { persistent = NO deprecatedName = "TotalVol" } + Field megaVoxels { persistent = NO deprecatedName = "MegaVoxel" } + Field dataType { persistent = NO deprecatedName = "DataType" } + Field typeInfo { persistent = NO deprecatedName = "TypeInfo" persistent = NO } + + Field a00 { persistent = NO deprecatedName = "x0" } + Field a01 { persistent = NO deprecatedName = "y0" } + Field a02 { persistent = NO deprecatedName = "z0" } + Field a03 { persistent = NO deprecatedName = "a0" } + Field a10 { persistent = NO deprecatedName = "x1" } + Field a11 { persistent = NO deprecatedName = "y1" } + Field a12 { persistent = NO deprecatedName = "z1" } + Field a13 { persistent = NO deprecatedName = "a1" } + Field a20 { persistent = NO deprecatedName = "x2" } + Field a21 { persistent = NO deprecatedName = "y2" } + Field a22 { persistent = NO deprecatedName = "z2" } + Field a23 { persistent = NO deprecatedName = "a2" } + Field a30 { persistent = NO deprecatedName = "x3" } + Field a31 { persistent = NO deprecatedName = "y3" } + Field a32 { persistent = NO deprecatedName = "z3" } + Field a33 { persistent = NO deprecatedName = "a3" } + Field worldMatrix { persistent = NO } + + Field cDimInfo { persistent = NO deprecatedName = "CDimInfo" } + Field tDimInfo { persistent = NO deprecatedName = "TDimInfo" } + Field uDimInfo { persistent = NO deprecatedName = "UDimInfo" } + Field tDimTable { persistent = NO deprecatedName = "TDimTable" } + + Field update { deprecatedName = "Update" } + Field memoryImage { deprecatedName = "MemoryImage" } + Field memoryImage2 { deprecatedName = "MemoryImage2" } + Field moduleName { deprecatedName = "OperatorName" } + Field connectionValid { deprecatedName = "InputConnection" } + Field dataValid { deprecatedName = "InputData" } +} + +Window { + + Category Main { + panelName = "Main" + expandY = Yes + + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + Prototype DimFld { + parent = Field + edit = no + expandX = yes + } + Prototype Box { + expandY = Yes + } + } + + Box "Image Size" { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + DimFld sizeX { title = "X:" } + DimFld sizeY { title = "Y:" } + DimFld sizeZ { title = "Z:" } + DimFld sizeC { title = "C:" } + DimFld sizeT { title = "T:" } + DimFld sizeU { title = "U:" } + } + Field size { edit = No } + } + Box "Page Size" { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + DimFld pageSizeX { title = "X:" } + DimFld pageSizeY { title = "Y:" } + DimFld pageSizeZ { title = "Z:" } + DimFld pageSizeC { title = "C:" } + DimFld pageSizeT { title = "T:" } + DimFld pageSizeU { title = "U:" } + } + Field pageSize { edit = No } + } + Box "Image Data" { layout = Horizontal + InfoFld dataType { title = "Type:" } + InfoFld minValue { title = "Min:" format = %.3f } + InfoFld maxValue { title = "Max:" format = %.3f } + } + Box "Voxel Size" { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld voxelSizeX { title = "X:" } + InfoFld voxelSizeY { title = "Y:" } + InfoFld voxelSizeZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + Field voxelSize { edit = no expandX = Yes } + } + Box "Volume Info" { layout = Horizontal + InfoFld voxelVolume { format = "%.5f ml" minLength = 10 } + Empty { expandX = yes } + InfoFld totalVolume { format = "%.1f ml" minLength = 10 } + InfoFld megaVoxels { title = "=" format = "%.2f Mega Voxels" minLength = 18 } + } + Box "Image State" { layout = Horizontal + Field pagedImgInfo { title = "State:" minLength = 20 edit = no } + } + } // Category Main + + Category Advanced { + panelName = "Advanced" + + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + Prototype MatFld { + parent = Field + edit = no + expandX = yes + } + } + + Box "World Matrix" { layout = Vertical + Table { + Row { + MatFld a00 { title="a00:" } + MatFld a01 { title="a01:" } + MatFld a02 { title="a02:" } + MatFld a03 { title="a03:" } + } + + Row { + MatFld a10 { title="a10:" } + MatFld a11 { title="a11:" } + MatFld a12 { title="a12:" } + MatFld a13 { title="a13:" } + } + + Row { + MatFld a20 { title="a20:" } + MatFld a21 { title="a21:" } + MatFld a22 { title="a22:" } + MatFld a23 { title="a23:" } + } + + Row { + MatFld a30 { title="a30:" } + MatFld a31 { title="a31:" } + MatFld a32 { title="a32:" } + MatFld a33 { title="a33:" } + } + } // Table + TextView worldMatrix { + fh = 100 + edit = NO + } + } // Box "World Matrix" + Box "C/T/U-Dim Info" { + Vertical { + InfoFld cDimInfo { title = "C:" trim = right } + InfoFld tDimInfo { title = "T:" trim = right } + InfoFld uDimInfo { title = "U:" trim = right } + } + } + } // Category Advanced + + Category World { + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + Prototype DimFld { + parent = Field + edit = no + expandX = yes + } + Prototype VecField { + parent = Field + edit = no + expandX = yes + } + } + Box Mode { + layout = Horizontal + CheckBox alignToAxis {} + CheckBox useVoxelCenter { dependsOn = !includeAllVoxels} + CheckBox includeAllVoxels {} + } + Box Origin { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld originX { title = "X:" } + InfoFld originY { title = "Y:" } + InfoFld originZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField origin {} + } + Box Extent { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld extentX { title = "X:" } + InfoFld extentY { title = "Y:" } + InfoFld extentZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField extent {} + } + Box Size { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld worldSizeX { title = "X:" } + InfoFld worldSizeY { title = "Y:" } + InfoFld worldSizeZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField worldSize {} + } + Box Center { + Horizontal { expandX = yes + childAlignGroup = "sizeBox" + InfoFld centerX { title = "X:" } + InfoFld centerY { title = "Y:" } + InfoFld centerZ { title = "Z:" } + Empty {} Empty {} Empty {} + } + VecField center {} + } + Box Box { + Horizontal { + Field box { edit = No } + } + } + Box Rotation { + Field rotation {} + } + + } + Category "Time" { + panelName = "TimePoints" //Vorsicht! Alter Name: Time Points + expandY = YES + ListView tDimTable { + header = YES + } + } + + Category "Type" { + panelName = "TypeInformation" //Vorsicht! Alter Name: Type Information + expandY = YES + ListView typeInfo { + tooltip = "Shows current type information" + style = fixed + Header = No + } + } + + // Maybe we want to activate this in future. + /*Category "Extended" { + panelName = "ExtendedImageProperties" + expandY = YES + ListView imgPropExt { + tooltip = "Shows information about extended image properties" + style = fixed + Header = No + } + }*/ + + Category "Internal" { + panelName = "Internal" + + style { + Prototype InfoFld { + parent = Field + edit = no + expandX = yes + } + } + + Box "Input Connection" { layout = Vertical + Horizontal { expandX = no + CheckBox connectionValid { + title = "Connection valid" + edit = no + } + CheckBox dataValid { + title = "Data valid" + edit = no + } + } + InfoFld moduleName {} + } + Box "Memory Image Status" { layout = Vertical + InfoFld memoryImage { title = "" } + InfoFld memoryImage2 { title = "" } + } + Box "Other" { layout = Vertical + Field bypassIndex { edit = no tooltip = "From which data is bypassed or -1 if disabled" } + Field inPlaceIndex { edit = no tooltip = "From which data is used inplace or -1 if disabled" } + } + Button update {} + } // Category Internal +} // Window + +//# MeVis signature v1 +//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBALMoAKeDufSkjPLfaCUd7Ij4IgEsndoDH9mP+jpEXKnAczgkSCgtNyNEMyiLur8xV1zEN7f71aeTOVWVntbzpucCARE=:lD+X/cPXp4xBkg/BH8EhyVWLOXzUCvL/ccrRKrYcyKMt2wR4QiXj1OCsqQukghRS1dwd5fRaB39vHgPZUYpdyA== +//# owner: EMC +//# date: 2010-03-02T15:19:50 +//# hash: VrEG1qzVvwdIhLN9pobpPugikWR+mmhuZRBWGa76viyvjNF0e7OneYraYGSxo4DiDCYLZ/wPTdelJA8UKCgsZQ== +//# MeVis end Added: trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCoordinate/WorldInfo/WorldInfoExample.mlab 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,767 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoRLAxis { + internal { + frame = "-355 269 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "150 542 370 294" + sizeHint = "370 294" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoRLAxis + autoAdjustSettings = FALSE + axisVolumeSize = "114 114 20" + axisOn = TRUE + axisFontNum = 0 + axis1Visibility = TRUE + axis2Visibility = TRUE + axis3Visibility = TRUE + axisNumberingOn = TRUE + axisSubTickingOn = TRUE + multiAxisXY = FALSE + multiAxisXZ = FALSE + multiAxisYX = FALSE + multiAxisYZ = FALSE + multiAxisZX = FALSE + multiAxisZY = FALSE + axis1Text = X + axis2Text = Y + axis3Text = Z + axisNumBias = "0 0 0" + axisNumScale = "1 1 1" + axisStepSizes = "15 15 15" + axisOrigin = "0 0 0" + axisMinEnds = "0 0 0" + axisMaxEnds = "150 150 150" + axisMarkerLength = "7.5 7.5 7.5" + axisTicksMin = "0 0 0" + axisTicksMax = "150 150 150" + axis1Color = "1 1 0" + axis1Transparency = 1 + axis2Color = "0.3333333432674408 1 0" + axis2Transparency = 1 + axis3Color = "0.3333333432674408 0.6666666865348816 1" + axis3Transparency = 1 + axisWingLength = "5 5 5" + axisOverScale = "1.100000023841858 1.100000023841858 1.100000023841858" + axisSubTickSteps = "0.2000000029802322 0.2000000029802322 0.2000000029802322" + axisSubTickScales = "0.25 0.25 0.25" + boxOn = FALSE + boxColor = "1 1 1" + boxTransparency = 1 + } +} +module Negation { + internal { + frame = "193 437 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "185 104 468 190" + sizeHint = "468 190" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Negation + inToggle = TRUE + outToggle = FALSE + outToggleInt = 0 + inInta = 0 + outInta = 1 + inIntb = -1 + outIntb = 1 + inIntc = -1 + outIntc = 0 + inIntd = 1 + outIntd = -1 + inFloat = 1 + outFloat = -1 + } + internalFields = "" +} +module SoToggle { + internal { + frame = "349 333 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "462 733 104 25" + sizeHint = "64 25" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoToggle + whichChild = -1 + on = FALSE + } +} +module SoRotation { + internal { + frame = "345 397 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "396 292 390 39" + sizeHint = "390 39" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoRotation + rotation = "-1 0 0 0.2094391137361526" + } +} +module SoText3 { + internal { + frame = "-123 325 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "395 710 256 219" + sizeHint = "256 219" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoText31 + string = "*"Extend"*" + spacing = 1 + justification = LEFT + parts = FRONT + } +} +module SoText3 { + internal { + frame = "121 325 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "395 710 256 219" + sizeHint = "256 219" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoText3 + string = "*"Origin"*" + spacing = 1 + justification = LEFT + parts = FRONT + } +} +module SoSphere { + internal { + frame = "-127 269 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "543 484 119 35" + sizeHint = "119 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoSphere1 + radius = 6 + } +} +module SoSeparator { + internal { + frame = "-203 185 152 64" + moduleGroupName = "" + windows { + window _viewer { + geometry = "747 297 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = extend + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoTranslation { + internal { + frame = "-247 325 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "381 497 270 35" + sizeHint = "270 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoTranslation2 + translation = "109.201530456543 136.6565093994141 94.54345703125" + } +} +module SoMaterial { + internal { + frame = "-231 269 96 56" + moduleGroupName = "" + windows { + window _materialeditor { + geometry = "301 572 195 164" + sizeHint = "195 164" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMaterial2 + ambientColor = "0.2 0.2 0.2" + diffuseColor = "0.333333 1 1" + specularColor = "0 0 0" + emissiveColor = "0 0 0" + shininess = 0.2 + transparency = 0 + } +} +module SoMaterial { + internal { + frame = "9 269 96 56" + moduleGroupName = "" + windows { + window _materialeditor { + geometry = "301 572 195 164" + sizeHint = "195 164" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMaterial1 + ambientColor = "0.2 0.2 0.2" + diffuseColor = "0 1 0" + specularColor = "0 0 0" + emissiveColor = "0 0 0" + shininess = 0.2 + transparency = 0 + } +} +module SoTranslation { + internal { + frame = "-7 325 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "700 478 270 35" + sizeHint = "270 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoTranslation1 + translation = "-119.8205871582031 -114.3894500732422 -80.23210144042969" + } +} +module SoSeparator { + internal { + frame = "29 185 152 64" + moduleGroupName = "" + windows { + window _viewer { + geometry = "747 297 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Origin + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoSphere { + internal { + frame = "109 269 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "543 484 119 35" + sizeHint = "119 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoSphere + radius = 6 + } +} +module SoExaminerViewer { + internal { + frame = "53 -35 184 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "9 125 587 552" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoExaminerViewer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + headlight = TRUE + decoration = TRUE + popupMenuEnabled = FALSE + viewing = TRUE + autoClipping = TRUE + externalCamera = FALSE + drawStyle = VIEW_AS_IS + interactiveDrawStyle = VIEW_LOW_COMPLEXITY + viewAllFlag = FALSE + initialCameraOrientation = CAMERA_KEEP_AS_IS + applyCameraOrientation = CAMERA_KEEP_AS_IS + cameraType = CAMERA_PERSPECTIVE + userSettingOrientation = "0 0 1 0" + automaticViewAll = FALSE + storeCurrentState = TRUE + saveCamera = TRUE + cursor = TRUE + isCameraStored = TRUE + perspective = TRUE + stereoViewing = FALSE + stereoOffset = 3 + height = 0.7853981853 + position = "413.67431640625 296.9138793945312 282.0001220703125" + orientation = "-0.2527531385421753 -0.4799727499485016 -0.8400845527648926 3.890670299530029" + nearDistance = 299.2450562 + farDistance = 775.7368164 + focalDistance = 572.6383667 + forceRedrawOnInteraction = FALSE + button1events = TO_VIEWER + button2events = TO_VIEWER + button3events = TO_VIEWER + keyEvents = TO_VIEWER + animationEnabled = FALSE + feedback = FALSE + feedbackSize = 32 + mouseInteraction = "" + rotationAxis = "0 1 0" + rotationAngle = 360 + rotationSteps = 80 + rotationCurrentStep = 0 + recordRotation = TRUE + } +} +module SoGVRVolumeRenderer { + internal { + frame = "133 125 168 56" + moduleGroupName = "" + windows { + window _default { + geometry = "95 350 346 584" + sizeHint = "346 584" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoGVRVolumeRenderer + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + on = TRUE + autoLoad = TRUE + interactiveQuality = 0.1000000015 + staticQuality = 1 + interactiveSamplingRate = 1 + staticSamplingRate = 1 + blendMode = Blend + octreeNodeSize = NODE_SIZE_32 + octreeParentComputationMethod = Rank + octreeParentComputationRank = 4 + currentTimePoint = 0 + maxTimePoint = 1 + force8bit = FALSE + filterVolumeData = FilterLinear + filterLut = TRUE + subVolumeStartX = 0 + subVolumeStartY = 0 + subVolumeStartZ = 0 + subVolumeEndX = 114 + subVolumeEndY = 114 + subVolumeEndZ = 20 + zbuffer = TRUE + permitClipping = TRUE + drawOnPlanes = TRUE + sizeOutputX = 114 + sizeOutputY = 114 + sizeOutputZ = 20 + incrementalUpdate = TRUE + highQualityStaticUpdate = FALSE + staticRenderingAfterInteractionOnly = FALSE + adaptQualityToWindowSize = TRUE + renderMode = Direct + useImageCacheFile = FALSE + imageCacheFilename = "" + greyCenter = 0 + greyWidth = 0.4110000134 + greyInvert = FALSE + alphaCenter = 0.2469999939 + alphaWidth = 1 + alphaInvert = FALSE + colorFactor = "1 0 0" + alphaFactor = 1 + enhancementAlphaMix = 0.25 + boundaryEnhancement = FALSE + boundaryEnhancementFactor = 1 + boundaryEnhancementExponent = 1 + boundaryEnhancementGradientBias = 0 + silhouetteEnhancement = FALSE + silhouetteEnhancementExponent = 1 + silhouetteEnhancementFactor = 1 + toneShading = FALSE + toneShadingWarmColor = "0.6745098233222961 0.5333333611488342 0.1411764770746231" + toneShadingColdColor = "0 0 0.4000000059604645" + toneShadingWarmDiffuse = 0.6000000238 + toneShadingColdDiffuse = 0.200000003 + toneShadingAngle = 45 + materialAmbient = 0.6000000238 + materialDiffuse = 1 + materialSpecular = 1 + materialSpecularity = 32 + light1Enabled = TRUE + light1DiffuseIntensity = 1 + light1SpecularIntensity = 1 + light1Color = "1 0 0" + light1PolarPhi = 0 + light1PolarRho = 0 + light2Enabled = FALSE + light2DiffuseIntensity = 1 + light2SpecularIntensity = 1 + light2Color = "1 0 0" + light2PolarPhi = 45 + light2PolarRho = 45 + light3Enabled = FALSE + light3DiffuseIntensity = 1 + light3SpecularIntensity = 1 + light3Color = "1 0 0" + light3PolarPhi = -45 + light3PolarRho = 0 + gradientQuality = GradientQualityAutomatic + selectionAlphaThreshold = 0.200000003 + selectedPoint1 = "-1 -1 -1" + selectedWorldPoint1 = "-1 -1 -1" + selectionActive = FALSE + useWorldCoords = TRUE + } +} +module SoMaterial { + internal { + frame = "233 269 96 56" + moduleGroupName = "" + windows { + window _materialeditor { + geometry = "301 572 304 164" + sizeHint = "195 164" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoMaterial + ambientColor = "0.2 0.2 0.2" + diffuseColor = "0.635294 0.635294 0.635294" + specularColor = "0 0 0" + emissiveColor = "0 0 0" + shininess = 0.11 + transparency = 0.753 + } +} +module SoSeparator { + internal { + frame = "261 185 152 64" + moduleGroupName = "" + windows { + window _viewer { + geometry = "747 297 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = BoundingBox + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + } +} +module SoTranslation { + internal { + frame = "225 333 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "562 289 270 35" + sizeHint = "270 35" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoTranslation + translation = "-5.309526920318604 11.13352870941162 7.155678272247314" + } +} +module SoCube { + internal { + frame = "345 269 80 56" + moduleGroupName = "" + windows { + window _default { + geometry = "668 446 117 97" + sizeHint = "117 97" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoCube + width = 229.0221252 + height = 251.0459595 + depth = 174.7755585 + } +} +module SoView2DPosition { + internal { + frame = "549 333 136 56" + moduleGroupName = "" + windows { + window _default { + geometry = "52 182 470 665" + sizeHint = "470 665" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoView2DPosition + drawingOn = TRUE + editingOn = FALSE + maskValid = FALSE + fixZOn = TRUE + color = "1 0 0" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = FALSE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + worldPosition = "-5.309526920318604 11.13352870941162 7.155678272247314" + firstSliceWorldPosition = "-1 -1 -1" + drawingModel = DRAWINGMODEL_CROSSHAIRS + drawingModelSize = 16 + blendOnto = 1 + blendOutside = 0 + lineWidth = 2 + colorAxes = FALSE + sagittalColor = "1 0 0" + coronalColor = "0.1725490242242813 0.886274516582489 0.0117647061124444" + axialColor = "0.007843137718737125 0.9529411792755127 0.9686274528503418" + updateOnPress = TRUE + updateOnMotion = TRUE + updateOnRelease = FALSE + cooperative = FALSE + colorBorder = FALSE + colorBorderWidth = 2 + } +} +module OrthoView2D { + internal { + frame = "517 -35 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "284 87 892 734" + sizeHint = "400 431" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = OrthoView2D + inventorInputOn = TRUE + layout = LAYOUT_CUBE_EQUAL + filterMode = FILTER_LINEAR + synchronizeZoom = TRUE + synchronizePanning = FALSE + synchronizePosition = TRUE + useGlobalInputImage = TRUE + snapToCenter = FALSE + alternCubeLayout = FALSE + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + greyWidth = 1277.099976 + greyCenter = 725.6749878 + annotationOn = TRUE + annotationSizeMode = ANNO_SHOW_DETAILED + annotationFontSize = ANNO_SIZE_AUTO + valueHighPrecision = FALSE + annoCoords = Voxel + showCurrentPos = FALSE + worldPosition = "-6.314009666442871 33.45923233032227 5.732810497283936" + coloredMode = FALSE + } + internalFields = "" +} +module WorldInfo { + internal { + frame = "-3 437 88 56" + moduleGroupName = "" + windows { + window _default { + geometry = "605 126 564 555" + sizeHint = "564 555" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = WorldInfo + pagedImgInfo = Ok + alignToAxis = TRUE + useVoxelCenter = FALSE + includeAllVoxels = TRUE + rotation = "-0.9999999999999992 0 0 0.2094395121631349" + memoryImage = "Invalid, (0,0,0,0,0,0)=0 Voxel at (0,0,0,0,0,0), " + memoryImage2 = "handled by host" + bypassIndex = -1 + inPlaceIndex = -1 + moduleName = ImgLoad + connectionValid = TRUE + dataValid = TRUE + } +} +module LocalImage { + internal { + frame = "57 549 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "331 58 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/Head3_dualecho.small.dcm + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/Head3_dualecho.small.dcm" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +connections { + SoRLAxis.inputImage = LocalImage.outImage + Negation.inToggle = WorldInfo.alignToAxis + SoToggle.on = Negation.outToggle + SoToggle.children = SoRotation.self + SoRotation.rotation = WorldInfo.rotation + extend.children = "SoMaterial2.self SoTranslation2.self SoText31.self SoSphere1.self" + SoTranslation2.translation = WorldInfo.extent + SoTranslation1.translation = WorldInfo.origin + Origin.children = "SoMaterial1.self SoTranslation1.self SoText3.self SoSphere.self" + SoExaminerViewer.children = "SoRLAxis.self extend.self Origin.self SoGVRVolumeRenderer.self BoundingBox.self" + SoGVRVolumeRenderer.image = LocalImage.outImage + BoundingBox.children = "SoMaterial.self SoTranslation.self SoToggle.self SoCube.self" + SoTranslation.translation = WorldInfo.center + SoCube.width = WorldInfo.worldSizeX + SoCube.height = WorldInfo.worldSizeY + SoCube.depth = WorldInfo.worldSizeZ + SoView2DPosition.worldPosition = WorldInfo.center + OrthoView2D.image = LocalImage.outImage + OrthoView2D.inInvPostLUT = SoView2DPosition.self + WorldInfo.input0 = LocalImage.outImage +} +networkModel = "" Added: trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCoordinate/BoxArithmetic/mlBoxArithmetic.cpp 2010-03-05 13:44:11 UTC (rev 233) @@ -0,0 +1,333 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//----------------------------------------------------------------------- +//! The ML module class BoxArithmetic. +/*! +// \file mlBoxArithmetic.cpp +// \author Reinhard Hameeteman +// \date 2008-10-28 +// +// Perform simple calculations on a (image) box +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlBoxArithmetic.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(BoxArithmetic, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +BoxArithmetic::BoxArithmetic () + : BaseOp(2, 0) +{ + ML_TRACE_IN("BoxArithmetic::BoxArithmetic ()"); + + handleNotificationOff(); + + FieldContainer *fieldC = getFieldContainer(); + + f_InBox0 = fieldC->addSubImgBoxf("inputBox0"); + f_InBox0->setSubImgBoxfValue( SubImgBoxf() ); + + f_InBox1 = fieldC->addSubImgBoxf("inputBox1"); + f_InBox1->setSubImgBoxfValue( SubImgBoxf() ); + + f_CorrectInput0 = fieldC->addBool( "correctInput0" ); + f_CorrectInput0->setBoolValue( false ); + + f_CorrectInput1 = fieldC->addBool( "correctInput1" ); + f_CorrectInput1->setBoolValue( false ); + + f_UseVoxelCenter = fieldC->addBool( "useVoxelCenter" ); + f_UseVoxelCenter->setBoolValue( false ); + + f_OutBox0 = fieldC->addSubImgBoxf("outputBox0"); + f_OutBox0->setSubImgBoxfValue( SubImgBoxf() ); + + f_OutBox1 = fieldC->addSubImgBoxf("outputBox1"); + f_OutBox1->setSubImgBoxfValue( SubImgBoxf() ); + + f_OutBox = fieldC->addSubImgBoxf("outputBox"); + f_OutBox->setSubImgBoxfValue( SubImgBoxf() ); + + f_Correct = fieldC->addBool("correctBox"); + f_Correct->setBoolValue( false ); + + f_OutExtent = fieldC->addVec6f("outputExtent"); + f_OutExtent->setVec6fValue( vec6() ); + + f_OutV1 = fieldC->addVec6f("outV1"); + f_OutV1->setVec6fValue( vec6() ); + + f_OutV2 = fieldC->addVec6f("outV2"); + f_OutV2->setVec6fValue( vec6(-1) ); + + f_Constant = fieldC->addFloat("constant"); + f_Constant->setFloatValue( 0.0f ); + + f_V1 = fieldC->addVec6f("v1"); + f_V1->setVec6fValue( vec6() ); + f_V2 = fieldC->addVec6f("v2"); + f_V2->setVec6fValue( vec6(-1) ); + + (f_BoxV0x = fieldC->addFloat("x1"))->setFloatValue( 0.0f ); + (f_BoxV0y = fieldC->addFloat("y1"))->setFloatValue( 0.0f ); + (f_BoxV0z = fieldC->addFloat("z1"))->setFloatValue( 0.0f ); + (f_BoxV0c = fieldC->addFloat("c1"))->setFloatValue( 0.0f ); + (f_BoxV0t = fieldC->addFloat("t1"))->setFloatValue( 0.0f ); + (f_BoxV0u = fieldC->addFloat("u1"))->setFloatValue( 0.0f ); + (f_BoxV1x = fieldC->addFloat("x2"))->setFloatValue( -1.0f ); + (f_BoxV1y = fieldC->addFloat("y2"))->setFloatValue( -1.0f ); + (f_BoxV1z = fieldC->addFloat("z2"))->setFloatValue( -1.0f ); + (f_BoxV1c = fieldC->addFloat("c2"))->setFloatValue( -1.0f ); + (f_BoxV1t = fieldC->addFloat("t2"))->setFloatValue( -1.0f ); + (f_BoxV1u = fieldC->addFloat("u2"))->setFloatValue( -1.0f ); + + const char* modes[LastMode] = {"ExpandScalar","ExpandVector", "AddScalar", "AddVector", "Intersect", "Unify" }; + f_OperationMode = fieldC->addEnum("operationMode", modes, LastMode); + f_OperationMode->setEnumValue( Intersect ); + + const char* inputModes0[4] = {"Box", "Input0", "Scalars", "Vectors"}; + f_InputMode0 = fieldC->addEnum("inputMode0", inputModes0, 4); + + const char* inputModes1[4] = {"Box", "Input1", "Scalars", "Vectors"}; + f_InputMode1 = fieldC->addEnum("inputMode1", inputModes1, 4); + + m_LockUpdate = false; + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void BoxArithmetic::handleNotification (Field *field) +{ + ML_TRACE_IN("BoxArithmetic::handleNotification ()"); + + if (m_LockUpdate) {return;} + m_LockUpdate = true; + + SubImgBoxf newBox = SubImgBoxf(); + SubImgBoxf box0 = SubImgBoxf(); + SubImgBoxf box1 = SubImgBoxf(); + + double center = 0.0; + if ( f_UseVoxelCenter->getBoolValue() ) {center = 0.5;} + + //Box0 + switch ( f_InputMode0->getEnumValue() ){ + case Box0: + { + box0 = f_InBox0->getSubImgBoxfValue(); + } + break; + case Input0: + { + PagedImg *inImage = getNonDummyUpdatedInImg( 0 ); + if ( inImage != NULL ) { + const Vector size = inImage->getImgExt(); + const vec3 firstVoxel(center,center,center); + const vec3 lastVoxel(size.x-1+center,size.y-1+center,size.z-1+center); + vec3 imageOrigin; + vec3 imageExtent; + inImage->transformToWorldCoord( firstVoxel,imageOrigin ); + inImage->transformToWorldCoord( lastVoxel, imageExtent ); + box0 = SubImgBoxf(vec6(imageOrigin,0.0,0.0,0.0), vec6(imageExtent,0.0,0.0,0.0)); + } else { + box0.makeEmpty(); + } + } + break; + case Scalars0: + { + vec6 v1 = vec6( f_BoxV0x->getFloatValue(),f_BoxV0y->getFloatValue(),f_BoxV0z->getFloatValue(), + f_BoxV0c->getFloatValue(),f_BoxV0t->getFloatValue(),f_BoxV0u->getFloatValue()); + vec6 v2 = vec6( f_BoxV1x->getFloatValue(),f_BoxV1y->getFloatValue(),f_BoxV1z->getFloatValue(), + f_BoxV1c->getFloatValue(),f_BoxV1t->getFloatValue(),f_BoxV1u->getFloatValue()); + box0 = SubImgBoxf( v1,v2 ); + } + break; + case Vectors0: + { + box0 = SubImgBoxf( f_V1->getVec6fValue(), f_V2->getVec6fValue() ); + } + break; + default: + break; + } + if ( f_CorrectInput0->getBoolValue() ){ + box0.correct(); + } + f_OutBox0->setSubImgBoxfValue( box0 ); + + //Box1 + switch ( f_InputMode1->getEnumValue() ){ + case Box1: + { + box1 = f_InBox1->getSubImgBoxfValue(); + } + break; + case Input1: + { + PagedImg *inImage = getNonDummyUpdatedInImg( 1 ); + if ( inImage != NULL ) { + const Vector size = inImage->getImgExt(); + const vec3 firstVoxel(center,center,center); + const vec3 lastVoxel(size.x-1+center,size.y-1+center,size.z-1+center); + vec3 imageOrigin; + vec3 imageExtent; + inImage->transformToWorldCoord( firstVoxel,imageOrigin ); + inImage->transformToWorldCoord( lastVoxel, imageExtent ); + box1 = SubImgBoxf(vec6(imageOrigin,0.0,0.0,0.0), vec6(imageExtent,0.0,0.0,0.0)); + } else { + box1.makeEmpty(); + } + if ( f_CorrectInput1->getBoolValue() ){ + box1.correct(); + } + } + break; + case Scalars1: + { + vec6 v1 = vec6( f_BoxV0x->getFloatValue(),f_BoxV0y->getFloatValue(),f_BoxV0z->getFloatValue(), + f_BoxV0c->getFloatValue(),f_BoxV0t->getFloatValue(),f_BoxV0u->getFloatValue()); + vec6 v2 = vec6( f_BoxV1x->getFloatValue(),f_BoxV1y->getFloatValue(),f_BoxV1z->getFloatValue(), + f_BoxV1c->getFloatValue(),f_BoxV1t->getFloatValue(),f_BoxV1u->getFloatValue()); + box1 = SubImgBoxf( v1,v2 ); + if ( f_CorrectInput1->getBoolValue() ){ + box1.correct(); + } + } + break; + case Vectors1: + { + box1 = SubImgBoxf( f_V1->getVec6fValue(), f_V2->getVec6fValue() ); + } + default: + break; + } + if ( f_CorrectInput1->getBoolValue() ){ + box1.correct(); + } + f_OutBox1->setSubImgBoxfValue( box1 ); + + switch ( f_OperationMode->getEnumValue() ) { + case ExpandScalar: + { + vec6 v1 = box0.v1; + vec6 v2 = box0.v2; + const double constant = (double)f_Constant->getFloatValue(); + v1[0] -= constant; + v1[1] -= constant; + v1[2] -= constant; + v2[0] += constant; + v2[1] += constant; + v2[2] += constant; + newBox.v1 = v1; + newBox.v2 = v2; + break; + } + case ExpandVector: + { + const vec6 constant = f_V1->getVec6fValue(); + newBox.v1 = box0.v1 - constant; + newBox.v2 = box0.v2 + constant; + break; + } + case AddScalar: + { + vec6 v1 = box0.v1; + vec6 v2 = box0.v2; + const double constant = (double)f_Constant->getFloatValue(); + v1[0] += constant; + v1[1] += constant; + v1[2] += constant; + v2[0] += constant; + v2[1] += constant; + v2[2] += constant; + newBox.v1 = v1; + newBox.v2 = v2; + break; + } + case AddVector: + { + const vec6 constant = f_V1->getVec6fValue(); + newBox.v1 = box0.v1 + constant; + newBox.v2 = box0.v2 + constant; + break; + } + ca... [truncated message content] |
From: <rha...@us...> - 2010-03-05 12:04:48
|
Revision: 232 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=232&view=rev Author: rhameeteman Date: 2010-03-05 12:04:36 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * Added a new MLCMCurveList project with two new modules: CurveFilter StringToCurve Added Paths: ----------- trunk/Community/General/Modules/ML/MLCMCurveList/ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/ trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab trunk/Community/General/Sources/ML/MLCMCurveList/ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h Added: trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilter.html 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,101 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>CurveFilter</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module filters out curves from a curvlist based on the given min and max index. Additionally it can crop all curves between two indices. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect the input curve list,specify the first and last index and press Update or select "Auto update". +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>The min and max of the Set specify the first and last CurveData object from a CurveList object. If one of the CurveData objects from the CurveList has more than one series defined, you can choose the first and last index of the Series of all CurveData objects in the list. If all CurveData objects only have one series defined, you cannot choose the Series.<br/> +The output curves can also be croped to a specified start and end index.<br/> +If "Auto update" is selected, the module reacts on all input and parameter changes +</blockquote> + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>inCurveList</b> + Input CurveData or CurveList object + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outCurveList</b> + Filtered CurveList + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>update</b> + Update the output + </li> + <li> + <b>autoUpdate</b> + Auto update on input or parameter changes + </li> + <li> + <b>minCurveSet</b> + First curve set to be copied to the output + </li> + <li> + <b>maxCurveSet</b> + Last curve set to be copied to the output + </li> + <li> + <b>minCurve</b> + First curve to be copied to the output + </li> + <li> + <b>maxCurve</b> + Last curve to be copied to the output + </li> + <li> + <b>cropCurve</b> + Crop all autoput curves + </li> + <li> + <b>start</b> + First index of the croped curve + </li> + <li> + <b>end</b> + Last index of the croped curve + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/CurveFilter/CurveFilterExample.mlab 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,470 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoView2DMarkerEditor { + internal { + frame = "-119 -123 160 56" + moduleGroupName = "" + windows { + window _default { + geometry = "635 95 435 831" + sizeHint = "435 831" + wasOpen = no + wasActive = no + } + } + } + fields { + drawingOn = TRUE + editingOn = TRUE + maskValid = FALSE + fixZOn = TRUE + color = "1 1 1" + selectionTolerance = 4 + needsValidVoxel = TRUE + button1 = PRESSED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + control = IGNORED + alt = IGNORED + wantsAllEvents = FALSE + wantsKeyEvents = TRUE + wantsMouseWheelEvents = FALSE + setEventHandled = FALSE + ignoreHandledEvents = FALSE + createNewMode = FALSE + renderOnSlab = FALSE + clipToSlice = FALSE + cursorShape = UNDEFINED_CURSOR + depthVisibility = 1 + snapToVoxel = TRUE + snapToSlice = TRUE + currentType = 0 + deleteOnClick = FALSE + addOnClick = TRUE + alphaFactor = 1 + iconFile = $(MLAB_MeVisLab_Standard)/Modules/Resources/Images/markerIcons.tif + internalIconFile = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Standard/Modules/Resources/Images/markerIcons.tif" + useIconFile = FALSE + iconIdx = 0 + selectingOn = TRUE + actOnReleaseOnly = FALSE + editorMode = EDIT_MARKER + colorMode = COLOR_BY_INDEX + textColorMode = COLOR_TEXT + textMode = TEXT_OFF + textColor = "1 1 1" + textShadow = TRUE + textFontSize = 12 + showTextOnlyForSelectedMarker = FALSE + cutText = FALSE + maxNumberOfLines = 1 + vectorArrow = VECTOR_END_ARROW + useAntiAlias = FALSE + currentStyleIndex = 1 + depthVectorDrawMode = DRAW_NONE + drawMode = DRAW_MARKER + selectiveDrawing = FALSE + selectionBoxesForCurrentOnly = FALSE + cooperative = FALSE + busy = FALSE + instanceName = SoView2DMarkerEditor + listString = "" + numItems = 10 + index = 9 + persistent = FALSE + listStringEnable = FALSE + ownsList = TRUE + applySelect = FALSE + id = 10 + name = "" + newName = "" + actionClass = Modify + actionIndex = 9 + actionId = 10 + currentIndex = 9 + overflowMode = None + maxSize = 0 + useInsertTemplate = FALSE + upToDate = TRUE + posXYZ = "-78.75 -69.94419860839844 7.032798767089844" + posC = 0 + posT = 0 + posU = 0 + vecXYZ = "0 0 0" + type = 0 + newPosXYZ = "0 0 0" + newPosC = 0 + newPosT = 0 + newPosU = 0 + newVecXYZ = "0 0 0" + newType = 0 + } +} +module View2D { + internal { + frame = "-211 -227 120 56" + moduleGroupName = "" + windows { + window _default { + geometry = "75 239 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + window Settings { + geometry = "29 51 265 290" + sizeHint = "265 290" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = View2D + inventorInputOn = TRUE + view2DExtensionsOn = TRUE + startSlice = 0 + numSlices = 1 + numXSlices = 1 + sliceStep = 1 + slab = 1 + blendMode = BLEND_REPLACE + timePoint = 0 + maxTimePoint = 5 + filterMode = FILTER_LINEAR + standardKeys = TRUE + cineMode = CINE_Z + cineDirection = CINE_PINGPONG + cineRepeat = CINE_ONCE + cineSpeed = 0.1000000015 + snapToCenter = FALSE + zoomMode = VIEW2D_AUTO_ZOOM + unzoomOnImageChange = FALSE + sliceZoom = 1 + sliceZoomSynced = 1 + baseColor = "1 1 1" + margin = "2 2" + sliceOrigin = "0 0" + lutCenter = 242.2030945 + lutWidth = 453.5469055 + lutUseTraceColors = FALSE + annotationOn = TRUE + annotationMode = ANNO_MODE_AUTO + annotationSizeMode = ANNO_SHOW_DETAILED + annotationCol = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + annotationFontSize = ANNO_SIZE_AUTO + annoCoords = Voxel + annoCTValue = AsIs + borderOn = TRUE + borderColor = "0.8999999761581421 0.8999999761581421 0.8999999761581421" + valueHighPrecision = FALSE + plane = "0 1 0 -69.94419860839844" + } + internalFields = "" +} +module Diagram2D { + internal { + frame = "89 -299 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "246 265 458 405" + sizeHint = "458 405" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 5 + autoRangeX = TRUE + minY = -23 + maxY = 41 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = FALSE + diagramTitleString = "" + borderH = 30 + autoBorderH = TRUE + borderV = 25 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 0.709764 0.369494" + lineStyle = Solid + markerType = Square + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = 1.265059948 + mousePosY = 17.40570068 + mousePosValid = TRUE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = TRUE + } +} +module SoRenderArea { + internal { + frame = "81 -363 112 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "796 119 400 400" + sizeHint = "400 400" + wasOpen = yes + wasActive = no + } + } + } + fields { + instanceName = SoRenderArea + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = DELAYED_BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 15 + frameRateAvi = 7 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + } +} +module DynaCurve { + internal { + frame = "125 -123 104 56" + moduleGroupName = "" + windows { + window _default { + geometry = "224 243 334 326" + sizeHint = "334 326" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = DynaCurve + displayPoints = TRUE + displayROIs = TRUE + ROIMode = All + ROIData = Mean + ROIStyle = ErrorBar + refTime = 0 + refTimeEnable = TRUE + refTimeMode = Difference + timeUnit = Seconds + timeData = NonConstant + timeDataValid = FALSE + dataUnit = "" + dataSymbol = E + ImageLabel = "" + } +} +module StylePalette { + internal { + frame = "-55 -19 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "26 59 632 433" + sizeHint = "632 433" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 2 + markerSize2 = 2 + markerSize3 = 2 + markerSize4 = 2 + markerSize5 = 2 + markerSize6 = 2 + markerSize7 = 2 + markerSize8 = 2 + markerSize9 = 2 + markerSize10 = 2 + markerSize11 = 2 + markerSize12 = 2 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module LocalImage { + internal { + frame = "-63 125 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "180 199 458 242" + sizeHint = "458 242" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = LocalImage + name = $(DemoDataPath)/dmribreast.dcm + trueName = "C:/Program Files/MeVisLab2.0VC9/Packages/MeVisLab/Resources/DemoData/dmribreast.dcm" + autoLoad = TRUE + status = "File open" + } + internalFields = "" +} +module CurveFilter { + internal { + frame = "137 -195 96 56" + moduleGroupName = "" + windows { + window _default { + geometry = "202 515 304 264" + sizeHint = "304 264" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = CurveFilter + autoUpdate = TRUE + numberOfCurveSets = 9 + minCurve = 0 + maxCurve = 0 + numberOfCurves = 0 + cropCurve = FALSE + start = 0 + end = 0 + } +} +connections { + SoView2DMarkerEditor.stylePalette = StylePalette.outStylePalette + View2D.inImage = LocalImage.outImage + View2D.inInvPreLUT = SoView2DMarkerEditor.self + Diagram2D.inStylePalette = StylePalette.outStylePalette + Diagram2D.inCurveList = CurveFilter.outCurveList + SoRenderArea.children = Diagram2D.outNode + DynaCurve.input0 = LocalImage.outImage + DynaCurve.inPointList = SoView2DMarkerEditor.outXMarkerList + CurveFilter.inCurveList = DynaCurve.outCurveList +} +networkModel = "" Added: trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/MLCMCurveList.def 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,117 @@ +//---------------------------------------------------------------------------------- +//! MLCMCurveList module definitions. +/*! +// \file MLCMCurveList.def +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------- +// MLModule CurveFilter +//---------------------------------------------------------------------------------- +MLModule CurveFilter { + DLL = "MLCMCurveList" + group = "BIGR" + genre = "Diagram" + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Select a curve from the curveList or curveSet" + keywords = "curveList curveData curve filter" + seeAlso = "CurveArithmetic CatCurves" + documentation = "$(LOCAL)/CurveFilter/CurveFilter.html" + exampleNetwork = "$(LOCAL)/CurveFilter/CurveFilterExample.mlab" + + Description { + Field minCurveSet { + min = 0 + max = numberOfCurveSets + deprecatedName = curveSet + persistent = No + } + Field maxCurveSet { + min = 0 + max = numberOfCurveSets + persistent = No + } + Field minCurve { + min = 0 + max = numberOfCurves + deprecatedName = curve + } + Field maxCurve { + min = 0 + max = numberOfCurves + } + } + Window { + Vertical { + Box Select { + Horizontal { + Label {title = Set labelAlignGroup = g0} + Field minCurveSet { title = "" } + IntervalSlider { + expandX = true + step = 1 + snap = 0 + lowerField = minCurveSet + upperField = maxCurveSet + } + Field maxCurveSet { title = "" } + } + Horizontal { + Label {title = Series labelAlignGroup = g0 } + Field minCurve { title = "" } + IntervalSlider { + expandX = true + step = 1 + snap = 0 + lowerField = minCurve + upperField = maxCurve + } + Field maxCurve { title = "" } + } + } + Box Crop { + CheckBox cropCurve {} + Field start { dependsOn = cropCurve } + Field end { dependsOn = cropCurve } + } + Box Update{ + layout = Horizontal + Button update {} + CheckBox autoUpdate {} + } + } + } +} // MLModule CurveFilter + + +//---------------------------------------------------------------------------------- +// MLModule StringToCurve +//---------------------------------------------------------------------------------- +MLModule StringToCurve { + DLL = "MLCMCurveList" + group = "BIGR" + genre = Diagram + author = "Reinhard Hameeteman" + status = "work-in-progress" + comment = "Convert a string into a curve" + keywords = "string curve convert curvelist curvedata" + seeAlso = "PrintCurves" + documentation = "$(LOCAL)/StringToCurve/StringToCurve.html" + exampleNetwork = "$(LOCAL)/StringToCurve/StringToCurveExample.mlab" + +Window { + Box { + Horizontal { + Field curveSeparator { title = curveSeparators } + Field valueSeparator { title = valueSeparators } + } + Field curveString {} + Field indexString {} + } +} + +} // MLModule StringToCurve Added: trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurve.html 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,69 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> + +<hr WIDTH="100%"></center> +<h2>StringToCurve</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module can be used to generate a curve or multiple curves by splitting a string based on seperation characters for curves and values +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Simply supply the string and specify the splitting characters +</blockquote> + + + + + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outCurveList</b> + CurveList containing the generated curves + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>curveString</b> + String containing all the curve data + </li> + <li> + <b>indexString</b> + Optional string with the indices of all the curve points + </li> + <li> + <b>valueSeparator</b> + Characters that split the curve into values + </li> + <li> + <b>curveSeparator</b> + Characters that split the string into curves + </li> + </ul> + +</blockquote> + + + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab =================================================================== --- trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab (rev 0) +++ trunk/Community/General/Modules/ML/MLCMCurveList/StringToCurve/StringToCurveExample.mlab 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,228 @@ +// MDL v1 utf8 +network { + watchlist = "" +} +module SoRenderArea { + internal { + frame = "65 -267 112 56" + moduleGroupName = "" + windows { + window _viewer { + geometry = "524 189 400 400" + sizeHint = "400 400" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = SoRenderArea + renderCaching = AUTO + boundingBoxCaching = AUTO + renderCulling = AUTO + pickCulling = AUTO + border = FALSE + background = "0 0 0" + transparency = BLEND + antialiasing = FALSE + antialiasingNumPasses = 1 + grabKeyFocus = TRUE + snapshotFormat = SNAPSHOT_RGB + outputAviFile = "" + autoRedrawWhenRecording = TRUE + frameRate = 7 + frameRateAvi = 15 + status = ready + outputSnapshotFile = none + outputSnapshotFileWritten = none + autoIncreaseFile = TRUE + autoUpdateML = FALSE + showSnapshotWithShell = FALSE + snapCount = 0 + } +} +module StylePalette { + internal { + frame = "-31 -59 96 56" + moduleGroupName = "" + } + fields { + instanceName = StylePalette + color1 = "1 1 0" + color2 = "1 0 0" + color3 = "0 0 1" + color4 = "0 1 0" + color5 = "1 0.5 0" + color6 = "1 0 1" + color7 = "0 1 1" + color8 = "0.5 1 0.5" + color9 = "1 0 0.5" + color10 = "0.5 1 0" + color11 = "0.5 0 1" + color12 = "0 1 0.5" + lineStyle1 = Solid + lineStyle2 = Solid + lineStyle3 = Solid + lineStyle4 = Solid + lineStyle5 = Solid + lineStyle6 = Solid + lineStyle7 = Solid + lineStyle8 = Solid + lineStyle9 = Solid + lineStyle10 = Solid + lineStyle11 = Solid + lineStyle12 = Solid + lineWidth1 = 1 + lineWidth2 = 1 + lineWidth3 = 1 + lineWidth4 = 1 + lineWidth5 = 1 + lineWidth6 = 1 + lineWidth7 = 1 + lineWidth8 = 1 + lineWidth9 = 1 + lineWidth10 = 1 + lineWidth11 = 1 + lineWidth12 = 1 + markerType1 = None + markerType2 = None + markerType3 = None + markerType4 = None + markerType5 = None + markerType6 = None + markerType7 = None + markerType8 = None + markerType9 = None + markerType10 = None + markerType11 = None + markerType12 = None + markerSize1 = 4 + markerSize2 = 4 + markerSize3 = 4 + markerSize4 = 4 + markerSize5 = 4 + markerSize6 = 4 + markerSize7 = 4 + markerSize8 = 4 + markerSize9 = 4 + markerSize10 = 4 + markerSize11 = 4 + markerSize12 = 4 + antiAlias1 = FALSE + antiAlias2 = FALSE + antiAlias3 = FALSE + antiAlias4 = FALSE + antiAlias5 = FALSE + antiAlias6 = FALSE + antiAlias7 = FALSE + antiAlias8 = FALSE + antiAlias9 = FALSE + antiAlias10 = FALSE + antiAlias11 = FALSE + antiAlias12 = FALSE + name1 = "" + name2 = "" + name3 = "" + name4 = "" + name5 = "" + name6 = "" + name7 = "" + name8 = "" + name9 = "" + name10 = "" + name11 = "" + name12 = "" + currentStyle = 0 + currentColor = "1 1 1" + currentLineStyle = None + currentLineWidth = 1 + currentMarkerType = None + currentMarkerSize = 4 + currentAntiAlias = FALSE + currentName = "" + reservedEntries = 0 + } +} +module Diagram2D { + internal { + frame = "73 -179 96 56" + moduleGroupName = "" + } + fields { + instanceName = Diagram2D + minX = 0 + maxX = 4 + autoRangeX = TRUE + minY = -1 + maxY = 11 + autoRangeY = TRUE + axisColor = "1 1 1" + axisRotation = LeftBottom + drawDiagramTitle = FALSE + diagramTitleString = "" + borderH = 26 + autoBorderH = TRUE + borderV = 25 + autoBorderV = TRUE + drawAxisX = TRUE + drawTicksX = TRUE + drawLabelsX = TRUE + drawAxisTitleX = FALSE + axisTitleStringX = "X [dn]" + drawAxisY = TRUE + drawTicksY = TRUE + drawLabelsY = TRUE + drawAxisTitleY = FALSE + axisTitleStringY = "Y [dn]" + curveColor = "1 1 1" + lineStyle = Solid + markerType = None + markerSize = 10 + areaOpacity = 0.5 + lineWidth = 1 + antiAlias = FALSE + button1 = IGNORED + button2 = IGNORED + button3 = IGNORED + shift = IGNORED + ctrl = IGNORED + alt = IGNORED + mousePosX = -0.3023256063 + mousePosY = 11.83236885 + mousePosValid = TRUE + curveSelection = Diagram + selectionTolerance = 5 + selectedCurve = -1 + selectedSeries = -1 + selectedSeriesGlobal = -1 + selectedPoint = -1 + maskValid = TRUE + } +} +module StringToCurve { + internal { + frame = "73 -59 112 56" + moduleGroupName = "" + windows { + window _default { + geometry = "145 569 327 97" + sizeHint = "327 97" + wasOpen = no + wasActive = no + } + } + } + fields { + instanceName = StringToCurve + curveString = "1 2 3 4 5;0 2 4 6 8@-1.2.5.8.11" + indexString = "" + valueSeparator = " ." + curveSeparator = ";@" + } +} +connections { + SoRenderArea.children = Diagram2D.outNode + Diagram2D.inStylePalette = StylePalette.outStylePalette + Diagram2D.inCurveList = StringToCurve.outCurveList +} +networkModel = "" Added: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.cpp 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,237 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CurveFilter. +/*! +// \file mlCurveFilter.cpp +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "mlCurveFilter.h" +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(CurveFilter, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +CurveFilter::CurveFilter (void) + : BaseOp(0, 0), m_InCurveList(0) +{ + ML_TRACE_IN("CurveFilter::CurveFilter()"); + + handleNotificationOff(); + + FieldContainer *fields = getFieldContainer(); + + m_InCurveList = NULL; + f_InCurveList = fields->addBase( "inCurveList" ); + f_InCurveList->setBaseValue( m_InCurveList ); + + m_OutCurveList = new CurveList; + f_OutCurveList = fields->addBase( "outCurveList" ); + f_OutCurveList->setBaseValue( m_OutCurveList ); + + f_Update = fields->addNotify( "update" ); + f_AutoUpdate = fields->addBool( "autoUpdate" ); + f_AutoUpdate->setBoolValue( false ); + + f_MinCurveSet = fields->addInt( "minCurveSet" ); + f_MinCurveSet->setIntValue( 0 ); + + f_MaxCurveSet = fields->addInt( "maxCurveSet" ); + f_MaxCurveSet->setIntValue( 0 ); + + f_NumberOfCurveSets = fields->addInt( "numberOfCurveSets" ); + f_NumberOfCurveSets->setIntValue( 0 ); + + f_MinCurve = fields->addInt("minCurve"); + f_MinCurve->setIntValue( 0 ); + + f_MaxCurve = fields->addInt("maxCurve"); + f_MaxCurve->setIntValue( 0 ); + + f_NumberOfCurves = fields->addInt( "numberOfCurves" ); + f_NumberOfCurves->setIntValue( 0 ); + + f_CropCurve = fields->addBool( "cropCurve" ); + f_CropCurve->setBoolValue( false ); + + f_XStart = fields->addFloat( "start" ); + f_XStart->setFloatValue( 0.0f ); + + f_XEnd = fields->addFloat( "end" ); + f_XEnd->setFloatValue( 0.0f ); + + handleNotificationOn(); +} + + +CurveFilter::~CurveFilter(void) +{ + ResetOutput(); + delete m_OutCurveList; +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void CurveFilter::handleNotification (Field *field) +{ + ML_TRACE_IN("CurveFilter::handleNotification()"); + + if ( field == f_InCurveList ) { + m_SingleCurveList.clear(); + if ( f_InCurveList->getBaseValue() ) { + Base* inList = f_InCurveList->getBaseValue(); + m_InCurveList = NULL; + if ( BASE_IS_A(inList, CurveData) ) { + // Input is a single curve + m_SingleCurveList.getCurveList().push_back( static_cast<CurveData*>( inList ) ); + m_InCurveList = &m_SingleCurveList; + } + else if ( BASE_IS_A( inList, CurveList) ) { + // Input is not a CurveData object or a CurveList + m_InCurveList = static_cast<CurveList*>( f_InCurveList->getBaseValue() ); + } + } + SetMaxValues(); + + if ( m_InCurveList != NULL ) { + if ( f_AutoUpdate->getBoolValue() ){ + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } else { + ResetOutput(); + f_OutCurveList->notifyAttachments(); + } + + } else + if ( field == f_Update || + (f_AutoUpdate->getBoolValue() && + (field == f_AutoUpdate || + field == f_MinCurveSet || + field == f_MaxCurveSet || + field == f_MinCurve || + field == f_MaxCurve || + field == f_CropCurve || + (f_CropCurve->getBoolValue() && ( field == f_XStart || field == f_XEnd )) + ))){ + if ( m_InCurveList != NULL ){ + if ( m_InCurveList->getNumCurves() > 0 ){ + SetOutputCurve(); + f_OutCurveList->notifyAttachments(); + } + } + } +} + + +void CurveFilter::ResetOutput() +{ + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } +} + + +void CurveFilter::SetMaxValues() +{ + int nCurveSets = 0; + int nCurves = 0; + if ( m_InCurveList != NULL ){ + nCurveSets = m_InCurveList->getNumCurves(); + for (int iSet = 0; iSet < nCurveSets; ++iSet ) { + nCurves = max( nCurves, m_InCurveList->getCurveData( iSet )->getNumSeries() ); + } + } + f_NumberOfCurveSets->setIntValue( nCurveSets-1 ); + f_NumberOfCurves->setIntValue( nCurves-1 ); +} + + +void CurveFilter::SetOutputCurve(){ + + ResetOutput(); + + // Check for valid field values + // Curves are numbered from 0 + int nCurveSets = m_InCurveList->getNumCurves(); + if ( nCurveSets == 0 ) {return;} + int minSet = max( 0, f_MinCurveSet->getIntValue() ); + int maxSet = max( minSet, f_MaxCurveSet->getIntValue() ); + maxSet = min( maxSet, nCurveSets-1 ); + for (int iSet = minSet; iSet <= maxSet; ++iSet ) { + + int nCurves = m_InCurveList->getCurveData( iSet )->getNumSeries(); + if (nCurves == 0 ) {continue;} + int minCurve = max(0,f_MinCurve->getIntValue() ); + int maxCurve = max(minCurve, f_MaxCurve->getIntValue() ); + maxCurve = min(maxCurve, nCurves-1 ); + for (int iCurve = minCurve; iCurve <= maxCurve; ++iCurve ) { + + CurveData *curveSet = m_InCurveList->getCurveData( iSet ); + CurveData *outputCurve = new CurveData( *curveSet ); + outputCurve->clearData(); + std::vector< float > xSeries; + std::vector< float > ySeries; + + // Copy/Crop curve values + bool crop = f_CropCurve->getBoolValue(); + float minX = f_XStart->getFloatValue(); + float maxX = f_XEnd->getFloatValue(); + minX = min(minX,maxX); + for (int iX = 0; iX < curveSet->getPoints(); ++iX ){ + float xValue = curveSet->getXValue( iX ); + if ( !crop || ( (minX<=xValue) && (xValue <= maxX)) ) { + ySeries.push_back( curveSet->getYValue( minCurve, iX) ); + xSeries.push_back( xValue ); + } + } + outputCurve->setX( xSeries.size(),&xSeries[0], 1 ); + outputCurve->setY( ySeries.size(),&ySeries[0], 1 ); + + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } +} + + +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/CurveFilter/mlCurveFilter.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,123 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class CurveFilter. +/*! +// \file mlCurveFilter.h +// \author Reinhard Hameeteman +// \date 2008-03-03 +// +// Select a curve from the curveList or curveSet +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlCurveFilter_H +#define __mlCurveFilter_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Select a curve from the curveList or curveSet +class MLCMCURVELIST_EXPORT CurveFilter : public BaseOp +{ +public: + + //! Constructor. + CurveFilter (void); + + //! Destructor + ~CurveFilter(void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + void SetOutputCurve(); + + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(CurveFilter); + + //! Remove any existing output curves + void ResetOutput(); + + //! Set the maximum values allowed for curves and series. + void SetMaxValues(); + + //! Input curve data + CurveList *m_InCurveList; + BaseField *f_InCurveList; + CurveList m_SingleCurveList; + + //! Output curve data + CurveList *m_OutCurveList; + BaseField *f_OutCurveList; + + //! Update modes + NotifyField *f_Update; + BoolField *f_AutoUpdate; + + //! Curve set range + IntField *f_MinCurveSet; + IntField *f_MaxCurveSet; + + //! Curve series range + IntField *f_MinCurve; + IntField *f_MaxCurve; + + //! Number of curves present in input + IntField *f_NumberOfCurveSets; + + //! Number of series present in input + IntField *f_NumberOfCurves; + + //! Crop the curve? + BoolField *f_CropCurve; + FloatField *f_XStart; + FloatField *f_XEnd; + +}; + + +ML_END_NAMESPACE + +#endif // __mlCurveFilter_H + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.bat 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" MLCMCurveList Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.pro 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,50 @@ +# ----------------------------------------------------------------------------- +# MLCMCurveList project profile +# +# \file MLCMCurveList.pro +# \author Reinhard Hameeteman +# \date 2010-03-05 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = MLCMCurveList + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# add dependencies of this project here + +CONFIG += dll ML MLBase newmat nr EMCUtilities inventor MLOpenGL boost + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + + +MLAB_PACKAGES += MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += MLCMCURVELIST_EXPORTS + +HEADERS += \ + MLCMCurveListInit.h \ + MLCMCurveListSystem.h \ + CurveFilter/mlCurveFilter.h \ + StringToCurve/mlStringToCurve.h \ + +SOURCES += \ + MLCMCurveListInit.cpp \ + CurveFilter/mlCurveFilter.cpp \ + StringToCurve/mlStringToCurve.cpp \ + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/MLCMCurveList/MLCMCurveList.def + + + + + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveList.sh 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Run this script to create a Makefile for your project +# + +# Check for Mac OS X +if [ "`uname -s`" = "Darwin" ]; then + +echo "Please use 'open -b de.mevis.MeVisLab.MacProfileTranslator MLCMCurveList.pro' or 'open MLCMCurveList.pro'" + +# Linux case +else + +# Print usage-info +function usage () { + echo "MLCMCurveList [-d|-r]" + echo "Creates Makefile.MLCMCurveList - run \"make -f Makefile.MLCMCurveList\" to build your module" + echo " -r : create Makefile for release-version (libMLCMCurveList.so)" + echo " -d : create Makefile for debug-version (libMLCMCurveList_d.so)" + exit 1 +} + +# Check arguments +if test "(" "$#" -gt "1" ")" -o "(" "(" "$#" = "1" ")" -a "(" "$1" != "-r" ")" -a "(" "$1" != "-d" ")" ")" +then + usage +fi + +# Switch debug/release/default +if [ "$1" = "-d" ];then + DEBUG=1 +elif [ "$1" = "-r" ];then + DEBUG=0 +else + DEBUG=$(cat /proc/$PPID/cmdline|grep -c MeVisLab_d) +fi + +if [ "$DEBUG" = "1" ];then + VERSION="Debug-Version" + FLAG="debug" + EXT="_d" +else + VERSION="Release-Version" + FLAG="release" + EXT="" +fi + +echo "Creating Makefile.MLCMCurveList for $VERSION (libMLCMCurveList$EXT.so)" +qmake -t lib -o Makefile.MLCMCurveList "CONFIG+=$FLAG" "CONFIG+=MeVisLab" MLCMCurveList.pro + +fi + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.cpp 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMCurveListInit.cpp +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "MLCMCurveListSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... + + +#include "CurveFilter/mlCurveFilter.h" +#include "StringToCurve/mlStringToCurve.h" + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int MLCMCurveListInit (void) +{ + ML_TRACE_IN("MLCMCurveListInit ()") + + // Add initClass calls from all other modules here... + + CurveFilter::initClass(); + StringToCurve::initClass(); + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(MLCMCurveListInit) + + + + + + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListInit.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLCMCurveListInit.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMCurveListInit_H +#define __MLCMCurveListInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int MLCMCurveListInit (void); + +ML_END_NAMESPACE + +#endif // __MLCMCurveListInit_H + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/MLCMCurveListSystem.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLCMCurveListSystem.h +// \author Reinhard Hameeteman +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLCMCurveListSystem_H +#define __MLCMCurveListSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef MLCMCURVELIST_EXPORTS +// Use the MLCMCURVELIST_EXPORT macro to export classes and functions +#define MLCMCURVELIST_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define MLCMCURVELIST_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define MLCMCURVELIST_EXPORT +#endif + + +#endif // __MLCMCurveListSystem_H + + Added: trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.cpp 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,171 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class StringToCurve. +/*! +// \file mlStringToCurve.cpp +// \author Reinhard Hameeteman +// \date 2009-03-18 +// +// Convert a string into a curve +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlStringToCurve.h" + +#include <boost/algorithm/string.hpp> +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(StringToCurve, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +StringToCurve::StringToCurve () : BaseOp(0, 0) +{ + ML_TRACE_IN("StringToCurve::StringToCurve ()") + + handleNotificationOff(); + + FieldContainer *fieldC = getFieldContainer(); + + m_OutCurveList = new CurveList; + f_OutCurveList = fieldC->addBase( "outCurveList" ); + f_OutCurveList->setBaseValue( m_OutCurveList ); + + f_CurveString = fieldC->addString("curveString"); + f_CurveString->setStringValue(""); + + f_IndexString = fieldC->addString("indexString"); + f_IndexString->setStringValue(""); + + f_ValueSeparator = fieldC->addString("valueSeparator"); + f_ValueSeparator->setStringValue(" "); + + f_CurveSeparator = fieldC->addString( "curveSeparator" ); + f_CurveSeparator->setStringValue(";"); + + handleNotificationOn(); +} + + +StringToCurve::~StringToCurve() +{ + // Remove any existing curves + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } + delete m_OutCurveList; +} + + +void StringToCurve::activateAttachments() +{ + UpdateCurve(); + f_OutCurveList->notifyAttachments(); + BaseOp::activateAttachments(); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void StringToCurve::handleNotification (Field *field) +{ + ML_TRACE_IN("StringToCurve::handleNotification ()"); + + UpdateCurve(); + f_OutCurveList->notifyAttachments(); +} + + +void StringToCurve::UpdateCurve() +{ + // Remove any existing curves + while ( !m_OutCurveList->getCurveList().empty() ) { + delete m_OutCurveList->getCurveList().back(); + m_OutCurveList->getCurveList().pop_back(); + } + + std::string dataString = f_CurveString->getStringValue(); + dataString.append( f_CurveSeparator->getStringValue() ); + + std::string indexString = f_IndexString->getStringValue(); + std::vector< float > indexValues; + if (indexString.length() != 0 ){ + StringToVector(indexString, indexValues ); + } + + if ( dataString.length() > 0 ){ + // Split string into curves + std::vector<std::string> curves; + boost::split(curves, dataString, boost::is_any_of(f_CurveSeparator->getStringValue() )); + + // Iterate over curves + std::vector<std::string>::iterator stringIt = curves.begin(); + for (;stringIt < curves.end(); ++stringIt ){ + std::string curCurve = *stringIt; + if (curCurve.length() == 0) {continue;} + // Remove leading and trailing spaces + boost::trim( curCurve ); + std::vector< MLfloat > curveValues; + StringToVector( curCurve, curveValues ); + CurveData *outputCurve = new CurveData; + outputCurve->setY( curveValues.size(),&curveValues[0], 1 ); + if ( f_IndexString->getStringValue().length() != 0 ){ + outputCurve->setX( indexValues.size(),&indexValues[0], 1 ); + } + m_OutCurveList->getCurveList().push_back( outputCurve ); + } + } +} + + +void StringToCurve::StringToVector(std::string valueString, std::vector< MLfloat > &valueVector ) +{ + if (valueString.length() > 0){ + // Split string into values + std::vector<std::string> values; + boost::split(values, valueString, boost::is_any_of(f_ValueSeparator->getStringValue() )); + + // Iterate over the values + std::vector<std::string>::iterator valueIt = values.begin(); + for (;valueIt < values.end(); ++valueIt ){ + MLfloat curValue; + std::stringstream strm(*valueIt); + strm >> curValue; + valueVector.push_back( curValue ); + } + } +} +ML_END_NAMESPACE + Added: trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h =================================================================== --- trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h (rev 0) +++ trunk/Community/General/Sources/ML/MLCMCurveList/StringToCurve/mlStringToCurve.h 2010-03-05 12:04:36 UTC (rev 232) @@ -0,0 +1,104 @@ +//---------------------------------------------------------------------------------- +// +// Copyright (c) 2010, Biomedical Imaging Group Rotterdam (BIGR), +// Departments of Radiology and Medical Informatics, Erasmus MC. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of BIGR nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL BIGR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//---------------------------------------------------------------------------------- +//! The ML module class StringToCurve. +/*! +// \file mlStringToCurve.h +// \author Reinhard Hameeteman +// \date 2009-03-18 +// +// Convert a string into a curve +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlStringToCurve_H +#define __mlStringToCurve_H + + +// Local includes +#include "../MLCMCurveListSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" +#include <mlDiagramData.h> + +ML_START_NAMESPACE + + +//! Convert a string into a curve +class MLCMCURVELIST_EXPORT StringToCurve : public BaseOp +{ +public: + + //! Constructor. + StringToCurve (); + + ~StringToCurve(); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + + //! Ensure the output is up to date on copying the module + virtual void activateAttachments(); + + //! Curve data + BaseField *f_OutCurveList; + + //! String containing all curves + StringField *f_CurveString; + + //! String with index values that are used for all curves + StringField *f_IndexString; + + //! Characters that separate the curves in the curvesString + StringField *f_ValueSeparator; + + //! Characters that separate the values in the curvesString + StringField *f_CurveSeparator; + +private: + + //! CurveList containing the output curves + CurveList *m_OutCurveList; + + //! Actual conversion method + void UpdateCurve(); + + //! Convert a string to a vector of floats + void StringToVector(std::string valueString, std::vector< MLfloat > &valueVector ); + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(StringToCurve) +}; + + +ML_END_NAMESPACE + +#endif // __mlStringToCurve_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rha...@us...> - 2010-03-05 11:29:06
|
Revision: 231 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=231&view=rev Author: rhameeteman Date: 2010-03-05 11:28:59 +0000 (Fri, 05 Mar 2010) Log Message: ----------- KH. * added two missing help files Added Paths: ----------- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatistics.html trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.html Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatistics.html =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatistics.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOImageStatistics/CSOImageStatistics.html 2010-03-05 11:28:59 UTC (rev 231) @@ -0,0 +1,169 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> +<body> + +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> <a href="#Details">Details</a> <a href="#InputFields">Input</a> <a href="#OutputFields">Output</a> <a href="#Parameters">Parameters</a> +<a href="#Example">Example</a> <a href="#Events">Events</a> +<hr WIDTH="100%"></center> +<h2>CSOImageStatistics</h2> + +<h3><a NAME=Purpose></a>Purpose</h3> +<blockquote>This module can be used to calculate statistics of an image on positions defined by a CSO. The CSO needs to be in a plane, i.e. the normal needs to be valid. +</blockquote> + +<h3><a NAME=Usage></a>Usage</h3> +<blockquote>Connect the module to an image and assosiated CSOList. Select the Ids of the CSOs to be processed and press Update. +</blockquote> + +<h3><a NAME=Details></a>Details</h3> +<blockquote>Using -1 as CSO Id will result in using all CSOs from the CSOList. + +The Statistics are calculated at all CSO PathPoint posistions. The image plane is extracted from the input image using the MPRLight module. The interpolation and memory access method of this module can be set on the Advanced tab. The translation of the MPR is determind from the PCA center of the PathPoints of each CSO. The rotation is calculated from the CSO normal. Since the image needs to be reformatted when the CSO is not parallel to one of the main image axis, you can additionally specify a resolution on which the input image is reformatted. If you specify a negative value the shortest size of the of the input image voxels is used to determine the resolution. Because the needed image plane is extracted using the normal of the CSO, this module only works on CSOs the have a valid normal, i.e. the CSO must lay in a plane. If the CSO normal is not valid all statistics are set to zero. + +When "Use all points inside cso" is selected, the statistics are calculated on all points (of the reformatted image) inside the the contour. + +The XMarkerList output contains a list of all coordinates used for calculating the statistics. The type of the Marker is equal to the index of the corresponding CSO. + +When "Add description" is selected the Description string of each processed CSO is set according to the specified string. In the string %sum and %average are replaced by the calculated statistics. + +The Statistics Tab shows the calculated statistics in a nice table format. +</blockquote> + +<h3><a NAME="InputFields"></a>Input</h3> +<blockquote> <ul> + <li> + <b>input0</b> + Input image + </li> + <li> + <b>inCSOList</b> + Input CSOList + </li> + </ul> + +</blockquote> + +<h3><a NAME="OutputFields"></a>Output</h3> +<blockquote> <ul> + <li> + <b>outCSOList</b> + Output CSOList (if workDirectlyOnInput is not selected) + </li> + <li> + <b>outCurveList</b> + Curves of the calculated statistics + </li> + <li> + <b>outCoordinateList</b> + MarkerList of used image coordinates (the marker type = CSO index) + </li> + </ul> + +</blockquote> + +<h3><a NAME="Parameters"></a>Parameters</h3> +<blockquote> <ul> + <li> + <b>inputCSOString</b> + List of CSO Id's that will be processed. + </li> + <li> + <b>addDescription</b> + Add the statistics to the CSOs as a Description string. + </li> + <li> + <b>descriptionString</b> + String that is added to each CSO. The %sum and %average strings are replaced by their statistics. + </li> + <li> + <b>outputCurve</b> + Curve of the selected statistics of each CSO. + </li> + <li> + <b>workDirectlyOnInputList</b> + Work on the input CSOList. + </li> + <li> + <b>updateMode</b> + Auto Update. + </li> + <li> + <b>apply</b> + Update. + </li> + <li> + <b>useAllPointsInsideCSO</b> + Calculate the statistics based on all points inside the CSOs. + </li> + <li> + <b>averageOutput</b> + Output the average as curve. + </li> + <li> + <b>sumOutput</b> + Output the sum as curve. + </li> + <li> + <b>resolution</b> + Resolution of the sample points inside the CSO. + </li> + <li> + <b>useVoxelSize</b> + Scale the statistics by the voxel size (if appropriate). + </li> + <li> + <b>statistics</b> + String containing the statistics table. + </li> + <li> + <b>interpolation</b> + Interpolation mode used to extract the image values from the input image at the desired positions. + </li> + <li> + <b>memoryAccess</b> + The way the internally used MPRLight module handle the memory access. Unless you have very huge contours of very litle memory available, leave this to global. + </li> + <li> + <b>listenToFinishingNotifications</b> + React to Finishing notifications. + </li> + <li> + <b>listenToSelectionNotifications</b> + React on Selection changes. + </li> + </ul> + +</blockquote> + +<h3> + <a name="Example"></a>Example +</h3> + + +<blockquote> + In the example network the statistics of the several CSO are calculated after pressing + Update on the CSOImageStatistics GUI. The statistics are added as a description of the + CSOs, which can be seen in the View2D module. The graph of the average image values + within the CSOs is shown in the SoRenderArea. The SoExaminerViewer shows the CSOs in + 3D together with all points (from the XMarkerList) that are used for the calculation + of the statistics. +</blockquote> + +<h3><a NAME=Events></a>Events</h3> +<blockquote>The module can handle Finishing or Selection notifications. +</blockquote> + + + + + + + +</body> +</html> Added: trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.html =================================================================== --- trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.html (rev 0) +++ trunk/Community/General/Modules/ML/MLCSOCommunityModules/CSOSetProperties/CSOSetProperties.html 2010-03-05 11:28:59 UTC (rev 231) @@ -0,0 +1,112 @@ +<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"> + <meta name="Description" content="MeVisLab module help page template"> + <title>Module Help Page</title> +</head> + +<body> +<center><a href="#Purpose">Purpose</a> <a href="#Usage">Usage</a> +<a href="#Details">Details</a> <a href="#Inputs">Inputs</a> +<a href="#Outputs">Outputs</a> +<a href="#EventInteract">Events&Interaction</a> <a href="#Example">Example</a> +<a href="#Tips&Tricks">Tips&Tricks</a> <a href="#KnownBugs">Known +Bugs</a> +<hr width="100%"></center> + + + +<h2> + CSOSetProperties +</h2> + + + +<h3> +<a name="Purpose"></a>Purpose</h3> + + + +<blockquote>This module can be used to modify the properties of some or all CSOs or Groups in a CSOList.</blockquote> + + + +<h3> +<a name="Usage"></a>Usage</h3> + +<blockquote> + In the Input box select either CSO or Group mode and supply the Ids of the CSOs or Groups to be changed. + On the CSO or Group tab double click on the property that you want to set to enable it and set the desired value. +</blockquote> + +<h3> +<a name="Details"></a>Details</h3> + +<blockquote> + The supplied <span style="font-weight: bold;">Ids</span> can be either CSO or Group Ids. Using -1 as Id selects all Ids. + When <span style="font-weight: bold;">Auto Update</span> is selected the module reacts on all parameter and selection + changes and on the selected CSOList <span style="font-weight: bold;">notifications</span> (Finishing /Selection). + When <span style="font-weight: bold;">Work On Input List</span> is selected, the CSOList attached to the module input is + changed and the output COSList is the same object as the input CSOList. The properties to be set can be selected by double + clicking on the property field. This will enable the property and you can set the desired value. <br/> + Only the properties of the selected CSOs or Groups (Ids) are changed. All other CSOs or Groups are left unchanged. + Thus if you set a CSO as selected it is added to the group of selected CSOs. The <span style="font-weight: bold;">Is selected</span> + properties additionally allow you to clear the selection first. This way you can make sure only the selected CSOs or Groups + are marked as selected. +</blockquote> + +<h3> +<a name="Inputs"></a>Inputs</h3> + +<blockquote> + The input needs to be a CSOList. The moduel can either work on the input CSOList or creat a new list at the output. +</blockquote> + + +<h3> + <a name="Outputs"></a>Outputs +</h3> +<blockquote> + Depending on the setting of <span style="font-weight: bold;">Work On Input List</span> this is either a new CSOList or the same + object as connected to the module input. +</blockquote> + + +<h3> + <a name="Example"></a>Example +</h3> + + +<blockquote> + The example network shows how to set the properties of a single CSO (left part) and of a Group (right part). + + In the left part, the CSO with Id 2 is selected, given the label "Selected CSO" and its visuals are changed. + This can be inspected using the CSOInfo module and the examiner viewer. + + In the right part, group 1 is selected, the Description is set to "Spine" and again some visuals are changed. +</blockquote> + + + +<h3> +<a name="Tips&Tricks"></a>Tips & Tricks</h3> + +<blockquote>Use -1 as Id to selects all Ids.</blockquote> + + + +<h3> +<a name="KnownBugs"></a>Known Bugs</h3> + + + +<blockquote> + Notifications may need some synchronisation with the CSOManager.<br> +</blockquote> + + + +</body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <coe...@us...> - 2010-03-05 11:28:23
|
Revision: 230 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=230&view=rev Author: coertmetz Date: 2010-03-05 11:28:15 +0000 (Fri, 05 Mar 2010) Log Message: ----------- CM: Added 4 XMarkerList modules: - TransformXMarkerList: transform XMarker coordinates using a transformation matrix (or a matrix composed from elementary transforms. - LinearInterpolateXMarkerList: equidistantly linearly interpolate XMarker coordinates. - XMarkerListFromFile: load an XMarkerList from a text file. - XMarkerListToFile: save an XMarkerList as a text file. Added Paths: ----------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.bat trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.sh trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesSystem.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.h trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.h Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.bat =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.bat (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.bat 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,3 @@ +"%MLAB_ROOT%\MeVis\Foundation\BuildTools\Scripts\createProject.bat" MLXMarkerListCommunityModules + + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.bat ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + CRLF Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,49 @@ +# ----------------------------------------------------------------------------- +# MLXMarkerListCommunityModules project profile +# +# \file MLXMarkerListCommunityModules.pro +# \author Coert Metz +# \date 2010-03-05 +# ----------------------------------------------------------------------------- + +TEMPLATE = lib + +TARGET = MLXMarkerListCommunityModules + +DESTDIR = ../../../lib +DLLDESTDIR = ../../../lib + +# set high warn level (warn 4 on MSCV) +WARN = HIGH + +# add used projects here (see included pri files below for available projects) +CONFIG += dll ML MLBase MLTools + +MLAB_PACKAGES += Community_General \ + MeVisLab_Standard + +# make sure that this file is included after CONFIG and MLAB_PACKAGES +include ($(MLAB_MeVis_Foundation)/Configuration/IncludePackages.pri) + +DEFINES += MLXMARKERLISTCOMMUNITYMODULES_EXPORTS + +HEADERS += \ + MLXMarkerListCommunityModulesInit.h \ + MLXMarkerListCommunityModulesSystem.h \ + mlTransformXMarkerlist.h \ + mlLinearInterpolateXMarkerList.h \ + mlXMarkerListFromFile.h \ + mlXMarkerListToFile.h + + +SOURCES += \ + MLXMarkerListCommunityModulesInit.cpp \ + mlTransformXMarkerlist.cpp \ + mlLinearInterpolateXMarkerList.cpp \ + mlXMarkerListFromFile.cpp \ + mlXMarkerListToFile.cpp + +# additional files that are NOT compiled +RELATEDFILES += \ + ../../../Modules/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.def + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.pro ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.sh =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.sh (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.sh 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,35 @@ +#! /bin/bash +#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------- +# +# Copyright (c) 2001-2009, MeVis Medical Solutions AG, Bremen, Germany +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of MeVis Medical Solutions AG nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY MEVIS MEDICAL SOLUTIONS AG ''AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL MEVIS MEDICAL SOLUTIONS AG BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#----------------------------------------------------------------------------- +if [ "`uname -s`" = "Darwin" && "$MLAB_ROOT" = "" ]; then + echo "Generate Xcode projects by double-clicking the file 'MLXMarkerListCommunityModules.pro' in Finder or use the MeVisLabProjectGenerator.app from the command line to customize the project creation." +else + python $MLAB_ROOT/MeVis/Foundation/BuildTools/Scripts/createProject.py MLXMarkerListCommunityModules +fi + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.sh ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLXMarkerListCommunityModulesInit.cpp +// \author Coert Metz +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +// Local includes +#include "MLXMarkerListCommunityModulesSystem.h" + +// Include definition of ML_INIT_LIBRARY. +#include "mlLibraryInitMacros.h" + +// Include all module headers ... +#include "mlLinearInterpolateXMarkerList.h" +#include "mlTransformXMarkerList.h" +#include "mlXMarkerListFromFile.h" +#include "mlXMarkerListToFile.h" + + +ML_START_NAMESPACE + +//---------------------------------------------------------------------------------- +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +//---------------------------------------------------------------------------------- +int MLXMarkerListCommunityModulesInit () +{ + ML_TRACE_IN("MLXMarkerListCommunityModulesInit ()") + + LinearInterpolateXMarkerList::initClass(); + TransformXMarkerList::initClass(); + XMarkerListFromFile::initClass(); + XMarkerListToFile::initClass(); + // Add initClass calls from all other modules here... + + return 1; +} + +ML_END_NAMESPACE + + +//! Calls the init method implemented above during load of shared library. +ML_INIT_LIBRARY(MLXMarkerListCommunityModulesInit) + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.h 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------------- +//! Dynamic library and runtime type system initialization. +/*! +// \file MLXMarkerListCommunityModulesInit.h +// \author Coert Metz +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLXMarkerListCommunityModulesInit_H +#define __MLXMarkerListCommunityModulesInit_H + + +ML_START_NAMESPACE + +//! Calls init functions of all modules to add their types to the runtime type +//! system of the ML. +int MLXMarkerListCommunityModulesInit (); + +ML_END_NAMESPACE + +#endif // __MLXMarkerListCommunityModulesInit_H + + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesInit.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesSystem.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesSystem.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesSystem.h 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------- +//! Project global and OS specific declarations. +/*! +// \file MLXMarkerListCommunityModulesSystem.h +// \author Coert Metz +// \date 2010-03-05 +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __MLXMarkerListCommunityModulesSystem_H +#define __MLXMarkerListCommunityModulesSystem_H + + +// DLL export macro definition +#ifdef WIN32 +#ifdef MLXMARKERLISTCOMMUNITYMODULES_EXPORTS +// Use the MLXMARKERLISTCOMMUNITYMODULES_EXPORT macro to export classes and functions +#define MLXMARKERLISTCOMMUNITYMODULES_EXPORT __declspec(dllexport) +#else +// If included by external modules, exported symbols are declared as import symbols +#define MLXMARKERLISTCOMMUNITYMODULES_EXPORT __declspec(dllimport) +#endif + +#else +// No export declarations are necessary for non-Windows systems +#define MLXMARKERLISTCOMMUNITYMODULES_EXPORT +#endif + + +#endif // __MLXMarkerListCommunityModulesSystem_H + + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModulesSystem.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,151 @@ +//---------------------------------------------------------------------------------- +//! The ML module class LinearInterpolateXMarkerList. +/*! +// \file mlLinearInterpolateXMarkerList.cpp +// \author Coert Metz +// \date 2009-09-09 +// +// Linearly interpolate an XMarkerList +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "mlLinearInterpolateXMarkerList.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(LinearInterpolateXMarkerList, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +LinearInterpolateXMarkerList::LinearInterpolateXMarkerList () + : BaseOp(0, 0) +{ + ML_TRACE_IN("LinearInterpolateXMarkerList::LinearInterpolateXMarkerList ()"); + + // Suppress calls of handleNotification on field changes to + // avoid side effects during initialization phase. + handleNotificationOff(); + + // Get reference to the container for parameters/fields. + FieldContainer &fields = *getFieldContainer(); + + // Add fields to the module and set their values. + _inputXMarkerListFld = fields.addBase("inputXMarkerList"); + _inputXMarkerListFld->setBaseValue(NULL); + _outputXMarkerListFld = fields.addBase("outputXMarkerList"); + _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); + + // Sample distance for output XMarkerList + _sampleDistanceFld = fields.addFloat("sampleDistance"); + _sampleDistanceFld->setFloatValue(0.5f); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void LinearInterpolateXMarkerList::handleNotification (Field *field) +{ + ML_TRACE_IN("LinearInterpolateXMarkerList::handleNotification ()"); + + // Clear output XMarkerList + _outputXMarkerList.clear(); + + Base * baseValue = _inputXMarkerListFld->getBaseValue(); + if (baseValue && BASE_IS_A(baseValue, XMarkerList)) { + XMarkerList markers = *(XMarkerList*)baseValue; + + if (markers.size()>1 && markers.isModified()) { + // Compute length XMarkerList + double length = 0.0; + for (size_t i=0; i<markers.size()-1; ++i) { + length += (markers[i].pos-markers[i+1].pos).length(); + } + + // Check sample distance setting + if (_sampleDistanceFld->getFloatValue()<=0.0f) { + _sampleDistanceFld->setFloatValue(1.0f); + } + // Get sample distance setting + const float sampleDistance = _sampleDistanceFld->getFloatValue(); + + // Add first point + _outputXMarkerList.appendItem(markers[0]); + + // The stepsize is the sampledistance + double stepSize = sampleDistance; + // Centerline length already processed + double curLength = 0.0; + // Current line segment position + unsigned int segmentPos = 0; + + // Get first position + vec3 currentPos = markers[0].pos.getVec3(); + while (curLength < length && segmentPos<markers.size()-1) { + // Determine direction + vec3 direction = (vec6(markers[segmentPos+1].pos-markers[segmentPos].pos)).getVec3(); + direction.normalize(); + // Determine segment length + double segmentLength=(markers[segmentPos+1].pos-markers[segmentPos].pos).length(); + double curSegmentLength=0.0; + // Step in direction until next input point + while (curSegmentLength+stepSize<segmentLength) { + currentPos = currentPos + stepSize * direction; + curSegmentLength += stepSize; + curLength += stepSize; + _outputXMarkerList.appendItem(XMarker (currentPos)); + stepSize = sampleDistance; + } + // Determine rest length + stepSize = segmentLength-curSegmentLength; + // Update currentpos + currentPos = currentPos + stepSize * direction; + curLength+=stepSize; + stepSize = sampleDistance - stepSize; + + // Increment current line segment position + ++segmentPos; + } + } + } + + // Notify attached modules + _outputXMarkerListFld->notifyAttachments(); +} + +ML_END_NAMESPACE + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.h 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,93 @@ +//---------------------------------------------------------------------------------- +//! The ML module class LinearInterpolateXMarkerList. +/*! +// \file mlLinearInterpolateXMarkerList.h +// \author Coert Metz +// \date 2009-09-09 +// +// Linearly interpolate an XMarkerList +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __mlLinearInterpolateXMarkerList_H +#define __mlLinearInterpolateXMarkerList_H + + +// Local includes +#ifndef __MLXMarkerListCommunityModulesSystem_H +#include "MLXMarkerListCommunityModulesSystem.h" +#endif + +// ML includes +#include "mlOperatorIncludes.h" + +#include "mlXMarkerList.h" + +ML_START_NAMESPACE + + +//! Linearly interpolate an XMarkerList +class MLXMARKERLISTCOMMUNITYMODULES_EXPORT LinearInterpolateXMarkerList : public BaseOp +{ +public: + + //! Constructor. + LinearInterpolateXMarkerList (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + +private: + + // ---------------------------------------------------------- + //! \name Module field declarations + //@{ + // ---------------------------------------------------------- + + //! Input and output XMarkerList fields + BaseField *_inputXMarkerListFld; + BaseField *_outputXMarkerListFld; + XMarkerList _outputXMarkerList; + + //! Sample distance output XMarkerList + FloatField *_sampleDistanceFld; + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(LinearInterpolateXMarkerList) +}; + + +ML_END_NAMESPACE + +#endif // __mlLinearInterpolateXMarkerList_H + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlLinearInterpolateXMarkerList.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.cpp 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,84 @@ +//---------------------------------------------------------------------------------- +//! The ML module class MLXMarkerListCommunityModules. +/*! +// \file mlMLXMarkerListCommunityModules.cpp +// \author Coert Metz +// \date 2010-03-05 +// +// +*/ +//---------------------------------------------------------------------------------- + +// Local includes +#include "mlMLXMarkerListCommunityModules.h" + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(MLXMarkerListCommunityModules, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +MLXMarkerListCommunityModules::MLXMarkerListCommunityModules () + : BaseOp(0, 0) +{ + ML_TRACE_IN("MLXMarkerListCommunityModules::MLXMarkerListCommunityModules ()"); + + // Suppress calls of handleNotification on field changes to + // avoid side effects during initialization phase. + handleNotificationOff(); + + // Connect input field(s) with output field(s) to notify + // connected modules if input image(s) change. + for (int inIdx=0; inIdx < 0; ++inIdx){ + for (int outIdx=0; outIdx < 0; ++outIdx){ + getInField(inIdx)->attachField(getOutField(outIdx)); + } + } + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); + + // Activate inplace data buffers for output outIndex and input inIndex. + // setOutImgInplace(outIndex, inIndex); + + // Activate page data bypass from input inIdx to output outIdx. + // Note that the module must still be able to calculate the output image. + // setBypass(outIndex, inIndex); + + // Activate parallel execution of calcOutSubImage. + // setThreadSupport(supportMode); + // with supportMode = + // NO_THREAD_SUPPORT //! The module is not thread safe at all. + // CALC_OUTSUBIMAGE_ON_STD_TYPES //! calcOutSubImage can be called in parallel for scalar voxel types. + // CALC_OUTSUBIMAGE_ON_CARRIER_TYPES //! calcOutSubImage can be called in parallel for carrier voxel types. + // CALC_OUTSUBIMAGE_ON_ALL_TYPES //! calcOutSubImage can be called in parallel for all voxel types. + // Warning: You should be familiar with multithreading before activating this feature. + + // Specify whether the module can only process standard scalar voxel types or + // also registered voxel types (vec2, mat2, complexf, Vector, etc.) + // setVoxelDataTypeSupport(permittedTypes); + // with permittedTypes = + // ONLY_STANDARD_TYPES //! Only standard scalar voxels are supported. + // FULLY_OPERATIONAL //! Scalar and registered voxels types are supported. + // MINIMUM_OPERATIONAL //! Scalar and registered voxel types are supported. + // //! Voxel operators are not used by algorithm. + // + // See ML Programming Guide, "Configuring Image Processing Behaviour of the BaseOp" + // for further details. +} + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field field. +//---------------------------------------------------------------------------------- +void MLXMarkerListCommunityModules::handleNotification (Field *field) +{ + ML_TRACE_IN("MLXMarkerListCommunityModules::handleNotification ()"); + + // Handle changes of module parameters and connectors here. +} + +ML_END_NAMESPACE + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.h 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------------- +//! The ML module class MLXMarkerListCommunityModules. +/*! +// \file mlMLXMarkerListCommunityModules.h +// \author Coert Metz +// \date 2010-03-05 +// +// +*/ +//---------------------------------------------------------------------------------- + + +#ifndef __mlMLXMarkerListCommunityModules_H +#define __mlMLXMarkerListCommunityModules_H + + +// Local includes +#include "EMCMLXMarkerListCommunityModulesSystem.h" + +// ML includes +#include "mlOperatorIncludes.h" + +ML_START_NAMESPACE + + +//! +class EMCMLXMARKERLISTCOMMUNITYMODULES_EXPORT MLXMarkerListCommunityModules : public BaseOp +{ +public: + + //! Constructor. + MLXMarkerListCommunityModules (); + + //! Handle field changes of the field field. + virtual void handleNotification (Field *field); + +private: + + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(MLXMarkerListCommunityModules) +}; + + +ML_END_NAMESPACE + +#endif // __mlMLXMarkerListCommunityModules_H + Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlMLXMarkerListCommunityModules.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.cpp 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,164 @@ +//---------------------------------------------------------------------------------- +//! The ML module class TransformXMarkerList. +/*! +// \file mlTransformXMarkerList.cpp +// \author Coert Metz +// \date 2006-04-20 +// +// Transform all XMarkers of an XMarkerList with the given matrix or elementary +// transforms +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#ifndef __mlTransformXMarkerList_H +#include "mlTransformXMarkerList.h" +#endif + +ML_START_NAMESPACE + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(TransformXMarkerList, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +TransformXMarkerList::TransformXMarkerList (void) + : BaseOp(0, 0) +{ + ML_TRACE_IN("TransformXMarkerList::TransformXMarkerList()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Input and output XMarkerList + _inputXMarkerList = fields->addBase("inputXMarkerList"); + _outputXMarkerList = fields->addBase("outputXMarkerList"); + _outputXMarkerList->setBaseValue(&_outXMarkerList); + + // Bool field to enable/disable transformation + _transformEnabled = fields->addBool("transformEnabled"); + _transformEnabled->setBoolValue(true); + + // Fields for elementary transforms + _center = fields->addVec3f("center"); + _center->setVec3fValue(vec3(0)); + _scaleOrientation = new RotationField("scaleOrientation"); + _scaleOrientation->setRotationValue(vec3(0, 0, 1), 0); + fields->addField(_scaleOrientation); + _scale = fields->addVec3f("scale"); + _scale->setVec3fValue(vec3(1)); + _rotation = new RotationField("rotation"); + _rotation->setRotationValue(vec3(0, 0, 1), 0); + fields->addField(_rotation); + _translation = fields->addVec3f("translation"); + _translation->setVec3fValue(vec3(0)); + _elTrans = fields->addBool("useElementaryTransforms" ); + _elTrans->setBoolValue (true); + + // Transformation matrix field + _matrix = fields->addMatrix("matrix"); + + // Option for homogenous coordinates + _homogeneousFld = fields->addBool("divideByHomogeneousCoordinate"); + _homogeneousFld->setBoolValue(false); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void TransformXMarkerList::handleNotification (Field * /*field*/) +{ + ML_TRACE_IN("TransformXMarkerList::handleNotification()"); + + // Compose transformation matrix + if (_elTrans->getBoolValue()) { + mat4 matrix = identity3D<mat4::ComponentType>(); + vec3 center = _center->getVec3fValue(); + Rotation scaleRot = _scaleOrientation->getRotationValue(); + vec3 scale = _scale->getVec3fValue(); + Rotation rot = _rotation->getRotationValue(); + vec3 trans = _translation->getVec3fValue(); + Rotation invScaleRot = scaleRot; + invScaleRot.conjugate(); + + matrix = translation3D<mat4::ComponentType>(trans+center)* + rot.getMatrix()* + invScaleRot.getMatrix()* + scaling3D<mat4::ComponentType>(scale)* + scaleRot.getMatrix()* + translation3D<mat4::ComponentType>(-center); + + _matrix->setMatrixValue (matrix); + } + + // Do not transform if not enabled ... + mat4 matrix = _matrix->getMatrixValue(); + if (!_transformEnabled->getBoolValue()) + matrix = mat4::getIdentity(); + + // Transform XMarkers + Base *baseValue = _inputXMarkerList->getBaseValue(); + if (baseValue && BASE_IS_A(baseValue,XMarkerList)) { + XMarkerList *inXMarkerList = (XMarkerList *) baseValue; + // Clear output list + _outXMarkerList.clearList(); + for (int i=0; i<int(inXMarkerList->getSize()); ++i) { + // Get marker position and transform it + XMarker marker = inXMarkerList->at (i); + vec4 vMarker = vec4 (marker.x(), marker.y(), marker.z(), 1.0); + vMarker = matrix * vMarker; + // If homogeneous coordinates divide by last element + if (_homogeneousFld->getBoolValue() && vMarker[3] != 0.0) { + marker.x() = vMarker[0]/vMarker[3]; + marker.y() = vMarker[1]/vMarker[3]; + marker.z() = vMarker[2]/vMarker[3]; + } else { + marker.x() = vMarker[0]; + marker.y() = vMarker[1]; + marker.z() = vMarker[2]; + } + // Add marker to output list + _outXMarkerList.appendItem (marker); + } + // Select XMarker which is selected in input list and notify attachments + _outXMarkerList.doSelectItem(inXMarkerList->getCurrentIndex()); + _outputXMarkerList->notifyAttachments(); + } +} + +ML_END_NAMESPACE Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.h 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,111 @@ +//---------------------------------------------------------------------------------- +//! The ML module class TransformXMarkerList. +/*! +// \file mlTransformXMarkerList.h +// \author Coert Metz +// \date 2006-04-20 +// +// Transform all XMarkers of an XMarkerList with the given matrix or elementary transforms +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __mlTransformXMarkerList_H +#define __mlTransformXMarkerList_H + +// Local includes +#ifndef __MLXMarkerListCommunityModulesSystem_H +#include "MLXMarkerListCommunityModulesSystem.h" +#endif + +// ML includes +#ifndef __mlOperatorIncludes_H +#include "mlOperatorIncludes.h" +#endif + +#include "mlLinearAlgebra.h" +#include "mlRotationField.h" +#include "mlXMarkerList.h" + + +ML_START_NAMESPACE + + +//! Transform all XMarkers of an XMarkerList with the given matrix or elementary transforms +class MLXMARKERLISTCOMMUNITYMODULES_EXPORT TransformXMarkerList : public BaseOp +{ +public: + + //! Constructor. + TransformXMarkerList (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + + +private: + + // ---------------------------------------------------------- + //! \name Module field declarations + //@{ + // ---------------------------------------------------------- + + //! Input and output XMarkerList field + BaseField *_inputXMarkerList; + BaseField *_outputXMarkerList; + XMarkerList _outXMarkerList; + + //! Bool field to enable/disable marker transformation + BoolField *_transformEnabled; + + //! Transformation matrix field + MatrixField *_matrix; + + //! Elementary transforms fields + Vec3fField *_center; + RotationField *_scaleOrientation; + Vec3fField *_scale; + RotationField *_rotation; + Vec3fField *_translation; + BoolField *_elTrans; + + //! Field to enable homogeneous coordinates + BoolField *_homogeneousFld; + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(TransformXMarkerList) + +}; + +ML_END_NAMESPACE + +#endif // __mlTransformXMarkerList_H Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlTransformXMarkerList.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.cpp 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,183 @@ +////---------------------------------------------------------------------------------- +//! The ML module class XMarkerListFromFile. +/*! +// \file mlXMarkerListFromFile.cpp +// \author Coert Metz +// \date 2007-06-22 +// +// Read XMarkers from a text file +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "mlXMarkerListFromFile.h" +#include <fstream> + +ML_START_NAMESPACE + + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(XMarkerListFromFile, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +XMarkerListFromFile::XMarkerListFromFile (void) + : BaseOp(1, 0) +{ + ML_TRACE_IN("XMarkerListFromFile::XMarkerListFromFile()") + + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Add filename field + _filenameFld = fields->addString("filename"); + _filenameFld->setStringValue(""); + + // Add bool fields to select elements to import + _positionXFld = fields->addBool("importPositionX"); + _positionXFld->setBoolValue(true); + _positionYFld = fields->addBool("importPositionY"); + _positionYFld->setBoolValue(true); + _positionZFld = fields->addBool("importPositionZ"); + _positionZFld->setBoolValue(true); + _positionTFld = fields->addBool("importPositionT"); + _positionTFld->setBoolValue(false); + _vectorXFld = fields->addBool("importVectorX"); + _vectorXFld->setBoolValue(false); + _vectorYFld = fields->addBool("importVectorY"); + _vectorYFld->setBoolValue(false); + _vectorZFld = fields->addBool("importVectorZ"); + _vectorZFld->setBoolValue(false); + _typeFld = fields->addBool("importType"); + _typeFld->setBoolValue(false); + + // Add input coordinate system field + const char *_inputCoordinateSystemFldValues[] = { "world", "voxel" }; + _inputCoordinateSystemFld = fields->addEnum("inputCoordinateSystem", _inputCoordinateSystemFldValues, 2); + _inputCoordinateSystemFld->setEnumValue(1); + + // Add field to let the module skip some element before reading the markers from file + _skipElementsFld = fields->addInt("numElementsToSkip"); + _skipElementsFld->setIntValue(0); + + // Output XMarkerList + _outputXMarkerListFld = fields->addBase("outputXMarkerList"); + _outputXMarkerListFld->setBaseValue(&_outputXMarkerList); + + // Update fields + _updateFld = fields->addNotify("update"); + _autoUpdateFld = fields->addBool("autoUpdate"); + + // Reactivate calls of handleNotification on field changes. + handleNotificationOn(); +} + + +//---------------------------------------------------------------------------------- +//! Handle field changes of the field \c field. +//---------------------------------------------------------------------------------- +void XMarkerListFromFile::handleNotification (Field *field) +{ + ML_TRACE_IN("XMarkerListFromFile::handleNotification()") + + if (field==_updateFld || _autoUpdateFld->getBoolValue()) { + _outputXMarkerList.clear(); + + // Check if an input image is connected when coordinate system is set to voxel + if (_inputCoordinateSystemFld->getEnumValue()==1 && !getUpdatedInImg(0)) { + std::cout << "When you select voxel as input coordinate system you should provide an input image!" << std::endl; + return; + } + + // Check filename + std::string filename = _filenameFld->getStringValue(); + if (filename != "") { + // Open file + std::fstream file_op(filename.c_str(), std::ios::in); + // Check if file is open + if (file_op.is_open()) { + mat4 toWorld = mat4::getIdentity(); + // Skip number of lines + for (int i=0; i<_skipElementsFld->getIntValue(); ++i) { + std::string dummy; + file_op >> dummy; + } + + // Read XMarkers from text file + while (true) { + XMarker marker; + std::vector<std::string> tokens (8, "0"); + if (_positionXFld->getBoolValue()) if ( !(file_op >> tokens[0]) ) break; + if (_positionYFld->getBoolValue()) if ( !(file_op >> tokens[1]) ) break; + if (_positionZFld->getBoolValue()) if ( !(file_op >> tokens[2]) ) break; + if (_positionTFld->getBoolValue()) if ( !(file_op >> tokens[3]) ) break; + if (_vectorXFld->getBoolValue()) if ( !(file_op >> tokens[4]) ) break; + if (_vectorYFld->getBoolValue()) if ( !(file_op >> tokens[5]) ) break; + if (_vectorZFld->getBoolValue()) if ( !(file_op >> tokens[6]) ) break; + if (_typeFld->getBoolValue()) if ( !(file_op >> tokens[7]) ) break; + vec3 voxel (atof (tokens[0].c_str()), atof(tokens[1].c_str()), atof(tokens[2].c_str())); + // When coordinates in file are in world coordinates, we are done + vec3 world = voxel; + vec3 vec; + vec[0] = atof (tokens[4].c_str()); + vec[1] = atof (tokens[5].c_str()); + vec[2] = atof (tokens[6].c_str()); + int type = atoi (tokens[7].c_str()); + // When coordinates in file are in voxel coordinates, we need to convert both the + // position and the vector to world coordinates + if (_inputCoordinateSystemFld->getEnumValue()) { + getUpdatedInImg(0)->transformToWorldCoord(voxel+vec3(0.5, 0.5, 0.5), world); + vec3 vecWOrld; + getUpdatedInImg(0)->transformToWorldCoord(voxel+vec+vec3(0.5, 0.5, 0.5), vecWOrld); + vec = vecWOrld - world; + } + marker.pos[0] = world[0]; + marker.pos[1] = world[1]; + marker.pos[2] = world[2]; + marker.pos[4] = atof(tokens[3].c_str()); + marker.vec = vec; + marker.type = type; + // Add marker to output list + _outputXMarkerList.appendItem(marker); + } + } else { + std::cout << "Cannot open file (" << filename << ")!" << std::endl; + } + } + + _outputXMarkerListFld->notifyAttachments(); + } +} + +ML_END_NAMESPACE Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.cpp ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.h (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.h 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,103 @@ +//---------------------------------------------------------------------------------- +//! The ML module class XMarkerListFromFile. +/*! +// \file mlXMarkerListFromFile.h +// \author Coert Metz +// \date 2007-06-22 +// +// Read XMarkers from a text file +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +#ifndef __mlXMarkerListFromFile_H +#define __mlXMarkerListFromFile_H + +// Local includes +#ifndef __MLXMarkerListCommunityModulesSystem_H +#include "MLXMarkerListCommunityModulesSystem.h" +#endif + +// ML includes +#include "mlOperatorIncludes.h" +#include "mlXMarkerList.h" + +ML_START_NAMESPACE + +//! Read XMarkers from a text file +class MLXMARKERLISTCOMMUNITYMODULES_EXPORT XMarkerListFromFile : public BaseOp { +public: + //! Constructor. + XMarkerListFromFile (void); + + //! Handle field changes of the field \c field. + virtual void handleNotification (Field *field); + +private: + // ---------------------------------------------------------- + //@{ \name Module field declarations + // ---------------------------------------------------------- + + // Input filename + StringField *_filenameFld; + + // Enum to choose between world/voxel coordinate input + EnumField *_inputCoordinateSystemFld; + + // Update fields + NotifyField *_updateFld; + BoolField* _autoUpdateFld; + + // Field to select elements to import + BoolField *_positionXFld; + BoolField *_positionYFld; + BoolField *_positionZFld; + BoolField *_positionTFld; + BoolField *_vectorXFld; + BoolField *_vectorYFld; + BoolField *_vectorZFld; + BoolField *_typeFld; + + // Skip a certain number of line at the start of the file + IntField *_skipElementsFld; + + // OutputXMarkerList and corresponding field + BaseField *_outputXMarkerListFld; + XMarkerList _outputXMarkerList; + + //@} + + //! Implements interface for the runtime type system of the ML. + ML_BASEOP_CLASS_HEADER(XMarkerListFromFile) +}; + +ML_END_NAMESPACE + +#endif // __mlXMarkerListFromFile_H Property changes on: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListFromFile.h ___________________________________________________________________ Added: svn:keywords + " Date Revision Author HeadURL Id " Added: svn:eol-style + native Added: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.cpp (rev 0) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/mlXMarkerListToFile.cpp 2010-03-05 11:28:15 UTC (rev 230) @@ -0,0 +1,278 @@ +//---------------------------------------------------------------------------------- +//! The ML module class XMarkerListToFile. +/*! +// \file mlXMarkerListToFile.cpp +// \author Coert Metz +// \date 2007-07-06 +// +// Save XMarkers to a text file +*/ +//---------------------------------------------------------------------------------- + +/* ================================================================================= + 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. + =================================================================================*/ + +// Local includes +#include "mlXMarkerListToFile.h" +#include <fstream> + +ML_START_NAMESPACE + +#include <set> + +//! Implements code for the runtime type system of the ML +ML_BASEOP_CLASS_SOURCE(XMarkerListToFile, BaseOp); + +//---------------------------------------------------------------------------------- +//! Constructor +//---------------------------------------------------------------------------------- +XMarkerListToFile::XMarkerListToFile (void) + : BaseOp(1, 0) +{ + ML_TRACE_IN("XMarkerListToFile::XMarkerListToFile()") + + // Coordinate system and separator options + const char *_outputCoordinateSystemFldValues[] = { "world", "voxel","pos:voxel, vec:world"}; + const char *_coordinateSeparatorFldValues[] = { "space", "newline" }; + + // Get field container + FieldContainer *fields = getFieldContainer(); + + // Suppress calls of handleNotification on field changes. + handleNotificationOff(); + + // Add filename field + _filenameFld = fields->addString("filename"); + _filenameFld->setStringValue(""); + + // Add enum to choose output coordinate system + _outputCoordinateSystemFld = fields->addEnum("outputCoordinateSystem", _outputCoordinateSystemFldValues, 3); + _outputCoordinateSystemFld->setEnumValue(1); + + // Add enum to choose coordinate separator + _coordinateSeparatorFld = fields->addEnum("coordinateSeparator", _coordinateSeparatorFldValues, 2); + _coordinateSeparatorFld->setEnumValue(0); + + // Add input XMarkerList field containing the markers to write to file + _inputXMarkerListFld = fields->addBase("inputXMarkerList"); + _inputXMarkerListFld->setBaseValue(NULL); + + // Add bools to select elements for th... [truncated message content] |