Ejemplo n.º 1
0
bool vtkImageDataTest::Run(bool on)
{
	lemon::test<> t;

	vtkImageData* img = MakeImageData(W, H, L);

	int ijk[3] = {1, 1, 1};
	t.is(img->ComputePointId(ijk), vtkIdType(W*H+W+1), "Verify Point Id");
	t.is(img->ComputeCellId(ijk), vtkIdType((W-1)*(H-1)+W), "Verify Cell Id");
	t.is(img->FindPoint(X0+DX/3.0, Y0+DY/3.0, Z0+DZ/3.0), vtkIdType(0), "Verify FindPoint");
	t.is(img->GetActualMemorySize(), 4*2*W*H*L/1024, "Verify ActualMemorySize");
	t.is(img->GetBounds()[0], X0, "GetBounds()[0]");
	t.is(img->GetBounds()[5], Z0+DZ*(L-1), "GetBounds()[1]");
	t.is(img->GetDataDimension(), 3, "GetDataDimension");
	t.ok(img->GetDataReleased()==0, "GetDataReleased");	// "==0" used to remove warning
	t.is(img->GetDimensions()[2], L, "GetDimension");
	t.is(img->GetMaximumNumberOfPieces(), -1, "GetMaximumNumberOfPieces");
	t.is(img->GetOrigin()[0], X0, "GetOrigin");
	t.is(((unsigned long*)img->GetScalarPointer())[W*H*1+W*2+3], (1+2+3)*100, "verify stored data");
	t.is(img->GetScalarSize(), 4, "verify GetScalerSize is 4 byte (long)");
	t.is(img->GetSpacing()[0], DX, "verify get spacing");

	img->Initialize();
	t.is(img->GetDimensions()[0], 0, "dimension is reset after Initialize()");
	img->SetDimensions(W, H, L);
	t.is(img->GetExtent()[1], W-1, "equivalency of SetDimensions and SetExtend()");

	img->Delete();

	vtkImageDataTest test;
//	vtkFilteringTestPipelineTemplate<vtkImageDataTest> pipeline(test);
//	pipeline.StartInteraction();
	return true;
}
Ejemplo n.º 2
0
const uint8* csCommonImageFile::GetAlpha ()
{
  if ((Format & (CS_IMGFMT_PALETTED8 | CS_IMGFMT_ALPHA))
    != (CS_IMGFMT_PALETTED8 | CS_IMGFMT_ALPHA)) return 0;
  MakeImageData();
  return csImageMemory::GetAlpha();
}
Ejemplo n.º 3
0
csRef<iDataBuffer> csCommonImageFile::GetRawData() const
{
  csRef<iDataBuffer> d;
#ifdef THREADED_LOADING
  if (!loadJob) return d;
  WaitForJob();
  csRef<iImageFileLoader> currentLoader = 
    loadJob->currentLoader;
#endif
  if (currentLoader.IsValid()
    && (DataTypeString (currentLoader->GetDataType()) != 0))
    return currentLoader->GetRawData();
  MakeImageData();
  return csImageMemory::GetRawData ();
}
Ejemplo n.º 4
0
const char* csCommonImageFile::GetRawFormat() const
{
#ifdef THREADED_LOADING
  if (!loadJob) return 0;
  //WaitForJob();
  csRef<iImageFileLoader> currentLoader = 
    loadJob->currentLoader;
#endif
  if (currentLoader.IsValid())
  {
    const char* rawFormat = DataTypeString (currentLoader->GetDataType());
    if (rawFormat != 0) return rawFormat;
  }
  MakeImageData();
  return csImageMemory::GetRawFormat ();
}
Ejemplo n.º 5
0
const csRGBpixel* csCommonImageFile::GetPalette()
{
  if (!(Format & CS_IMGFMT_PALETTED8)) return 0;
  MakeImageData();
  return csImageMemory::GetPalette();
}
Ejemplo n.º 6
0
const void* csCommonImageFile::GetImageData()
{
  MakeImageData();
  return csImageMemory::GetImageData();
}