[Insight-users] 3D image iterator problem

alaamegawer alaamegawer at yahoo.com
Tue Jun 5 09:52:14 EDT 2012


Hi All
after set all value greater than 1100 to 1100 i had more Brighter image than
original so i told that is 
Unexpected result  but i have another question Set function accumulate or
replace new value with old one?

thanks in advance
Alaa

alaamegawer wrote:
> 
> Hi All
> 
> i wanna iterate over 3D image and during that check for some value i want
> to change. but unfortunately 
> i had unexpected result my image property is
> size 512*512*148 
> pixel size  2 byte
> 
> my code is :
> 
> const char * inputFilename  =
> "C:/Users/Administrator/Desktop/Data/CT/ImageSet_4.mha";
> 	ReaderType::Pointer reader= ReaderType::New();
> 	reader->SetFileName( inputFilename);
> 	reader->Update();
> 
> 	imageWriter::Pointer writer = imageWriter::New();
> 
> 	writer->SetFileName("C:/Users/Administrator/Desktop/Data/CT/55.mha");
> 
> 
> 	InputImageType::Pointer image = reader->GetOutput();
> 	ConstIteratorType in( image, image->GetRequestedRegion() );
> 	IteratorType out( image, image->GetRequestedRegion() );
> 
> 	for ( in.GoToBegin(), out.GoToBegin(); !in.IsAtEnd(); ++in, ++out )
> 	{
>  		if (in.Get() >1100)
>  		{
>  			out.Set(100 );
>  		}
> 
>  		else if (in.Get()<50)
>  		{
>  			out.Set(50);
>  		}	
> 		else 
> 				out.Set(in.Get());
> 	}
> 	
> 	writer->SetInput(image);
> 	writer->Update();
> 
-- 
View this message in context: http://old.nabble.com/3D-image-iterator-problem-tp33963588p33964184.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list