// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
+
+vtkImageData* ReadMHDPlane::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;
+}
+
+
void ReadMHDPlane::ReadNormalMHD()
{
// THE MAIN PROCESSING METHOD BODY
if (ok==false)
{
- int i;
- int sizeX, sizeY, sizeZ;
- sizeX = 200;
- sizeY = sizeX;
- sizeZ = 1;
- 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
+ newImage=CreateDefaultImage();
} // if ok
bbSetOutputOut( newImage );
float ox=-1,oy=-1,oz=-1;
long int headersize=0;
- vtkImageData *newImage;
+ vtkImageData *newImage=NULL;
char mystring[250];
char strTmp[30];
FILE *ffIn = fopen(bbGetInputFileName().c_str(),"r");
long long dataSize;
-
-
if (ffIn!=NULL)
{
newImage = vtkImageData::New();
}
}
} // for j
- } // if PLANE YZ
-
-
+ } // if PLANE YZ
#if defined(_WIN32)
_close (fd);
#else
close (fd);
#endif // defined(_WIN32)
+ } else {
+ newImage=CreateDefaultImage();
+ } // if ffIn
- bbSetOutputOut( newImage );
- } // if
-
+ bbSetOutputOut( newImage );
}