[Insight-users] Multiresolution turns my images into black images.

Adolfo González Uzábal fito at unizar . es
Fri, 21 Nov 2003 09:23:11 +0100


Hello everybody there!

I'm just starting working with the MultiresolutionPyramidFilter in ITK 1.4

I read a .png image, put it into a multiresolution pyramid, 
update it and try to get written the output images.

But the images are totally black.

I've tried the following:
.- Recover the input of the pyramid and get it written. 
OK. I got the image as I had put it.
.- Change the Schedule for resolutions. 
OK. The output sizes changes accordingly to the new schedule.
.- In the forum I've seen some advice from Ms.Ng, about pixel types. I've tried 
with uchar, uint and float with no good results.

I suppose I've missed any step in the generation process.

You can find the main part of my source attached (I've leave out some try/catch 
structs just to be clearer).

Any suggestion or advice will be truly appreciated.

Best wishes!
Adolfo G.U.

-------------------------------------
typedef unsigned char PixelType;
const unsigned int Dimension = 2;
const unsigned int numberOfLevels = 2;
typedef itk::Image< PixelType, Dimension >    ImageType;
	
typedef itk::ImageFileReader< ImageType >  ReaderType;
typedef itk::ImageFileWriter< ImageType >  WriterType;
typedef itk::PNGImageIO ImageIOPNGType;
	  
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
ImageIOPNGType::Pointer pngIO = ImageIOPNGType::New();
	
const char * inputFilename  = "./Files/Circle.png";
const char * outputFilename = "./Files/outputOriginal.png";
	
reader->SetImageIO(pngIO);
reader->SetFileName( inputFilename  );

typedef itk::MultiResolutionPyramidImageFilter<
			ImageType,
			ImageType > FixedImagePyramidType;
	  
FixedImagePyramidType::Pointer myPyramid = 
                             FixedImagePyramidType::New();

myPyramid->SetNumberOfLevels(numberOfLevels );
myPyramid->SetInput(reader->GetOutput() ); 
myPyramid->Update();

writer->SetInput( myPyramid->GetInput(0) );
writer->SetFileName( "./Files/inputExtracted.png" );
writer->Update(); // here everything goes properly
	
for (int i = 0; i < myPyramid->GetNumberOfOutputs(); i++)
{
char tempFilename[50];
sprintf( tempFilename, "./Files/outputResolution%d.png", i );
	
writer->SetInput( myPyramid->GetOutput(i) );
writer->SetFileName( tempFilename);
writer->Update(); // ...but there I got only black images
}


-- 
============================================================= 
Adolfo González Uzábal
Teléfono: 976 - 76 51 44 
e-mail: fito at unizar . es 
.............................................................
Universidad de Zaragoza 
CV Lab
Centro Politécnico Superior 
Edificio Ada Byron 
Laboratorio 3.04 
María de Luna, 1 ( Pol. Actur ) 
50018  ZARAGOZA (ESPAÑA) 
=============================================================