Skip to content

Commit 1740184

Browse files
author
Gregoire Ville
committed
Correction of an error in the main algorithm part
1 parent 86273fa commit 1740184

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Anima/math-tools/common_tools/shapes_to_density/animaShapesToDensity.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
6363

6464
//Initialize data objects for the main algorithm
6565
double ptVals[3], ptValsNext[3];
66-
OutImageType::IndexType index, indexNext;
66+
OutImageType::IndexType index, indexNext, indexTemp;
6767
OutImageType::PointType point, pointNext;
6868

6969

@@ -108,10 +108,10 @@ int main(int argc, char **argv)
108108
//We enter this loop only if maxStep >=2.
109109
//In that case, we create artificial index points, to try to modify all and only all the voxels through which the streamline passes between point and pointNext
110110
//We repeat maxStep - 1 times and not maxStep times, because otherwise, index = indexNext, and we would increment indexNext twice
111-
index[0] = index[0] + std::round(dx/maxStep);
112-
index[1] = index[1] + std::round(dy/maxStep);
113-
index[2] = index[2] + std::round(dz/maxStep);
114-
outImage->SetPixel(index, outImage->GetPixel(index) + 1.0); //increment the number of streamlines passing through the voxel with this index
111+
indexTemp[0] = index[0] + std::round(l*dx/maxStep);
112+
indexTemp[1] = index[1] + std::round(l*dy/maxStep);
113+
indexTemp[2] = index[2] + std::round(l*dz/maxStep);
114+
outImage->SetPixel(indexTemp, outImage->GetPixel(indexTemp) + 1.0); //increment the number of streamlines passing through the voxel with the index indexTemp
115115
}
116116
}
117117
}

0 commit comments

Comments
 (0)