[vtkusers] vtkImageAppend is black

JoseBarretoT jose.de.paula at live.com
Tue Apr 14 14:26:33 EDT 2015


Hello, I am using gtk Image Append, add a set of cuts made by
vtkSplineDrivenImageSlicer, but to put on the screen, I get a black object.
This is my code, I tried already changing in every way, both input when
screen output. Also generated a .vti and open in ParaViewer even more yes
objtive image data.
Can anyone help me?
private:	vtkXMLImageDataReader* imgReader;
	private:	vtkXMLPolyDataReader* pathReader;
	private:	vtkSplineDrivenImageSlicer* reslicer;
	
	private:	vtkImageAppend* append1 = vtkImageAppend::New();

private: System::Void vTIToolStripMenuItem1_Click(System::Object^  sender,
System::EventArgs^  e) {
		imgReader = vtkXMLImageDataReader::New();
		pathReader = vtkXMLPolyDataReader::New();
		reslicer = vtkSplineDrivenImageSlicer::New();

	
imgReader->SetFileName("C:\\Users\\jose.barreto.EX_DENTAL\\Desktop\\vtk.vti");
		imgReader->Update();
		pathReader->SetFileName("C:\\Users\\jose.barreto.EX_DENTAL\\Desktop\\git
exemplo\\src\\Documentation\\Resources\\closed_curve.vtp");
		pathReader->Update();

		reslicer->SetInputConnection(imgReader->GetOutputPort());
		reslicer->SetPathConnection(pathReader->GetOutputPort());
		//reslicer->ProbeInputOn();
		reslicer->SetSliceExtent(250, 200);
		reslicer->SetSliceSpacing(0.2, 0.1);
		reslicer->SetSliceThickness(0.4);
		reslicer->Update();
	}



	private: System::Void toolStripMenuItem2_Click(System::Object^  sender,
System::EventArgs^  e) {
		//TrocarCorte(20);

		//append1 = vtkSmartPointer<vtkImageAppend>::New();
		int nbPoints = pathReader->GetOutput()->GetNumberOfPoints();
		for (int ptId = 0; ptId < nbPoints; ptId++)
		{
		reslicer->SetOffsetPoint(ptId);
		reslicer->Update();

		vtkSmartPointer<vtkImageData> tempSlice;
		tempSlice = vtkSmartPointer<vtkImageData>::New();
		tempSlice->DeepCopy(reslicer->GetOutput(0));

		append1->AddInputData(reslicer->GetOutput(0));
		}
		append1->SetAppendAxis(2);
		append1->Update();

		//vtkSmartPointer<vtkLookupTable> table =
vtkSmartPointer<vtkLookupTable>::New();
		//table->SetRange(0, 2000); // image intensity range
		//table->SetValueRange(0.0, 1.0); // from black to white
		//table->SetSaturationRange(0.0, 0.0); // no color saturation
		//table->SetRampToLinear();
		//table->Build();
		//// Map the image through the lookup table
		//vtkSmartPointer<vtkImageMapToColors> color =
vtkSmartPointer<vtkImageMapToColors>::New();
		//color->SetLookupTable(table);
		//color->SetInputConnection(reslicer->GetOutputPort());
		//// Display the image
		//vtkSmartPointer<vtkImageActor> actor =
vtkSmartPointer<vtkImageActor>::New();
		//actor->GetMapper()->SetInputConnection(color->GetOutputPort());

		vtkImageResliceMapper*	im = vtkImageResliceMapper::New();
		im->SetInputConnection(append1->GetOutputPort());
		im->SliceFacesCameraOn();
		im->SliceAtFocalPointOn();
		im->BorderOff();

		vtkImageProperty* ip = vtkImageProperty::New();
		ip->SetColorWindow(2000);
		ip->SetColorLevel(1000);
		ip->SetAmbient(0.0);
		ip->SetDiffuse(1.0);
		ip->SetOpacity(1.0);
		ip->SetInterpolationTypeToLinear();

		vtkImageSlice*	ia = vtkImageSlice::New();
		ia->SetMapper(im);
		ia->SetProperty(ip);


		vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
		renderer->AddViewProp(ia);

		vtkRenderWindow* window = vtkRenderWindow::New();

		window->SetParentId(plVisualizacao->Handle.ToPointer());
		window->SetSize(plVisualizacao->Width, plCorte1->Height);
		window->AddRenderer(renderer);

		// Set up the interaction
		vtkSmartPointer<vtkInteractorStyleImage> imageStyle =
vtkSmartPointer<vtkInteractorStyleImage>::New();
		imageStyle->SetInteractionModeToImage3D();

		vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
		interactor->SetInteractorStyle(imageStyle);
		window->SetInteractor(interactor);


	/*	vtkCamera* cam1 = renderer->GetActiveCamera();
		cam1->ParallelProjectionOn();*/



		window->Render();

		interactor->Start();


	}



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkImageAppend-is-black-tp5731452.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list