+/*
# ---------------------------------------------------------------------
#
# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
BBTK_ADD_BLACK_BOX_TO_PACKAGE(gdcmvtk,GetXCoherentInfoGdcmReader)
BBTK_BLACK_BOX_IMPLEMENTATION(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
+
+
+vtkImageData* GetXCoherentInfoGdcmReader::CreateDefaultImage()
+{
+ int i;
+ int sizeX, sizeY, sizeZ;
+ sizeX = 200;
+ sizeY = sizeX;
+ sizeZ = 1;
+ vtkImageData *newImage = vtkImageData::New();
+ newImage->Initialize();
+ newImage->SetScalarTypeToUnsignedChar();
+ newImage->SetSpacing( 1,1,1 );
+ newImage->SetDimensions( sizeX,sizeY,sizeZ );
+ newImage->SetWholeExtent(0, sizeX-1,0,sizeY-1,0,sizeZ-1 );
+ newImage->SetExtent(0, sizeX-1,0,sizeY-1,0,sizeZ-1 );
+ newImage->SetNumberOfScalarComponents(1);
+ newImage->AllocateScalars();
+ newImage->Update();
+ memset ( (void*)newImage->GetScalarPointer(), 0, sizeX*sizeY*1 );
+ for (i=0; i<sizeX; i++)
+ {
+ newImage->SetScalarComponentFromDouble(i,i,0, 0, 255 );
+ newImage->SetScalarComponentFromDouble(i,sizeY-1-i,0, 0, 255 );
+ } // for i
+ return newImage;
+}
+
+
#if defined USE_GDCM
void GetXCoherentInfoGdcmReader::Process()
{
bool res = f->Load();
if ( !res )
{
- f->Delete();
- bbSetOutputOut(0);
- return;
+ printf("EED GetXCoherentInfoGdcmReader::Process resultImage NULL\n");
+ f->Delete();
+ bbSetOutputOut( CreateDefaultImage() );
+ return;
}
// Get info from the first image file
int i;
{
// Read the *first* image file (a SET of file names is given as input)
gdcm::Reader *read = new gdcm::Reader();
- reader->SetFileName( bbGetInputIn()[0].c_str());
+ reader->SetFileName( bbGetInputIn()[0].c_str() );
bool res = read->Read();
- if ( !res )
- {
- delete read;
- bbSetOutputOut(0);
- return;
- }
+ if ( !res )
+ {
+ delete read;
+ bbSetOutputOut(NULL);
+ return;
+ }
+
+
// Get info from the first image file
const gdcm::File &f = read->GetFile();
int i;
}
reader->SetFileNames(files);
reader->Update();
- reader->GetOutput();
bbSetOutputOut( reader->GetOutput() );
}
#endif