[vtkusers] Creating Curved MPR Image
Eyal Ben-Ishai
eyalbi007 at gmail.com
Thu Sep 15 04:34:06 EDT 2011
Thank you for your reply! Yes I have tried using the vtkProbeFilter, this is
the code:
//Read volume
std::string inputFilename = "volume.mhd";
vtkSmartPointer<vtkMetaImageReader> reader =
vtkSmartPointer<vtkMetaImageReader>::New();
reader->SetFileName(inputFilename.c_str());
reader->Update();
// Read points
std::string filename = argv[1];
std::ifstream fin(filename.c_str());
std::string line;
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
while(std::getline(fin, line))
{
double x,y,z;
std::stringstream linestream;
linestream << line;
linestream >> x >> y >> z;
points->InsertNextPoint(x, y, z);
}
fin.close();
// Polydata
vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
polydata->SetPoints(points);
// Probe Filter
vtkSmartPointer<vtkProbeFilter> probe =
vtkSmartPointer<vtkProbeFilter>::New();
probe->SetSource(reader->GetOutput());
probe->SetInput(polydata);
probe->Update();
Regarding this code, I have 3 questions (other than "is it correct?" of
course):
1. 'points' are the points to sample the volume at. There are 10,000
sampling points that should output a 100x100 2D image. However, I didn't use
this information anywhere which is probably incorrect since 10,000 points
can also produce 50x200 2D image. How should it be done?
2. How can I render the resulted 2D image?
3. The probing ('probe->Update()') takes quite a lot of time (~400ms),
while I need this action to be much faster since it's intended to be
interactive. How can I speed things up? Maybe using vtkStructuredGrid
will be faster?
Thank you so much,
Eyal.
On Wed, Sep 14, 2011 at 2:25 PM, peterm <madapeti at gmail.com> wrote:
> Hello
>
> Did you try using the vtkProbeFilter for sampling from the grayscale
> volume?
> You can find some examples about probing along lines and planes in the VTK
> example code.
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Creating-Curved-MPR-Image-tp4802388p4802571.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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110915/2de15fe8/attachment.htm>
More information about the vtkusers
mailing list