Commit
Because Markups define multiple markups (with potentially multiple points) in one node, it was writting multiple instances of a string + coordinates to the string stream passed in to WriteCLI. This causes a problem for the parsing of the arguments in CLIs such as FiducialRegistration which needed a separate string for each point. With this change, the markup points are writen into a vector of strings, one string for each point in each Markup. Added the multipleFlag to be passed to WriteCLI, and if it's false, only write the first selected markup to the output vector. If that markup has multiple points, it will write all of those points. Updated the Annotation control point to use the new WriteCLI signature, but because of the way the points are written, it will only write the first point in a multi point annotation (such as a ruler) if multiple is false, so it ignores it and the CLI module logic takes care of ensuring that only the first child in an annotation hierachy is written out. Added a test for FiducialRegistration, updated the Markups node test 1 to test the single point flag. Removed trailing white spaces. Issue #1910 Issue #3345
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,25 @@ | ||
# See http://www.na-mic.org/Bug/view.php?id=3340 | ||
# message(WARNING "warning: Module ${MODULE_NAME} doesn't have any test !") | ||
|
||
#----------------------------------------------------------------------------- | ||
set(CLP ${MODULE_NAME}) | ||
|
||
#----------------------------------------------------------------------------- | ||
set(TEMP ${Slicer_BINARY_DIR}/Testing/Temporary) | ||
|
||
#----------------------------------------------------------------------------- | ||
add_executable(${CLP}Test ${CLP}Test.cxx) | ||
target_link_libraries(${CLP}Test ${CLP}Lib) | ||
set_target_properties(${CLP}Test PROPERTIES LABELS ${CLP}) | ||
|
||
set(testname ${CLP}Test) | ||
add_test(NAME ${testname} COMMAND ${SEM_LAUNCH_COMMAND} $<TARGET_FILE:${CLP}Test> | ||
ModuleEntryPoint | ||
--returnparameterfile ${TEMP}/FiducialRegistration.params | ||
--fixedLandmarks 37.5615,82.3156,0 --fixedLandmarks -26.373,81.5164,0 --fixedLandmarks -2.39754,-21.5779,0 | ||
--movingLandmarks 39.959,59.9385,30 --movingLandmarks -24.7746,62.3361,30 --movingLandmarks 0.79918,-52.7459,33.75 | ||
--saveTransform ${TEMP}/FiducialRegistration_vtkMRMLLinearTransformNodeE.txt | ||
--transformType Rigid | ||
) | ||
|
||
set_property(TEST ${testname} PROPERTY LABELS ${CLP}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "itkTestMain.h" | ||
|
||
#ifdef WIN32 | ||
#define MODULE_IMPORT __declspec(dllimport) | ||
#else | ||
#define MODULE_IMPORT | ||
#endif | ||
|
||
// Comment copied from ThesholdTest.cxx; This will be linked against the ModuleEntryPoint in RealignLib | ||
extern "C" MODULE_IMPORT int ModuleEntryPoint(int, char * []); | ||
|
||
void RegisterTests() | ||
{ | ||
StringToTestFunctionMap["ModuleEntryPoint"] = ModuleEntryPoint; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,22 +91,29 @@ void vtkMRMLAnnotationControlPointsNode::WriteXML(ostream& of, int nIndent) | |
} | ||
|
||
of << indent << " ctrlPtsNumberingScheme=\"" << this->NumberingScheme << "\""; | ||
|
||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
void vtkMRMLAnnotationControlPointsNode::WriteCLI(std::ostringstream& ss, std::string prefix, int coordinateSystem) | ||
void vtkMRMLAnnotationControlPointsNode:: | ||
WriteCLI(std::vector<std::string>& commandLine, std::string prefix, | ||
int coordinateSystem, int multipleFlag) | ||
{ | ||
Superclass::WriteCLI(ss, prefix, coordinateSystem); | ||
Superclass::WriteCLI(commandLine, prefix, coordinateSystem, multipleFlag); | ||
|
||
// Ignoring multipleFlag, because by convention there is only one annotation | ||
// per node, so if there's a 6 point ROI, it needs to have all of it's | ||
// points written out. The multiple flag is managed at the CLI module logic | ||
// level | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
naucoin
Owner
|
||
if (this->GetPoints()) | ||
{ | ||
vtkPoints *points = this->GetPoints(); | ||
int n = points->GetNumberOfPoints(); | ||
|
||
for (int i = 0; i < n; i++ ) | ||
for (int i = 0; i < n; i++ ) | ||
{ | ||
double* ptr = points->GetPoint(i); | ||
std::stringstream ss; | ||
if (prefix.compare("") != 0) | ||
{ | ||
ss << prefix << " "; | ||
|
@@ -125,10 +132,7 @@ void vtkMRMLAnnotationControlPointsNode::WriteCLI(std::ostringstream& ss, std::s | |
lps[2] = ptr[2]; | ||
ss << lps[0] << "," << lps[1] << "," << lps[2] ; | ||
} | ||
if (i < n-1) | ||
{ | ||
ss << " "; | ||
} | ||
commandLine.push_back(ss.str()); | ||
} | ||
} | ||
} | ||
|
12 comments
on commit 825be11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you avoid to commit the removal of trailing space ? It would make it easier to review the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's easier to remove all trailing spaces in files I commit than to have to hit the commit hook check all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the hook only check the modified line and not the existing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not worry about this .. in github, by adding ?w=1
to the compare url .. space difference are not shown :)
For example: 825be11?w=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but it's still easier for me to fix the whole file at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me (didn't try)
@pieper Could you also review ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't try it either but it looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naucoin Do you want me to try to compile the topic on Linux or you already tested this platform ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested only on Mac, so yes please!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is compiling. Will give a try in an hour or so. Heading to the climbing gym.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Ubuntu - See http://na-mic.org/Bug/view.php?id=1910#c9715
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it makes sense to display a warning if 'multipleFlag' is false in this particular case ?