<div>Hello again. I hope it is okay i send all these questions...this program is causing me some problems. I have read on google and in the userguide, but i was not able to find any explanation to how it is possible to put now data into the contourfilter, and rerender this every time a certain key is pressed. I managed to create a vtkCallbackcommand and us this. This works fine, and i can write to the std::cout whenever a key is pressed and do some action. I made a callbackfunction.
</div>
<div>void callbackMethod(vtkObject *caller, unsigned long eventID, void* clientData,void* data){...}</div>
<div>which is called everytime a key is pressed. Wonderful.</div>
<div>&nbsp;</div>
<div>Now, what i want to do is to take my data, manipulate them everytime a key is pressed, and then show these on the screen instead. But when i put the new data into my objects, a pointer exception occurs (as always). I dont understand why this occurs, and I hope somebody can help me. I have copied my program, i know its quite a long code, but the reason for this is that i have 12 different actors that i need to render, and a pipeline with different data for each actor.
</div>
<div>&nbsp;</div>
<div>So my question is: How do i change the data of the contourfilter and rerender it on the fly(while program is running): A very short pseudo code of what i am doing is the following</div>
<div>&nbsp;</div>
<div>1. load files</div>
<div>2. import files: binary-&gt;vnl-&gt;itk-&gt;vtk</div>
<div>3. find zerocrossings in data and create isosurfaces for rendering using vtkContourFilter</div>
<div>4. Setup Commandobjekt for keyboardevents</div>
<div>5. render</div>
<div>6. onclick: use vnl to manipulate data from binary files (this creating different volumes) to again import to vtk, use contourfilter and render isosurface. &lt;---This is the point going wrong. See function void callbackMethod().
</div>
<div>&nbsp;</div>
<div>Thank you very much, and sorry for all the questions once again. I appreciate your help.</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>Program listing:</div>
<div>&nbsp;</div>
<div>
<p>#include &lt;ctime&gt;<br>#include&lt;cstdio&gt;<br>#include &lt;fstream&gt;<br>#include &lt;vtkImageData.h&gt;<br>#include &quot;vtkImageImport.h&quot; //Import images for VTK<br>#include &quot;vtkActor.h&quot;<br>#include &quot;
vtkOutlineFilter.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkLight.h
&quot;<br>#include &quot;vtkCamera.h&quot;<br>#include &quot;vtkContourFilter.h&quot;<br>#include &quot;vtkProperty.h&quot;<br>#include &quot;vtkMarchingCubes.h&quot;<br>#include &quot;vtkWindowedSincPolyDataFilter.h&quot;
<br>#include &quot;vtkDataSetWriter.h&quot;<br>#include &quot;vtkCallbackCommand.h&quot;<br>#include &quot;vtkCommand.h&quot;</p>
<p><br>#include &quot;itkImportImageFilter.h&quot;<br>#include &quot;itkImage.h&quot;<br>#include &quot;itkImageRegionConstIterator.h&quot;<br>#include &quot;itkVTKImageExport.h&quot;<br>#include &quot;itkZeroCrossingImageFilter.h
&quot;</p>
<p>#include&lt;map&gt;<br>#include &lt;blitz/Array.h&gt;<br>#include &lt;vnl/vnl_matrix.h&gt;<br>#include &lt;vnl/vnl_vector.h&gt;<br>#include &lt;vnl/vnl_identity.h&gt;</p>
<p><br>typedef float SDMdatatype;<br>typedef unsigned short Binarytype;</p>
<p>typedef itk::Image&lt;SDMdatatype,3&gt; SDMimg;<br>typedef vnl_matrix&lt;SDMdatatype&gt; mat;<br>typedef itk::ImportImageFilter&lt;SDMdatatype,3&gt; ImportFilterType;<br>typedef itk::VTKImageExport&lt;SDMimg&gt; ImageExportType;
</p>
<p><br>ImportFilterType::Pointer dataPointer2itk(SDMdatatype* data);</p>
<p>int D[]={110,129,97};</p>
<p>unsigned int N=D[0]*D[1]*D[2];<br>unsigned short m=12;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Shape count<br>unsigned short sm=7;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Significant modes chosen<br>mat meanShape(N*m,1);<br>mat prinComp(N*m,sm);<br>mat prinVal(sm,1);<br>struct commandObj{
<br>&nbsp;ImportFilterType::Pointer importFilter1;<br>&nbsp;ImportFilterType::Pointer importFilter2;<br>&nbsp;ImportFilterType::Pointer importFilter3;<br>&nbsp;ImportFilterType::Pointer importFilter4;<br>&nbsp;ImportFilterType::Pointer importFilter5;
<br>&nbsp;ImportFilterType::Pointer importFilter6;<br>&nbsp;ImportFilterType::Pointer importFilter7;<br>&nbsp;ImportFilterType::Pointer importFilter8;<br>&nbsp;ImportFilterType::Pointer importFilter9;<br>&nbsp;ImportFilterType::Pointer importFilter10;
<br>&nbsp;ImportFilterType::Pointer importFilter11;<br>&nbsp;ImportFilterType::Pointer importFilter12;<br>};</p>
<p>void callbackMethod(vtkObject *caller, unsigned long eventID, void* clientData,void* data){<br>&nbsp;vtkRenderWindowInteractor *iren = reinterpret_cast&lt;vtkRenderWindowInteractor*&gt;(caller);<br>&nbsp;commandObj* cmdObj = reinterpret_cast&lt;commandObj*&gt; ( clientData ) ;
</p>
<p>&nbsp;mat m1=meanShape.extract(N,1, 0*N,0);<br>&nbsp;mat m2=meanShape.extract(N,1, 1*N,0);<br>&nbsp;mat m3=meanShape.extract(N,1, 2*N,0);<br>&nbsp;mat m4=meanShape.extract(N,1, 3*N,0);<br>&nbsp;mat m5=meanShape.extract(N,1, 4*N,0);<br>&nbsp;mat m6=
meanShape.extract(N,1, 5*N,0);<br>&nbsp;mat m7=meanShape.extract(N,1, 6*N,0);<br>&nbsp;mat m8=meanShape.extract(N,1, 7*N,0);<br>&nbsp;mat m9=meanShape.extract(N,1, 8*N,0);<br>&nbsp;mat m10=meanShape.extract(N,1, 9*N,0);<br>&nbsp;mat m11=meanShape.extract
(N,1, 10*N,0);<br>&nbsp;mat m12=meanShape.extract(N,1, 11*N,0);</p>
<p>&nbsp;cmdObj-&gt;importFilter1-&gt;SetImportPointer(m1.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter2-&gt;SetImportPointer(m2.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter3-&gt;SetImportPointer(m3.data_block(),N,true);
<br>&nbsp;cmdObj-&gt;importFilter4-&gt;SetImportPointer(m4.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter5-&gt;SetImportPointer(m5.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter6-&gt;SetImportPointer(m6.data_block(),N,true);
<br>&nbsp;cmdObj-&gt;importFilter7-&gt;SetImportPointer(m7.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter8-&gt;SetImportPointer(m8.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter9-&gt;SetImportPointer(m9.data_block(),N,true);
<br>&nbsp;cmdObj-&gt;importFilter10-&gt;SetImportPointer(m10.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter11-&gt;SetImportPointer(m11.data_block(),N,true);<br>&nbsp;cmdObj-&gt;importFilter12-&gt;SetImportPointer(m12.data_block(),N,true);
</p>
<p>&nbsp;std::cout&lt;&lt;&quot;rendering...&quot;&lt;&lt;std::endl;<br>&nbsp;iren-&gt;Render();<br>&nbsp;std::cout&lt;&lt;&quot;rendering done&quot;&lt;&lt;std::endl;<br>}</p>
<p>/**<br>&nbsp;* This function will connect the given vtkImageExport filter to<br>&nbsp;* the given itk::VTKImageImport filter.<br>&nbsp;*/<br>//template &lt;typename VTK_Exporter, typename ITK_Importer&gt;<br>void ConnectPipelines(ImageExportType* exporter, vtkImageImport* importer)
<br>{<br>&nbsp; importer-&gt;SetUpdateInformationCallback(exporter-&gt;GetUpdateInformationCallback());<br>&nbsp; importer-&gt;SetPipelineModifiedCallback(exporter-&gt;GetPipelineModifiedCallback());<br>&nbsp; importer-&gt;SetWholeExtentCallback(exporter-&gt;GetWholeExtentCallback());
<br>&nbsp; importer-&gt;SetSpacingCallback(exporter-&gt;GetSpacingCallback());<br>&nbsp; importer-&gt;SetOriginCallback(exporter-&gt;GetOriginCallback());<br>&nbsp; importer-&gt;SetScalarTypeCallback(exporter-&gt;GetScalarTypeCallback());
<br>&nbsp; importer-&gt;SetNumberOfComponentsCallback(exporter-&gt;GetNumberOfComponentsCallback());<br>&nbsp; importer-&gt;SetPropagateUpdateExtentCallback(exporter-&gt;GetPropagateUpdateExtentCallback());<br>&nbsp; importer-&gt;SetUpdateDataCallback(exporter-&gt;GetUpdateDataCallback());
<br>&nbsp; importer-&gt;SetDataExtentCallback(exporter-&gt;GetDataExtentCallback());<br>&nbsp; importer-&gt;SetBufferPointerCallback(exporter-&gt;GetBufferPointerCallback());<br>&nbsp; importer-&gt;SetCallbackUserData(exporter-&gt;GetCallbackUserData());
<br>}</p>
<p>SDMdatatype* readArrayFromFile(char* fn,long size){<br>&nbsp;std::ifstream file;<br>&nbsp;file.open(fn,std::ios::in|std::ios::binary);<br>&nbsp;if (!file) { printf(&quot;file was not opened, issue error msg&quot;); }<br>&nbsp;SDMdatatype* buffer;&nbsp;
<br>&nbsp;buffer = new SDMdatatype[size];<br>&nbsp;file.read(reinterpret_cast&lt;char*&gt;(buffer), sizeof (SDMdatatype) * size);//static_cast &lt;char *&gt; buffer<br>&nbsp;file.close();<br>&nbsp;return buffer;<br>}<br>// Import data from a pointer into an itkImportFilter
<br>ImportFilterType::Pointer dataPointer2itk(SDMdatatype* data){<br>&nbsp;ImportFilterType::Pointer importFilter = ImportFilterType::New();<br>&nbsp;ImportFilterType::SizeType size;<br>&nbsp;double origin[3];<br>&nbsp;double spacing[3];<br>
&nbsp;size[0]&nbsp; = D[0];&nbsp; // size along X<br>&nbsp;size[1]&nbsp; = D[1];&nbsp; // size along Y<br>&nbsp;size[2]&nbsp; = D[2];&nbsp; // size along Z<br>&nbsp;origin[0] = 0.0;&nbsp;&nbsp;&nbsp; // X coordinate <br>&nbsp;origin[1] = 0.0;&nbsp;&nbsp;&nbsp; // Y coordinate<br>&nbsp;origin[2] = 0.0;&nbsp;&nbsp;&nbsp; // Z coordinate
<br>&nbsp;spacing[0] = 1.0;&nbsp;&nbsp;&nbsp; // along X direction <br>&nbsp;spacing[1] = 1.0;&nbsp;&nbsp;&nbsp; // along Y direction<br>&nbsp;spacing[2] = 1.0;&nbsp;&nbsp;&nbsp; // along Z direction<br>&nbsp;ImportFilterType::IndexType start;<br>&nbsp;start.Fill( 0 );<br>&nbsp;ImportFilterType::RegionType region;
<br>&nbsp;region.SetIndex( start );<br>&nbsp;region.SetSize(&nbsp; size&nbsp; );<br>&nbsp;&nbsp;importFilter-&gt;SetRegion( region );<br>&nbsp;importFilter-&gt;SetOrigin( origin );<br>&nbsp;importFilter-&gt;SetSpacing( spacing );<br>&nbsp;importFilter-&gt;SetImportPointer(data,N,true);
<br>&nbsp;return importFilter;<br>}<br>void loadPCAResults(){<br>&nbsp;SDMdatatype* b1=readArrayFromFile(<br>&nbsp;&nbsp;&quot;C:\\thesisIntermediate\\meanshape.dat&quot;,<br>&nbsp;N*m);<br>&nbsp;meanShape.copy_in(b1);<br>&nbsp;delete b1;</p>
<p>&nbsp;SDMdatatype* b2=readArrayFromFile(<br>&nbsp;&nbsp;&quot;C:\\thesisIntermediate\\prinComp.dat&quot;,<br>&nbsp;N*m*sm);<br>&nbsp;prinComp.copy_in(b2);<br>&nbsp;delete b2;&nbsp;</p>
<p>&nbsp;SDMdatatype* b3=readArrayFromFile(<br>&nbsp;&nbsp;&quot;C:\\thesisIntermediate\\prinVal.dat&quot;,<br>&nbsp;sm);<br>&nbsp;prinVal.copy_in(b3);<br>&nbsp;delete b3;</p>
<p>}</p>
<p>mat ColVecElemWiseMult(mat A,SDMdatatype* B){<br>&nbsp;for(short i=0;i&lt;A.size();i++) A(i,0)=B[i]*A(i,0);<br>&nbsp;return A;<br>}<br>int main(int argc,char* argv[])<br>{<br>&nbsp;double elapsedTime;<br>&nbsp;clock_t begin, end; <br>&nbsp;begin = clock();
<br>&nbsp;loadPCAResults();<br>&nbsp;end = clock();<br>&nbsp;begin = clock();</p>
<p>&nbsp;//mat A(3,3);<br>&nbsp;//meanShape.set_identity();<br>&nbsp;//A*=(A*2);<br>&nbsp;//A*=(A*2);<br>&nbsp;//meanShape=meanShape.e*meanShape;<br>&nbsp;//std::cout&lt;&lt;meanShape&lt;&lt;std::endl;<br>&nbsp;//meanShape+prinComp*(prinVal*)</p>
<p>&nbsp;// Get vols from SDM<br>&nbsp;//extract(højde,bredde,top,left)<br>&nbsp;mat m1=meanShape.extract(N,1, 0*N,0);<br>&nbsp;mat m2=meanShape.extract(N,1, 1*N,0);<br>&nbsp;mat m3=meanShape.extract(N,1, 2*N,0);<br>&nbsp;mat m4=meanShape.extract(N,1, 3*N,0);
<br>&nbsp;mat m5=meanShape.extract(N,1, 4*N,0);<br>&nbsp;mat m6=meanShape.extract(N,1, 5*N,0);<br>&nbsp;mat m7=meanShape.extract(N,1, 6*N,0);<br>&nbsp;mat m8=meanShape.extract(N,1, 7*N,0);<br>&nbsp;mat m9=meanShape.extract(N,1, 8*N,0);<br>&nbsp;mat m10=
meanShape.extract(N,1, 9*N,0);<br>&nbsp;mat m11=meanShape.extract(N,1, 10*N,0);<br>&nbsp;mat m12=meanShape.extract(N,1, 11*N,0);<br>&nbsp;//////////////////////////////////////////////////////////////////////////////////<br>&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create objects for use&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//
<br>&nbsp;//////////////////////////////////////////////////////////////////////////////////</p>
<p>&nbsp;//structure actors<br>&nbsp;vtkActor *Temporopolar_region_left_actor&nbsp;&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Temporopolar_region_right_actor&nbsp;&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Entorhinal_region_left_actor&nbsp;&nbsp;&nbsp;= vtkActor::New();<br>
&nbsp;vtkActor *Entorhinal_region_right_actor&nbsp;&nbsp;&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Perirhinal_region_left_actor&nbsp;&nbsp;&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Perirhinal_region_right_actor&nbsp;&nbsp;&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Parahippocampal_region_left_actor&nbsp;&nbsp;= vtkActor::New();
<br>&nbsp;vtkActor *Parahippocampal_region_right_actor&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Hippocampal_region_left_actor&nbsp;&nbsp;&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Hippocampal_region_right_actor&nbsp;&nbsp;= vtkActor::New();<br>&nbsp;vtkActor *Amygdalar_region_left_actor&nbsp;&nbsp;&nbsp;= vtkActor::New();
<br>&nbsp;vtkActor *Amygdalar_region_right_actor&nbsp;&nbsp;&nbsp;= vtkActor::New();</p>
<p>&nbsp;//Bounding box<br>&nbsp;vtkOutlineFilter *outlineData = vtkOutlineFilter::New();<br>&nbsp;vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();<br>&nbsp;vtkActor *outline = vtkActor::New();</p>
<p>&nbsp;//rendering objects<br>&nbsp;vtkRenderer *aRenderer = vtkRenderer::New();<br>&nbsp;vtkRenderWindow *renWin = vtkRenderWindow::New();<br>&nbsp;vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>&nbsp;vtkCamera *aCamera = vtkCamera::New();
</p>
<p>&nbsp;</p>
<p>&nbsp;ImportFilterType::Pointer importFilter1=dataPointer2itk(m1.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter2=dataPointer2itk(m2.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter3=dataPointer2itk(m3.data_block
());<br>&nbsp;ImportFilterType::Pointer importFilter4=dataPointer2itk(m4.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter5=dataPointer2itk(m5.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter6=dataPointer2itk(
m6.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter7=dataPointer2itk(m7.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter8=dataPointer2itk(m8.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter9=dataPointer2itk(
m9.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter10=dataPointer2itk(m10.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter11=dataPointer2itk(m11.data_block());<br>&nbsp;ImportFilterType::Pointer importFilter12=dataPointer2itk(
m12.data_block());<br>&nbsp;<br>&nbsp;vtkImageImport* vtkImporter1 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter2 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter3 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter4 = vtkImageImport::New();
<br>&nbsp;vtkImageImport* vtkImporter5 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter6 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter7 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter8 = vtkImageImport::New();
<br>&nbsp;vtkImageImport* vtkImporter9 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter10 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter11 = vtkImageImport::New();<br>&nbsp;vtkImageImport* vtkImporter12 = vtkImageImport::New();
</p>
<p>&nbsp;ImageExportType::Pointer itkExporter1 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter2 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter3 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter4 = ImageExportType::New();
<br>&nbsp;ImageExportType::Pointer itkExporter5 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter6 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter7 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter8 = ImageExportType::New();
<br>&nbsp;ImageExportType::Pointer itkExporter9 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter10 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter11 = ImageExportType::New();<br>&nbsp;ImageExportType::Pointer itkExporter12 = ImageExportType::New();
</p>
<p>&nbsp;itkExporter1-&gt;SetInput(importFilter1-&gt;GetOutput());<br>&nbsp;itkExporter2-&gt;SetInput(importFilter2-&gt;GetOutput());<br>&nbsp;itkExporter3-&gt;SetInput(importFilter3-&gt;GetOutput());<br>&nbsp;itkExporter4-&gt;SetInput(importFilter4-&gt;GetOutput());
<br>&nbsp;itkExporter5-&gt;SetInput(importFilter5-&gt;GetOutput());<br>&nbsp;itkExporter6-&gt;SetInput(importFilter6-&gt;GetOutput());<br>&nbsp;itkExporter7-&gt;SetInput(importFilter7-&gt;GetOutput());<br>&nbsp;itkExporter8-&gt;SetInput(importFilter8-&gt;GetOutput());
<br>&nbsp;itkExporter9-&gt;SetInput(importFilter9-&gt;GetOutput());<br>&nbsp;itkExporter10-&gt;SetInput(importFilter10-&gt;GetOutput());<br>&nbsp;itkExporter11-&gt;SetInput(importFilter11-&gt;GetOutput());<br>&nbsp;itkExporter12-&gt;SetInput(importFilter12-&gt;GetOutput());
<br>&nbsp;<br>&nbsp;ConnectPipelines(itkExporter1, vtkImporter1);<br>&nbsp;ConnectPipelines(itkExporter2, vtkImporter2);<br>&nbsp;ConnectPipelines(itkExporter3, vtkImporter3);<br>&nbsp;ConnectPipelines(itkExporter4, vtkImporter4);<br>&nbsp;ConnectPipelines(itkExporter5, vtkImporter5);
<br>&nbsp;ConnectPipelines(itkExporter6, vtkImporter6);<br>&nbsp;ConnectPipelines(itkExporter7, vtkImporter7);<br>&nbsp;ConnectPipelines(itkExporter8, vtkImporter8);<br>&nbsp;ConnectPipelines(itkExporter9, vtkImporter9);<br>&nbsp;ConnectPipelines(itkExporter10, vtkImporter10);
<br>&nbsp;ConnectPipelines(itkExporter11, vtkImporter11);<br>&nbsp;ConnectPipelines(itkExporter12, vtkImporter12);<br>&nbsp;<br>&nbsp;vtkPolyDataMapper *polyMapper1 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper2 = vtkPolyDataMapper::New();
<br>&nbsp;vtkPolyDataMapper *polyMapper3 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper4 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper5 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper6 = vtkPolyDataMapper::New();
<br>&nbsp;vtkPolyDataMapper *polyMapper7 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper8 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper9 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper10 = vtkPolyDataMapper::New();
<br>&nbsp;vtkPolyDataMapper *polyMapper11 = vtkPolyDataMapper::New();<br>&nbsp;vtkPolyDataMapper *polyMapper12 = vtkPolyDataMapper::New();</p>
<p>&nbsp;vtkContourFilter *contours1 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours2 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours3 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours4 = vtkContourFilter::New();
<br>&nbsp;vtkContourFilter *contours5 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours6 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours7 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours8 = vtkContourFilter::New();
<br>&nbsp;vtkContourFilter *contours9 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours10 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours11 = vtkContourFilter::New();<br>&nbsp;vtkContourFilter *contours12 = vtkContourFilter::New();
</p>
<p>&nbsp;outlineData-&gt;SetInput(vtkImporter1-&gt;GetOutput());<br>&nbsp;mapOutline-&gt;SetInput(outlineData-&gt;GetOutput());<br>&nbsp;outline-&gt;SetMapper(mapOutline);<br>&nbsp;outline-&gt;GetProperty()-&gt;SetColor(0.,0.,1.);</p>
<p>&nbsp;contours1-&gt;SetInput(vtkImporter1-&gt;GetOutput());<br>&nbsp;contours2-&gt;SetInput(vtkImporter2-&gt;GetOutput());<br>&nbsp;contours3-&gt;SetInput(vtkImporter3-&gt;GetOutput());<br>&nbsp;contours4-&gt;SetInput(vtkImporter4-&gt;GetOutput());
<br>&nbsp;contours5-&gt;SetInput(vtkImporter5-&gt;GetOutput());<br>&nbsp;contours6-&gt;SetInput(vtkImporter6-&gt;GetOutput());<br>&nbsp;contours7-&gt;SetInput(vtkImporter7-&gt;GetOutput());<br>&nbsp;contours8-&gt;SetInput(vtkImporter8-&gt;GetOutput());
<br>&nbsp;contours9-&gt;SetInput(vtkImporter9-&gt;GetOutput());<br>&nbsp;contours10-&gt;SetInput(vtkImporter10-&gt;GetOutput());<br>&nbsp;contours11-&gt;SetInput(vtkImporter11-&gt;GetOutput());<br>&nbsp;contours12-&gt;SetInput(vtkImporter12-&gt;GetOutput());
</p>
<p>&nbsp;contours1-&gt;SetValue(0,0);<br>&nbsp;contours2-&gt;SetValue(0,0);<br>&nbsp;contours3-&gt;SetValue(0,0);<br>&nbsp;contours4-&gt;SetValue(0,0);<br>&nbsp;contours5-&gt;SetValue(0,0);<br>&nbsp;contours6-&gt;SetValue(0,0);<br>&nbsp;contours7-&gt;SetValue(0,0);
<br>&nbsp;contours8-&gt;SetValue(0,0);<br>&nbsp;contours9-&gt;SetValue(0,0);<br>&nbsp;contours10-&gt;SetValue(0,0);<br>&nbsp;contours11-&gt;SetValue(0,0);<br>&nbsp;contours12-&gt;SetValue(0,0);</p>
<p>&nbsp;polyMapper1-&gt;SetInput(contours1-&gt;GetOutput());<br>&nbsp;polyMapper2-&gt;SetInput(contours2-&gt;GetOutput());<br>&nbsp;polyMapper3-&gt;SetInput(contours3-&gt;GetOutput());<br>&nbsp;polyMapper4-&gt;SetInput(contours4-&gt;GetOutput());
<br>&nbsp;polyMapper5-&gt;SetInput(contours5-&gt;GetOutput());<br>&nbsp;polyMapper6-&gt;SetInput(contours6-&gt;GetOutput());<br>&nbsp;polyMapper7-&gt;SetInput(contours7-&gt;GetOutput());<br>&nbsp;polyMapper8-&gt;SetInput(contours8-&gt;GetOutput());
<br>&nbsp;polyMapper9-&gt;SetInput(contours9-&gt;GetOutput());<br>&nbsp;polyMapper10-&gt;SetInput(contours10-&gt;GetOutput());<br>&nbsp;polyMapper11-&gt;SetInput(contours11-&gt;GetOutput());<br>&nbsp;polyMapper12-&gt;SetInput(contours12-&gt;GetOutput());
</p>
<p>&nbsp;polyMapper1-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper2-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper3-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper4-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper5-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper6-&gt;ScalarVisibilityOff();
<br>&nbsp;polyMapper7-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper8-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper9-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper10-&gt;ScalarVisibilityOff();<br>&nbsp;polyMapper11-&gt;ScalarVisibilityOff();<br>
&nbsp;polyMapper12-&gt;ScalarVisibilityOff();</p>
<p>&nbsp;Temporopolar_region_left_actor-&gt;SetMapper(polyMapper1);<br>&nbsp;Temporopolar_region_right_actor-&gt;SetMapper(polyMapper2);<br>&nbsp;Entorhinal_region_left_actor-&gt;SetMapper(polyMapper3);<br>&nbsp;Entorhinal_region_right_actor-&gt;SetMapper(polyMapper4);
<br>&nbsp;Perirhinal_region_left_actor-&gt;SetMapper(polyMapper5);<br>&nbsp;Perirhinal_region_right_actor-&gt;SetMapper(polyMapper6);<br>&nbsp;Parahippocampal_region_left_actor-&gt;SetMapper(polyMapper7);<br>&nbsp;Parahippocampal_region_right_actor-&gt;SetMapper(polyMapper8);
<br>&nbsp;Hippocampal_region_left_actor-&gt;SetMapper(polyMapper9);<br>&nbsp;Hippocampal_region_right_actor-&gt;SetMapper(polyMapper10);<br>&nbsp;Amygdalar_region_left_actor-&gt;SetMapper(polyMapper11);<br>&nbsp;Amygdalar_region_right_actor-&gt;SetMapper(polyMapper12);
<br>&nbsp;<br>&nbsp;Temporopolar_region_left_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(1,0,0);<br>&nbsp;Temporopolar_region_right_actor-&gt;GetProperty()-&gt;&nbsp;SetColor(1,0,0);<br>&nbsp;Entorhinal_region_left_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(0,1,0);
<br>&nbsp;Entorhinal_region_right_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(0,1,0);<br>&nbsp;Perirhinal_region_left_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(0,0,1);<br>&nbsp;Perirhinal_region_right_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(0,0,1);
<br>&nbsp;Parahippocampal_region_left_actor-&gt;GetProperty()-&gt;&nbsp;SetColor(1,0,1);<br>&nbsp;Parahippocampal_region_right_actor-&gt;GetProperty()-&gt;&nbsp;SetColor(1,0,1);<br>&nbsp;Hippocampal_region_left_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(0,1,1);
<br>&nbsp;Hippocampal_region_right_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(0,1,1);<br>&nbsp;Amygdalar_region_left_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(1,1,0);<br>&nbsp;Amygdalar_region_right_actor-&gt;GetProperty()-&gt;&nbsp;&nbsp;SetColor(1,1,0);
<br>&nbsp;</p>
<p>&nbsp;vtkCallbackCommand *callback = vtkCallbackCommand::New();<br>&nbsp;callback-&gt;SetCallback(callbackMethod);<br>&nbsp;commandObj* cmdObj=new commandObj;<br>&nbsp;callback-&gt;SetClientData(cmdObj);<br>&nbsp;iren-&gt;AddObserver(vtkCommand::KeyPressEvent,callback);
</p>
<p><br>&nbsp;// Actors are added to the renderer. <br>&nbsp;//aRenderer-&gt;AddActor(outline);<br>&nbsp;aRenderer-&gt;AddActor(Temporopolar_region_left_actor);<br>&nbsp;aRenderer-&gt;AddActor(Temporopolar_region_right_actor);<br>&nbsp;aRenderer-&gt;AddActor(Entorhinal_region_left_actor);
<br>&nbsp;aRenderer-&gt;AddActor(Entorhinal_region_right_actor);<br>&nbsp;aRenderer-&gt;AddActor(Perirhinal_region_left_actor);<br>&nbsp;aRenderer-&gt;AddActor(Perirhinal_region_right_actor);<br>&nbsp;aRenderer-&gt;AddActor(Parahippocampal_region_left_actor);
<br>&nbsp;aRenderer-&gt;AddActor(Parahippocampal_region_right_actor);<br>&nbsp;aRenderer-&gt;AddActor(Hippocampal_region_left_actor);<br>&nbsp;aRenderer-&gt;AddActor(Hippocampal_region_right_actor);<br>&nbsp;aRenderer-&gt;AddActor(Amygdalar_region_left_actor);
<br>&nbsp;aRenderer-&gt;AddActor(Amygdalar_region_right_actor);<br>&nbsp;aRenderer-&gt;AddActor(outline);<br>&nbsp;<br>&nbsp;aRenderer-&gt;SetBackground(0,0,0);<br>&nbsp;iren-&gt;SetRenderWindow(renWin);<br>&nbsp;renWin-&gt;AddRenderer(aRenderer);<br>
&nbsp;aRenderer-&gt;SetActiveCamera(aCamera);</p>
<p>&nbsp;// Setting the color and size of the renderwindow,<br>&nbsp;// initializing the camera position<br>&nbsp;aCamera-&gt;SetViewUp(0, 0, -1);<br>&nbsp;aCamera-&gt;SetPosition(-150, -150, -150);<br>&nbsp;aCamera-&gt;SetFocalPoint(0, 0, 0);<br>
&nbsp;aCamera-&gt;ComputeViewPlaneNormal();<br>&nbsp;aRenderer-&gt;ResetCamera();<br>&nbsp;aRenderer-&gt;ResetCameraClippingRange();<br>&nbsp;aRenderer-&gt;SetBackground(0.2, 0.2, 0.2);<br>&nbsp;renWin-&gt;SetSize(800, 600);</p>
<p>&nbsp;// Here we go!<br>&nbsp;iren-&gt;Initialize();<br>&nbsp;renWin-&gt;Render();<br>&nbsp;iren-&gt;Start();</p>
<p>&nbsp;end = clock();<br>&nbsp;elapsedTime = static_cast&lt;double&gt;(end - begin) / CLOCKS_PER_SEC;std::cout&lt;&lt;elapsedTime&lt;&lt;std::endl;<br>&nbsp;//////////////////////////////////////////////////////////////////////////////////
<br>&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CLEAN UP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//<br>&nbsp;//////////////////////////////////////////////////////////////////////////////////<br>&nbsp;<br>&nbsp;aCamera-&gt;Delete();<br>&nbsp;aRenderer-&gt;Delete();<br>&nbsp;renWin-&gt;Delete();<br>&nbsp;iren-&gt;Delete();
<br>}<br></p></div>