From: <rha...@us...> - 2012-08-15 12:41:19
|
Revision: 411 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=411&view=rev Author: rhameeteman Date: 2012-08-15 12:41:12 +0000 (Wed, 15 Aug 2012) Log Message: ----------- HK. * added field keep "input vector as is" When a XMarkerList file is loaded and the input coordinate system is voxel, then only the position is converted to world, not the vector (in case something else is stored in the vec field) Modified Paths: -------------- trunk/Community/General/Modules/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.def trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h Modified: trunk/Community/General/Modules/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.def =================================================================== --- trunk/Community/General/Modules/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.def 2012-07-12 12:21:44 UTC (rev 410) +++ trunk/Community/General/Modules/ML/MLXMarkerListCommunityModules/MLXMarkerListCommunityModules.def 2012-08-15 12:41:12 UTC (rev 411) @@ -54,13 +54,20 @@ Vertical { margin=3 Field filename { browseButton = true browseFilter = "Text files (*.txt);;All files (*.*)"} - Field importPositionX {} - Field importPositionY {} - Field importPositionZ {} - Field importPositionT {} - Field importVectorX {} - Field importVectorY {} - Field importVectorZ {} + Horizontal { + Box Position { + Field importPositionX {} + Field importPositionY {} + Field importPositionZ {} + Field importPositionT {} + } + Box Vector { + Field importVectorX {} + Field importVectorY {} + Field importVectorZ {} + Field keepVecInputAsIs { dependsOn = isVoxel} + } + } Field importType { alignGroup=left } Field numElementsToSkip {} Field inputCoordinateSystem {} Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp 2012-07-12 12:21:44 UTC (rev 410) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.cpp 2012-08-15 12:41:12 UTC (rev 411) @@ -81,6 +81,11 @@ _vectorZFld->setBoolValue(false); _typeFld = fields->addBool("importType"); _typeFld->setBoolValue(false); + + _keepVectorInputAsIsFld = fields->addBool("keepVecInputAsIs"); + _keepVectorInputAsIsFld->setBoolValue(false); + _isVoxelFld = fields->addBool("isVoxel"); + _isVoxelFld->setBoolValue(false); // Add input coordinate system field const char *_inputCoordinateSystemFldValues[] = { "world", "voxel" }; @@ -114,6 +119,14 @@ if ( field==_updateFld || ( _autoUpdateFld->getBoolValue() && field != _outputXMarkerListFld ) ) { _outputXMarkerList.clear(); + // Check for the display of keepVecInputAsIs + if (_inputCoordinateSystemFld->getEnumValue()) { + _isVoxelFld->setBoolValue(true); + } + else { + _isVoxelFld->setBoolValue(false); + } + // 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; @@ -147,6 +160,7 @@ 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; @@ -154,13 +168,17 @@ 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; + if (!_keepVectorInputAsIsFld->getBoolValue()) + { + 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]; Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h 2012-07-12 12:21:44 UTC (rev 410) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/XMarkerListFile/mlXMarkerListFromFile.h 2012-08-15 12:41:12 UTC (rev 411) @@ -86,6 +86,9 @@ BoolField *_vectorYFld; BoolField *_vectorZFld; BoolField *_typeFld; + + BoolField *_keepVectorInputAsIsFld; + BoolField *_isVoxelFld; // Skip a certain number of line at the start of the file IntField *_skipElementsFld; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |