[vtkusers] about vtkImageBlend

胡正珲 zhengh.hu at gmail.com
Sun Jan 14 07:24:49 EST 2007


To all vtkuser:

        i am a VTK novice, i have the following program, but it seems have
something wrong. anyone can give me some advices? thank you in advance.

//========================================================================================================

#include "vtkImageGridSource.h"
#include "vtkBMPReader.h"
#include "vtkImageBlend.h"
#include "vtkImageViewer.h"
#include "vtkImageGaussianSmooth.h"
#include "vtkImageMathematics.h"

int main()
{

    vtkImageGridSource *imageGrid = vtkImageGridSource::New();
    imageGrid->SetGridSpacing(16, 16, 0);
    imageGrid->SetGridOrigin(0, 0, 0);
    imageGrid->SetDataExtent(0, 255, 0, 255, 0, 0);
    imageGrid->SetLineValue(4095);
    imageGrid->SetFillValue(0);
    imageGrid->SetDataScalarTypeToShort();

    vtkBMPReader *bmpReader = vtkBMPReader::New();
    bmpReader->SetFileName("aaa10.bmp");

    vtkImageBlend *blend = vtkImageBlend::New();
    blend->SetOpacity(0, 0.5);
    blend->SetOpacity(1, 0.5);
    blend->AddInput(0, imageGrid->GetOutput());
    blend->AddInput(1, bmpReader->GetOutput());

    vtkImageViewer *viewer = vtkImageViewer::New();
    viewer->SetInput(blend->GetOutput());
    viewer->SetColorWindow(1000);
    viewer->SetColorLevel(500);
    viewer->Render();

    imageGrid->Delete();
    bmpReader->Delete();
    blend->Delete();
    viewer->Delete();


return 0;

}

-- 
Hu zhenghui
Medical Image Computing Group (MICG)
Department of Electronic and Computer Engineering
Hong Kong University of Science and Technology
Clear Water Bay, Kowloon, HongKong
Tel: +852-2358-7077
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070114/8d8cdac3/attachment.htm>


More information about the vtkusers mailing list