[Insight-users] ImageFileReader bug

Sara Rolfe smrolfe at u.washington.edu
Wed Dec 15 16:06:11 EST 2010


Hello,
I've run into a problem reading a 3D vector field with 3 component  
vectors.  I've generated and read in images where the voxels are 2, 4,  
and 5 component vectors with no problem.  When I change the number of  
components to 3, the program stalls when I run it, during the reader  
update.  Could this be a bug in the reader?  Please let me know if you  
have any ideas.  I'm including my code below.

Thanks,
Sara

#include "itkImageFileReader.h"
#include "itkImage.h"

int main(  int argc,  char * argv[]  )
{
	if( argc < 4 )
     {
		std::cerr << "Usage: " << std::endl;
		std::cerr << argv[0];
		std::cerr << " inputVectorImage.vtk outputLabeledImage.vtk";
		std::cerr << " numberOfClasses " << std::endl;
		return EXIT_FAILURE;
     }
	
	const int numberOfComponents = 3;
	typedef itk::Vector< double, numberOfComponents >	PixelType;
	typedef itk::Image< PixelType, 3 >			ImageType;
	typedef itk::ImageFileReader< ImageType >		ReaderType;

	// assign input variables
	const char * inputImageFileName = argv[1];
	const char * outputImageFileName = argv[2];
	const int numberOfClasses = atoi( argv[3] );
	
	// Read image from file
	std::cout <<"Read image from file" << std::endl;
	ReaderType::Pointer reader = ReaderType::New();
	reader->SetFileName( inputImageFileName );
	reader->Update();

	std::cout <<"Get reader output" << std::endl;
	ImageType::Pointer inputPtr = ImageType::New();
	inputPtr = reader->GetOutput();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101215/745db10f/attachment.htm>


More information about the Insight-users mailing list