Merge lp:~jocke-karlsson/forssim/removedVoxels into lp:forssim

Proposed by jocke
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jocke-karlsson/forssim/removedVoxels
Merge into: lp:forssim
Diff against target: None lines
To merge this branch: bzr merge lp:~jocke-karlsson/forssim/removedVoxels
Reviewer Review Type Date Requested Status
Bo Rasmusson (community) Approve
JohanO (community) Approve
Review via email: mp+12034@code.launchpad.net
To post a comment you must log in.
Revision history for this message
jocke (jocke-karlsson) wrote :

Fix for forbidden segments voxels removed was not saved in each drillstep.

Revision history for this message
JohanO (johan-olofsson) wrote :

Ok

review: Approve
Revision history for this message
Bo Rasmusson (bo-rasmusson) wrote :

Look ok to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'FsWisdom/ApplicationNode.cpp'
2--- FsWisdom/ApplicationNode.cpp 2009-09-07 14:13:58 +0000
3+++ FsWisdom/ApplicationNode.cpp 2009-09-18 08:23:43 +0000
4@@ -417,7 +417,7 @@
5 query.bindValue(":userCaseId", index );
6 query.bindValue(":segmentId", -(*segmentIdFieldIterator));
7 query.bindValue(":drillingStep", drillingStep);
8- query.bindValue(":voxelsRemoved", forbiddenSegmentationModel->noOfVoxelsBoredByUser->getValue()[(*segmentIdFieldIterator)]);
9+ query.bindValue(":voxelsRemoved", forbiddenSegmentationModel->noOfForbiddenVoxelsDrilledByUser((*segmentIdFieldIterator),drillingStep));
10 query.bindValue(":noVoxelsEqualToExpert", 0);
11
12 if(query.exec())
13
14=== modified file 'FsWisdom/ApplicationNode.h'
15--- FsWisdom/ApplicationNode.h 2009-09-07 14:13:58 +0000
16+++ FsWisdom/ApplicationNode.h 2009-09-18 08:23:43 +0000
17@@ -64,6 +64,7 @@
18 class SelectCaseWindow;
19 class RemoveWisdomToothWindow;
20 class GlWindowNode;
21+class ForbiddenSegmentationModel;
22
23 //old code
24 class Updater_QButton_SaveAndExit;
25
26=== modified file 'src/DrillingStepsNode.cpp'
27--- src/DrillingStepsNode.cpp 2009-08-12 11:49:25 +0000
28+++ src/DrillingStepsNode.cpp 2009-09-18 08:23:43 +0000
29@@ -255,14 +255,13 @@
30 hasUserBoredThisDrillingStep = false;
31 currentDrillingStepId = (currentDrillingStepId%noOfDrillingSteps)+1;
32
33-
34-
35 cout << "Current Drilling Step Id: "<< (unsigned int)currentDrillingStepId<<endl;
36 cout << "StartTime: " << drillingStepData[currentDrillingStepId-1].startTime<<endl;
37 cout << "FinishTime: " << drillingStepData[currentDrillingStepId-1].finishTime<<endl;
38
39 // Inform the highlight module to redraw information based on new expert step
40 engageHighlightField->setValue(true,this->id);
41+ forbiddenSegmentationModelNode->incrementCurrentDrillingStep();
42 }
43
44 void DrillingStepsNode::decrementCurrentDrillingStep()
45@@ -280,6 +279,7 @@
46
47 // Inform the highlight module to redraw information based on new expert step
48 engageHighlightField->setValue(true,this->id);
49+ forbiddenSegmentationModelNode->decrementCurrentDrillingStep();
50 }
51
52 void DrillingStepsNode::addDrillingStep()
53
54=== modified file 'src/ForbiddenSegmentationModel.cpp'
55--- src/ForbiddenSegmentationModel.cpp 2009-05-04 08:14:06 +0000
56+++ src/ForbiddenSegmentationModel.cpp 2009-09-18 08:23:43 +0000
57@@ -67,15 +67,34 @@
58 }
59
60 // initialize the noOfVoxelsBoredByUser list with zeros
61+ //noOfVoxelsBoredByUser is kept for now. It is used (only?) for displaying number
62+ //of voxels removed in the GUI (the GUI should use vForbiddenDrillingStepData).
63+ //This is total number removed, not removed in each drillstep.
64 unsigned int size = (segmentIdField->getValue()).size()+1;
65- H3DInt32* data = new H3DInt32[size];
66+ H3DInt32* data2 = new H3DInt32[size];
67 for(unsigned int i = 0; i< size;i++)
68- data[i] = 0;
69- noOfVoxelsBoredByUser->setValueFromVoidPtr(data,size,size*sizeof(H3DInt32),this->id);
70- delete[] data;
71+ data2[i] = 0;
72+ noOfVoxelsBoredByUser->setValueFromVoidPtr(data2,size,size*sizeof(H3DInt32),this->id);
73+ delete[] data2;
74+
75+ //A vector with struct containing drilled data in each drill step.
76+ forbiddenDrillingStepData_t sForbiddenDrillingStepData;
77+ noOfDrillingSteps = 2;
78+
79+ for(unsigned char i = 1; i<=noOfDrillingSteps;i++)
80+ {
81+ cout <<"Adding initializingdata to struct, Forbidden Segmentation Model "<<endl;
82+ H3DInt32* data = new H3DInt32[size];
83+ for(unsigned int i = 0; i< size;i++)
84+ data[i] = 0;
85+ sForbiddenDrillingStepData.noOfForbiddenVoxelsBoredByUser.setValueFromVoidPtr(data,size,size*sizeof(H3DInt32),this->id);
86+ delete[] data;
87+ this->vForbiddenDrillingStepData.push_back(sForbiddenDrillingStepData);
88+ }
89+
90+ currentDrillingStepId = 1;
91
92 X3DChildNode::initialize();
93-
94 cout<<"Forbidden Segmentation Model Initialized"<<endl;
95 }
96
97@@ -94,8 +113,11 @@
98 else
99 index = getSegmentIdFieldIndex(segmentId)+1;
100
101- unsigned int currentValue = noOfVoxelsBoredByUser->getValue(this->id)[index];
102- noOfVoxelsBoredByUser->setValue(index, ++currentValue,this->id);
103+ unsigned int currentValue2 = noOfVoxelsBoredByUser->getValue(this->id)[index];
104+ noOfVoxelsBoredByUser->setValue(index, ++currentValue2,this->id);
105+
106+ unsigned int currentValue = this->vForbiddenDrillingStepData[currentDrillingStepId-1].noOfForbiddenVoxelsBoredByUser.getValue(this->id)[index];
107+ this->vForbiddenDrillingStepData[currentDrillingStepId-1].noOfForbiddenVoxelsBoredByUser.setValue(index, ++currentValue,this->id);
108 }
109
110 const std::vector<unsigned char> ForbiddenSegmentationModel::getSegmentIds()
111@@ -159,3 +181,20 @@
112 return false;
113 }
114
115+void ForbiddenSegmentationModel::incrementCurrentDrillingStep()
116+{
117+ //currentDrillingStepId = (currentDrillingStepId%noOfDrillingSteps)+1;
118+ currentDrillingStepId++;
119+}
120+
121+void ForbiddenSegmentationModel::decrementCurrentDrillingStep()
122+{
123+ //currentDrillingStepId = (currentDrillingStepId%noOfDrillingSteps)+1;
124+ currentDrillingStepId--;
125+}
126+
127+int ForbiddenSegmentationModel::noOfForbiddenVoxelsDrilledByUser(int segmentID, int drillingStepId)
128+{
129+ return vForbiddenDrillingStepData[drillingStepId-1].noOfForbiddenVoxelsBoredByUser.getValue()[segmentID];
130+}
131+
132
133=== modified file 'src/ForbiddenSegmentationModel.h'
134--- src/ForbiddenSegmentationModel.h 2009-03-26 08:28:57 +0000
135+++ src/ForbiddenSegmentationModel.h 2009-09-18 08:23:43 +0000
136@@ -28,6 +28,16 @@
137 class ForbiddenSegmentationModel : public H3D::X3DChildNode
138 {
139 public:
140+
141+ /**
142+ * Information about Forbidden segments drilled in each drilling step
143+ */
144+ struct forbiddenDrillingStepData_t
145+ {
146+ //The amount bored in each Forbidden segment by the user.
147+ H3D::MFInt32 noOfForbiddenVoxelsBoredByUser;
148+ };
149+
150 /**
151 * Constructor
152 * \param segmentIdField A list of Forbidden Segment Ids, INITIALIZE_ONLY Field
153@@ -57,6 +67,22 @@
154 const std::vector<unsigned char> getSegmentIds();
155
156 /**
157+ * Increment by one the current drilling step.
158+ */
159+ void incrementCurrentDrillingStep();
160+
161+ /**
162+ * Decrement by one the current drilling step.
163+ */
164+ void decrementCurrentDrillingStep();
165+
166+ /**
167+ * Returns the number of voxels drilled by the user in each drillstep for each forbidden segment,
168+ * with the undefined segment value stored as the first value in the noOfForbiddenVoxelsBoredByUser field.
169+ */
170+ int noOfForbiddenVoxelsDrilledByUser(int segmentID, int drillingStepId);
171+
172+ /**
173 * The H3DNodeDatabase for this node.
174 */
175 static H3D::H3DNodeDatabase database;
176@@ -97,6 +123,9 @@
177 const bool existsInSegmentIdField(const unsigned char& segmentId);
178 const bool existsInSegmentNameField(const string& segmentName);
179 const unsigned char getSegmentIdFieldIndex(const unsigned char& segmentId);
180+ std::vector<forbiddenDrillingStepData_t> vForbiddenDrillingStepData; //Vector with amount bored in each Forbidden segment and in each drilling step by the user.
181+ int noOfDrillingSteps;
182+ int currentDrillingStepId;
183 };
184 }
185

Subscribers

People subscribed via source and target branches

to all changes: