<div dir="ltr">Hi all,<br>
<br>
The process below describes my algorithm that generates an output image that<br>
looks spacious (output image is attached).<br>
<br>
* note that all the input images have the same size<br>
- manipulate on each input image the DanielssonDistanceMapImageFilt<div id=":8a">er<br>
- on each pixel's output image set the addition of the corresponding pixel's<br>
value from the distance maps images<br>
<br>
The problem is the spacing of the output image, although I maintained the<br>
spacing at the initializing stage.<br>
<br>
The code:<br>
<br>//manipulate DanielssonDistanceMapImageFilt
<div id=":8a">er on im1, im2<br></div><br>
typedef itk::ImageRegionIterator <ImageType> iteratorType;<br>
typedef itk::ImageRegionConstIterator <ImageType> constIteratorType;<br>
<br>
//maintain origin<br>
//----------------<br>
const ImageType::PointType& inputOrigin = im1->GetOrigin();<br>
double outputOrigin[ 3 ];<br>
for(unsigned int i=0; i< 3; i++)<br>
{<br>
outputOrigin[i] = inputOrigin[i];<br>
}<br>
<br>
//generating output Image<br>
//------------------------<br>
ImageType::Pointer outputImage = ImageType::New();<br>
outputImage->SetOrigin(outputOrigin);<br>
outputImage->SetSpacing(im1->GetSpacing());<br>
outputImage->SetRegions(im1->GetLargestPossibleRegion());<br>
outputImage->CopyInformation(im1);<br>
outputImage->Allocate();<br>
outputImage->FillBuffer(0);<br>
outputImage->Update();<br>
<br>
// generate iterators<br>
constIteratorType im1_iterator (im1, im1-> GetLargestPossibleRegion());<br>
constIteratorType im2_iterator (im2, im2->GetLargestPossibleRegion());<br>
<br>
// generate writeable output iterator<br>
iteratorType output_iterator (outputImage,<br>
outputImage->GetLargestPossibleRegion());<br>
<br>
//add values from disMap images im1 and im2 in order to set in the output<br>
image<br>
for(im1_iterator.GoToBegin(), im2_iterator.GoToBegin();<br>
!im1_iterator.IsAtEnd();<br>
im1_iterator ++, im2_iterator ++, output_iterator ++)<br>
{<br>
outputPix_value = im1_iterator.Get() + im2_iterator.Get();<br>
//set this pixel to outputImage<br>
output_iterator.Set(outputPix_value);<br>
}//for<br>
outputImage->Update();</div><span onmouseout="cancel = false; window.setTimeout(WRCHideContent, 1000); clearTimeout(showTimer);" onmouseover=" var self = this; showTimer = window.setTimeout(function(){WRCShowContent({'rating':{'value':-1,'weight':-1},'flags':{},'single':false,'ttl':7200,'expireTime':'20111231233516'}, self.className)},600);" class="wrc0" style="padding-right:16px;width:16px;height:16px"></span></div>