<div dir="ltr">Hello!<br><br>I'm trying to create a 3D plot with a structured, rectangular grid of isolated points. It should look like the attached image (URL <a href="http://docs.luxology.com/modo/701/help/images/layout/ArraySample.png">http://docs.luxology.com/modo/701/help/images/layout/ArraySample.png</a>), except that instead of plotting every point as yellow, each point should have a different color based on a scalar that they hold.<br><br>I've managed to plot the data with the correct color so far. The remaining problem is that only the very outer layer of points, all around the cube, gets rendered! None of the interior points get rendered at all, even though the dataArray that holds the scalars has 1000 points, and all the dimensions are set properly.<br><br>See below for my code:<br><br>//Create a vtkImageData<br>
vtkSmartPointer<vtkImageData> imageData = vtkSmartPointer<vtkImageData>::New();<br><br>//Configures the vtkImageData <br>imageData->SetOrigin(0, 0, 0);<br>imageData->SetSpacing(1, 1, 1);<br>imageData->SetDimensions(10, 10, 10);<br>imageData->SetExtent(0, 9, 0, 9, 0, 9);<br>imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 1);<br><br>//Creates the vtkDataArray that imageData will hold<br>vtkSmartPointer<vtkTypeUInt8Array> dataArray = vtkTypeUInt8Array::New();<br><br>//Copy data from a vector into the data array<br>//vec is a 1D uint8_t vector holding the entire data<br>dataArray->SetVoidArray(&(vec[0]), vec.size(), 1);<br><br>//Adds the dataArray into the imageData<br>imageData->GetPointData()->AddArray(dataArray);<br><br>//Creates a vtkDataSetMapper<br>vtkSmartPointer<vtkDataSetMapper> imageDataMapper = vtkSmartPointer<vtkDataSetMapper>::New();<br><br>//Configures the vtkDataSetMapper, adding imageData and making the mapper plot the scalars of every point<br>imageDataMapper->SetInputDataObject(imageData);<br>imageDataMapper->ScalarVisibilityOn();<br><br>//Creates a vtkActor<br>vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();<br><br>//Configures the actor<br>actor->GetProperty()->SetInterpolation(0);<br>actor->GetProperty()->SetPointSize(5);<br>actor->GetProperty()->SetOpacity(0.5);<br>actor->GetProperty()->SetRepresentationToPoints();<br>actor->SetMapper(imageDataMapper);<br><br>//Renders the image<br>renderer->ResetCamera();<br>renderer->Render();<br><br>I really appreciate any help!<br><br>Thanks, <br><br>Daniel<br><br></div>