[vtkusers] Trouble blending two 3d images

kenichiro yoshimi rccm.kyoshimi at gmail.com
Mon Aug 14 10:43:05 EDT 2017


Hi Andaharoo,

How about compiling with debug and using DebugOn member function on
the blendFilter?
  blendFilter->DebugOn();
It may display additional information related to the problem.

Regards,
yoshimi

2017-08-13 17:28 GMT+09:00 Andaharoo <Andx_roo at live.com>:
> I have two 3d images that I'd like to blend and then display in imageViewer2.
> Here's the code:
> // Create the mask image based off input
> maskImage = vtkSmartPointer<vtkImageData>::New();
> maskImage->SetDimensions(inputImage->GetDimensions());
> maskImage->SetSpacing(inputImage->GetSpacing());
> maskImage->SetOrigin(inputImage->GetOrigin());
> maskImage->AllocateScalars(VTK_UNSIGNED_CHAR, 3);
> int* dim = maskImage->GetDimensions();
> // Get pointer to beginning of image
> unsigned char* ptr = static_cast<unsigned
> char*>(maskImage->GetScalarPointer(0, 0, 0));
> for (int i = 0; i < dim[0] * dim[1] * dim[2]; i++)
> {
>         // Set and advance the pixel
>         *ptr++ = 255;
>         *ptr++ = 0;
>         *ptr++ = 0;
> }
> blendFilter = vtkSmartPointer<vtkImageBlend>::New();
> blendFilter->AddInputData(inputImage);
> blendFilter->AddInputData(maskImage);
> blendFilter->SetOpacity(0, 1.0);
> blendFilter->SetOpacity(1, 0.5);
> blendFilter->Update();
>
> Unfortunately my program just freezes and pulls up the vtkOutputWindow with
> nothing in it.
>
> Also does type matter when using these? I'm trying to blend a grayscale
> (single float image) with an rgb image (uchar).
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Trouble-blending-two-3d-images-tp5744385.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list