[Insight-users] Software Guide Updated : Final Release
marcellus walace
marcelluswalace at hotmail . com
Mon, 25 Aug 2003 22:25:49 +0200
Hi ALL,
I've some problem with iterators. I've taken the lastest version as you said
last time. So I don't have any runtime error any more.
I want to copy pixels lines from a stack of file to one another file. So
I've an array of image called
TableauReader where I've put all the images of the stack to read. And I want
to copy the middle
pixel lines of the images of the array tableauReader to a new image
outputimage.
There's no runtime error but when I view the outputimage I can see anything.
All the image of TableauReader have the same size.
Can someone help me?
The code
ImageType::Pointer outputImage = ImageType::New();
outputImage->SetRegions(
TableauReader[0]->GetOutput()->GetRequestedRegion() );
outputImage->CopyInformation( TableauReader[0]->GetOutput() );
outputImage->Allocate();
//an iterator to walk the output file
IteratorType outputIt( outputImage,
TableauReader[0]->GetOutput()->GetRequestedRegion() );
outputIt.SetDirection(0);
outputIt.GoToBegin();
for (int j=0; j<nomb; j++ ) {
if (!outputIt.IsAtEnd()) {
//create an iterator to walk each file of the array Tableaureader
ConstIteratorType inputIt( TableauReader[j]->GetOutput(),
TableauReader[j]->GetOutput()->GetRequestedRegion() );
inputIt.SetDirection(0);
/* for ( inputIt.GoToBegin(), outputIt.GoToBegin(); ! inputIt.IsAtEnd();
outputIt.NextLine(), inputIt.NextLine())
{ */
inputIt.GoToBegin();
// looking for the middle line of the file.
for (int h=1;h<=128 /*,!inputIt.IsAtEnd()*/;h++) {
inputIt.NextLine();
std::cout<<"la valeur de h"<<h<<std::endl;
}
inputIt.GoToBeginOfLine();
outputIt.GoToBeginOfLine();
//++outputIt;
//write the line into the output file
while ( ! inputIt.IsAtEndOfLine() && ! outputIt.IsAtEndOfLine() )
{
outputIt.Set( inputIt.Get() );
++inputIt;
++outputIt;
}
outputIt.NextLine(); //go the next line to be written
}// end of if
}// end of first for loop
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join . msn . com/?page=features/junkmail