[vtkusers] Error with vtkImageReslice, generate cuts

JoseBarretoT jose.de.paula at live.com
Tue Apr 28 12:49:02 EDT 2015


Good day users,

I'm trying to make a MPR-shaped panoramic view with VTK,
found nothing to help me in native VTK, only imageReslice, most fail to
create from scratch a class for that.

I saw this link
http://www.vtkjournal.org/browse/publication/838
a class that implements all I need, asking only two parameters, the port
zero (0) a source of DICOM, and at the door one (1), a polygon.

Compiled the VTK in version 6.2, ParaView in version 4.3 and version 4.7 in
ITK.

I compiled the code with the active ParaView plugin option, but when I try
to use the class I get these errors:

1 - imageAppend not go out with the panoramic, but with the last image
copied the points.

2 - to update the pepiline, I get error CONNECTION
"ERROR: In .. \ .. \ .. \ source \ Common \ ExecutionModel \
vtkDemandDrivenPipeline.cxx, line 720
vtkCompositeDataPipeline (02C08CB0): Input port 0 of algorithm
vtkFrenetSerretFrame (02BC93A8) has 2 connections but is not repeatable. "
This will vary the number of 2 up to 51 (total points contained my source of
polygon data).


I should get a picture at the end like this:
<http://vtk.1045678.n5.nabble.com/file/n5731662/pano_paraview.png> 


The code I'm using is this:

-----------------------*****----------------------------
private: vtkDICOMImageReader* GetDicom(){
		if (dicomReader == nullptr){
			dicomReader = vtkDICOMImageReader::New();
			dicomReader->SetDirectoryName("D:\\IMAGENSDICOM\\\Dentascan");
			dicomReader->SetDataExtent(0, 63, 0, 63, 1, 93);
			dicomReader->SetDataSpacing(3.2, 3.2, 1.5);
			dicomReader->SetDataOrigin(0.0, 0.0, 0.0);
			dicomReader->SetDataScalarTypeToUnsignedShort();
			dicomReader->SetDataByteOrderToLittleEndian();
			dicomReader->UpdateWholeExtent();
		}
		dicomReader->Update();
		return dicomReader;
	}
	private: System::Void tODOsToolStripMenuItem_Click(System::Object^  sender,
System::EventArgs^  e) {

		GetDicom();

		vtkSmartPointer<vtkXMLPolyDataReader> pathReader =
vtkSmartPointer<vtkXMLPolyDataReader>::New();
		vtkSmartPointer<vtkSplineDrivenImageSlicer> reslicer =
vtkSmartPointer<vtkSplineDrivenImageSlicer>::New();
		vtkSmartPointer<vtkImageAppend> append =
vtkSmartPointer<vtkImageAppend>::New();


	
pathReader->SetFileName("C:\\Users\\jose.barreto.EX_DENTAL\\Desktop\\closed_curve.vtp");
		pathReader->Update();


		reslicer->SetInputConnection(GetDicom()->GetOutputPort());
		reslicer->SetPathConnection(pathReader->GetOutputPort());
		reslicer->SetSliceExtent(250, 200);
		reslicer->SetSliceSpacing(0.2, 0.1);
		reslicer->SetSliceThickness(0.4);
		//reslicer->SetProbeInput(2);


		// Get number of input points
		int nbPoints = pathReader->GetOutput()->GetNumberOfPoints();
		for (int ptId = 0; ptId < nbPoints; ptId++)
		{
			reslicer->SetOffsetPoint(ptId);
			reslicer->Update();

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

			append->AddInputData(tempSlice);
		}
		append->SetAppendAxis(2);
		append->Update();				 

		vtkImageResliceMapper*	im = vtkImageResliceMapper::New();
		im->SetInputConnection(append->GetOutputPort());
		im->SliceFacesCameraOn();
		im->SliceAtFocalPointOn();
		im->BorderOn();

		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, plVisualizacao->Height);
		window->AddRenderer(renderer);

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

		vtkRenderWindowInteractor* interactor = vtkRenderWindowInteractor::New();
		interactor->SetInteractorStyle(imageStyle);
		window->SetInteractor(interactor);		   
		window->Render();
		interactor->Start();	   

	}
-----------------------*****----------------------------

classes sources are on the site I left up.

Please if someone can give me a light.



--
View this message in context: http://vtk.1045678.n5.nabble.com/Error-with-vtkImageReslice-generate-cuts-tp5731662.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list