Hi Luis,<br><br>Thanks a lot for your answer. What I am trying to do is to implement a reconstruction algorithm. I haven't used any of the implemented ones because I need to use my own structuring element.<br>What I have to do is dilatation + intersection until the convergence, this is why I need to modify the output of the Dilate filter. Is possible to do it? This is the code I have:<br>
<br> InputImageType::Pointer marker = InputImageType::New();<br> InputImageType::Pointer markerDilated = InputImageType::New();<br> InputImageType::Pointer mask = InputImageType::New();<br><br> marker = readerMarker->GetOutput(); //read the marker image<br>
markerDilated = grayscaleReconstruction->GetOutput(); //read the dilated marker<br> mask = readerMask->GetOutput(); //read the mask image<br><br> // Next we create two iterators. The iterators are initialized over the same region. <br>
//The direction of iteration is set to 0, the $x$ dimension.<br> IteratorType markerDilatedIt( markerDilated, markerDilated->GetRequestedRegion() ); <br> IteratorType maskIt( mask, mask->GetRequestedRegion() );<br>
markerDilatedIt.SetDirection(0);<br> maskIt.SetDirection(0);<br><br> grayscaleReconstruction->SetKernel( structuringElement );<br> WriterType::Pointer writerMarkerDilated = WriterType::New();<br><br> for (int i =0; i<numberOfIterations; i++)<br>
{<br> grayscaleReconstruction->SetInput( marker ); <br> grayscaleReconstruction->Update();<br><br><br> for ( markerDilatedIt.GoToBegin(), maskIt.GoToBegin(); ! maskIt.IsAtEnd();<br> markerDilatedIt.NextLine(), maskIt.NextLine())<br>
{<br> markerDilatedIt.GoToBeginOfLine();<br> maskIt.GoToBeginOfLine();<br><br> while ( ! markerDilatedIt.IsAtEndOfLine() )<br> {<br> if( maskIt.Get()==0 )<br>
{<br> markerDilatedIt.Set( 0 );<br> ++markerDilatedIt;<br> ++maskIt;<br> }<br> else <br> {<br> ++markerDilatedIt;<br>
++maskIt;<br> }<br> }<br> }<br> writerMarkerDilated->SetFileName( argv[2] ); //overwrite the marker<br> writerMarkerDilated->SetInput(markerDilated);<br>
writerMarkerDilated->Update();<br><br> readerMarker->Update();<br> marker->Update();<br><br><br> }<br><br>Thanks a lot for your reply<br>Best<br>Bert<br><br><br>