[vtkusers] vtkImageViewer StretchDraw

Yamamoto Satoshi satoshi at sysart.co.jp
Tue Jun 13 23:11:40 EDT 2000


Hello,
I speak English with a lisp, Excuse me.

I use vtk2.4 Image Processing with VC++5 in WindowsNT4SP6.
I look the Book[VISUALIZATION TOOLKIT 2nd Edition] Page452,
tcl Sample source,
and make C++ source.

Almost source is digressive.

    vtkImageReader *reader = vtkImageReader::New();
        reader->SetDataByteOrderToLittleEndian();
        reader->SetDataExtent( 0, 255, 0, 255, 1, 93);

        reader->SetFilePrefix("D:/Data/fullHead/headsq");
        reader->SetDataMask(0x7fff);

    vtkImageCast *cast = vtkImageCast::New();
        cast->SetInput(reader->GetOutput());
        cast->SetOutputScalarTypeToFloat();

    vtkImageMagnify *magnify = vtkImageMagnify::New();
        magnify->SetInput(cast->GetOutput());
        magnify->SetMagnificationFactors(2,2,1);
        magnify->InterpolateOn();

    vtkImageGaussianSmooth *smooth = vtkImageGaussianSmooth::New();
        smooth->SetInput(magnify->GetOutput());
        smooth->SetDimensionality(2);
        smooth->SetStandardDeviations( 1.5, 1.5, 0);
        smooth->SetRadiusFactors( 2.01, 2.01, 0);

    vtkImageGradient *gradient = vtkImageGradient::New();
        gradient->SetInput(smooth->GetOutput());
        gradient->SetDimensionality(2); 
        gradient->ReleaseDataFlagOff();

    vtkImageEuclideanToPolar *polar = vtkImageEuclideanToPolar::New();
        polar->SetInput(gradient->GetOutput());
        polar->SetThetaMaximum(255);

    vtkImageConstantPad *pad = vtkImageConstantPad::New();
        pad->SetInput(polar->GetOutput());
        pad->SetOutputNumberOfScalarComponents(3);
        pad->SetConstant(200);

    vtkImageExtractComponents *permute = vtkImageExtractComponents::New();
        permute->SetInput(pad->GetOutput());
        permute->SetComponents( 0, 2, 1);

    vtkImageHSVToRGB *rgb = vtkImageHSVToRGB::New();
        rgb->SetInput(permute->GetOutput());
        rgb->SetMaximum(255);

    vtkImageViewer *viewer = vtkImageViewer::New();

        viewer->SetInput(rgb->GetOutput());
        viewer->SetZSlice(22);
        viewer->SetColorWindow(255);
        viewer->SetColorLevel(50);

    viewer->SetParentId(ParentHwnd);

    viewer->Render();

I can see 2D Image.
But I want to see various Size 2D Image;

I try. 

    viewer->SetParentId(ParentHwnd);
//A    viewer->GetImageWindow()->SetSize( 200, 200);
//B    viewer->SetSize( 200, 200);
    viewer->Render();

I add the A or B code.

the A and B code isn't I hope operating ,too. 
the A and B code changed Window Size.
But didn't change Image Size.

I hope image fit for example (200,200)size.
I want to know How to stretchdraw 2D image.

If you know something solution, tell me ,please.


Thank you read this long mail.
----
Satoshi Yamamoto
satoshi at sysart.co.jp
Sys'Art Ltd. TEL 03-3424-0981 in Japan
----




More information about the vtkusers mailing list