[vtkusers] [vtkusers]: Weird problem reading BMP image then set transform

Thomas - Kuiran Chen chent at cs.queensu.ca
Fri May 21 11:15:20 EDT 2004


Hi There,

I am having the following errors when reading image using vtkBMPReader.  I also set the data spacing and transform in the reader.  These errors only come out when the transform is set.

ERROR: In \THOMAS_K_CHEN\data_Research\Projects\ThirdParty\vtk-4.2\IO\vtkImageReader.cxx, line 175
vtkBMPReader (0037AAC0): File operation failed: 4294837422, ext: -232, 148, -380, -17, 136, 159

ERROR: In \THOMAS_K_CHEN\data_Research\Projects\ThirdParty\vtk-4.2\IO\vtkImageReader.cxx, line 179
vtkBMPReader (0037AAC0): Header size: 1078, file ext: 0, 342, 0, 380, 0, 0

Generic Warning: In \THOMAS_K_CHEN\data_Research\Projects\ThirdParty\vtk-4.2\IO\vtkBMPReader.cxx, line 476
File operation failed. row = -380, Read = 381, Skip0 = -37, Skip1 = 5848, FilePos = -1, FileName = ../Test_Registration/Data/MatchedUSImageNO775_ROI-8.bmp

The simple code to read in the image is:

	// 2D image transform
	// All the units are set in meters
	SliceTransformMatrix->SetElement(0, 0, -0.33658448304182);
	SliceTransformMatrix->SetElement(0, 1, -0.85428086875344);
	SliceTransformMatrix->SetElement(0, 2, 0);
	SliceTransformMatrix->SetElement(0, 3, 0.24762597798394);

	SliceTransformMatrix->SetElement(1, 0, 0.86780991318033);
	SliceTransformMatrix->SetElement(1, 1, -0.06357157476514);
	SliceTransformMatrix->SetElement(1, 2, 0);
	SliceTransformMatrix->SetElement(1, 3, -0.02272676782324);
	
	SliceTransformMatrix->SetElement(2, 0, -0.36553696548425);
	SliceTransformMatrix->SetElement(2, 1, 0.50824159678083);
	SliceTransformMatrix->SetElement(2, 2, 0);
	SliceTransformMatrix->SetElement(2, 3, -1.27555842452333);
	
	SliceTransformMatrix->SetElement(3, 0, 0);
	SliceTransformMatrix->SetElement(3, 1, 0);
	SliceTransformMatrix->SetElement(3, 2, 0);
	SliceTransformMatrix->SetElement(3, 3, 1); 

	sliceTransform->SetMatrix( SliceTransformMatrix );

	// Live US Image Reader
	vtkBMPReader *LiveUSImage = vtkBMPReader::New();
	LiveUSImage->SetFileName("../Test_Registration/Data/MatchedUSImageNO775_ROI-8.bmp");
	LiveUSImage->Allow8BitBMPOn();
	LiveUSImage->SetDataSpacing(0.0001,  0.0001,  0.0001);
	LiveUSImage->SetTransform(sliceTransform);
	LiveUSImage->Update();

Does anybody have a clue what's going on wrongly here?

BTW, by default, the image that is read in by BMP reader has its left-lower corner as origin, is that right?  The transform is set to w.r.t. that definition in mind.

Thanks a lot,
Thomas






More information about the vtkusers mailing list