[Insight-users] how to update the content of an image

Iván Macía imacia at vicomtech.org
Thu Apr 24 08:38:06 EDT 2008


Hi Bert,

 

Your code snippet is not correct. You cannot directly write on the output of
a ProcessObject such as a reader/filter. Instead you must assign it to an
image pointer and call DisconnectPipeline(). The code would look like this
if I’m not wrong. Note that there may be errors and I didn’t even try it.

 

InputImageType::Pointer mk = readerMk->GetOutput(); 

mk->DisconnectPipeline();

 

for (int i =0; i<2; i++)
  {
      grayscaleDilate->SetInput( mk ); 

      grayscaleDilate->Update();

 

      mk = grayscaleDilate->GetOutput();

      mk->DisconnectPipeline();

 

      IteratorType mkIt( mk, mk->GetRequestedRegion() );

      for ( markerIt.GoToBegin(); ! markerIt.IsAtEnd();
          mkIt.NextLine())
      {
          makIt.GoToBeginOfLine();
          while ( ! mkIt.IsAtEndOfLine() )
          {
              mkIt.Set( false );
              ++mkIt;
          }
      }
     

}

Hope that helps

 

Ivan

 

   _____  

De: insight-users-bounces at itk.org [mailto:insight-users-bounces at itk.org] En
nombre de Bert
Enviado el: miércoles, 23 de abril de 2008 23:24
Para: insight-users at itk.org
Asunto: [Insight-users] how to update the content of an image

 

Dear all,

I would like to update the content of an image. I read an 
image from a file and then this image is passed, as an 
argument, in the itkGrayscaleDilateFilter. The output of 
this filter is then modificated and passed again in the
 itkGrayscaleDilateFilter.How can I update the new content 
ok ReaderMk(see the code)?

InputImageType::Pointer mk = InputImageType::New();
mk = readerMk->GetOutput();   
IteratorType mkIt( mk, mk->GetRequestedRegion() );     

  mkIt.SetDirection(0);
  
  grayscaleDilate->SetKernel( structuringElement );


  for (int i =0; i<2; i++)
  {
      grayscaleDilate->SetInput( readerMk->GetOutput() );    //I would like
to update the readerMk
      grayscaleDilate->Update();

          for ( markerIt.GoToBegin(); ! markerIt.IsAtEnd();
          mkIt.NextLine())
      {
          makIt.GoToBeginOfLine();
          while ( ! mkIt.IsAtEndOfLine() )
          {
              mkIt.Set( false );
              ++mkIt;
          }
      }
      readerMk->Update();     //Do I need to add something else?

}

Thanks a lot for your help

No virus found in this incoming message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.3/1392 - Release Date: 22/04/2008
15:51


No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.4/1394 - Release Date: 23/04/2008
19:16
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080424/a6fb01a0/attachment-0001.htm>


More information about the Insight-users mailing list