<div dir="ltr">Hi there ITK community ,<br><br>I am working on a task to calculate the minimum distance to multiple regions of an organ in 3D. Basically I have an image containing 20 connected regions indicated by integers from 1 to 20.<br>My task is to assign to each voxel in the 3D volume, the label (i.e. the integer) corresponding to the closest region to that voxel. I have checked the Danielsson filter and it seems suitable to my task, however I tried it and it did not really work. To my understanding it assumes that the regions are disconnected and are indicated by "one's'" (page 127 of ITK manual 4.8) so it is not suitable for connected regions. Maybe someone has a better solution to solve my task?<br><br>One solution that came to my mind is run the Danielsson filter on each region separately and then search for the minimum distance for each pixel and fetch the corresponding label. <br>I wrote some code (see attachment) but I get a crash when I try to access the result of the Danielsson filter with an iterator. I admit that I do not have much experience so it might be some syntax errors in coding or in handling the ITK objects etc.<br><br>Any help is appreciated.<br><br>Regards,<br>Marco               <br clear="all"><br></div>