[vtkusers] to pipeline or not to pipeline, that is the question

Jeff Lee jeff at cdnorthamerica.com
Fri Jun 13 06:08:08 EDT 2003


did you try reader->Update() ?
-Jeff

Nico Vermaas wrote:

>Hi,
>
>There may be a bug in my understanding of VTK, can somebody enlighten me?
>
>I have build a reader (fitsReader) that gives back a vtkImageData.
>
>It works fine when I define a new vtkImageData (as a member) and (deep)copy the scalars from the reader's result to this new vtkImageData. Like this:
>
>vtkImageData *dataFits = vtkImageData::New();
>dataFits=this->fitsReader->GetOutput();
>this->myImageData->GetPointData()->DeepCopy(dataFits->GetPointData());
>dataFits->Delete();
>mapper->SetInput(this->myImageData);
>etc...
>
>It also works when I insert a vtkExtractVOI in the pipeline before the Mapper.
>
>But... when I just connect my reader's output to that same new vtkImageData then I do not get any data, like this: 
> 
>myImageData=fitsReader->GetOutput(); 
>
>Also....
>When I do use the 'deepcopy' solution (I get data in myImageData then) and when I then insert a vtkShiftScale into the pipeline (to go from floats to unsigned chars) I lose my data again. Like this:
>
>myImageData->Update(); 
>myShiftedScaledData->SetInput(myImageData);
>myShiftedScaledData->SetShift(-range[0]);
>myShiftedScaledData->SetScale(255./(range[1]-range[0]));
>myShiftedScaledData->SetOutputScalarTypeToUnsignedChar();
>
>And this gives an error then ('pixel not in memory'):
>value=(float*) myShiftedScaledData->GetOutput()->GetScalarPointer(x,y,z);
>
>Ergo:
>I have the feeling that I forget something crucial.
>q: is that deepcopy necisary or a dumb solution?
>q: should that 'myImageData=fitsReader->GetOutput()' work? (should myImageData contain the scalar data?)
>q: does anybody see anything wrong?
>
>Some insight would be much appreciated, Thanks,
>
>Nico 
> 
>
>
>
>====================================================
>Nico Vermaas
>ASTRON - Westerbork Synthesis Radio Telescope
>Schattenberg 1 - 9433 TA Zwiggelte - The Netherlands
>
>tel: +31 593 598710                 
>vermaas at astron.nl 
>====================================================
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>  
>





More information about the vtkusers mailing list