[Insight-developers] problem with iterator
Martin Waitzbauer
mazzok at gmx.at
Thu Nov 18 10:37:00 EST 2010
Hi there, i think i have aproblem with understanding the iterators orrectly
im oading a 3d dataset with 256(X)x256(Y)x124(Z)
I wanted to check if i was understanding the iterator behavior correctly by iterating throught al the slices
this can be done with
InputIteratorType it(input,input->GetLargestPossibleRegion());
since i want to acces the slies individually i tried
InputImageType::RegionType reg;
InputImageType::RegionType::SizeType size;
InputImageType::RegionType::IndexType index;
size[0] = 100;
size[1] = 100;
index[0] = 0;
index[1] = 0;
for(int j =0; j < Z_Depth;j++){
index[2] = j;
reg.SetSize(size);
reg.SetIndex(index);
InputIteratorType it(input,reg);
OutputIteratorType ot(output,reg);
for(it.GoToBegin();!it.IsAtEnd();++it){
ot.Set(it.Get());
ot++;
}
}
so i wanted to cut out a 100x100 pieces beginning from (0,0) at each slice, and copy it to the output iterator
visual studio will give me an error on the initialitaion of InputIteratorType it(input,reg);
I couldnt find a way how to instantiate a 'null' InputIteraottype and fill if with the desired Region!
is there a way like the above that i can adress slice-individually iterators?
Thanks alot
M
--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
More information about the Insight-developers
mailing list