void
CreateStringFromInput(vtkImageData *img, float *zbuffer, unsigned char *&str,
                      int &len)
{
    // make a shallow copy for if we need to attach zbuffer data
    vtkImageData *tmp  = vtkImageData::New();
    tmp->ShallowCopy(img);

    //
    // Figure out what the width and height should be before we start altering
    // the image (the image should not be altered, but you never know with VTK)
    //
    int dims[3];
    tmp->GetDimensions(dims);
    int width  = dims[0];
    int height = dims[1];

    // add the zbuffer as point data if we have one
    if (zbuffer)
    {
       vtkFloatArray *zArray = vtkFloatArray::New();
       zArray->SetNumberOfComponents(1);
       int iOwnIt = 1;  // 1 means we own it -- you don't delete it.
       zArray->SetArray(zbuffer, width * height, iOwnIt);
       zArray->SetName("zbuffer");
       tmp->GetPointData()->AddArray(zArray);
       zArray->Delete();
    }

    CreateStringFromVTKInput(tmp, str, len);

    tmp->Delete();
}
static
void
CreateStringFromInput(vtkImageData *img, vtkFloatArray *zbuf, unsigned char *&str,
                      int &len)
{
    // make a shallow copy for if we need to attach zbuffer data
    vtkImageData *tmp  = vtkImageData::New();
    tmp->ShallowCopy(img);

    // add the zbuffer as point data if we have one
    if (zbuf)
       tmp->GetPointData()->AddArray(zbuf);

    CreateStringFromVTKInput(tmp, str, len);

    tmp->Delete();
}