[vtkusers] problem while executing a pipeline

thomas thomas at cs.uno.edu
Tue May 20 17:38:51 EDT 2003


I have a big problem while executing a vtk pipieline... I have done my own class and i try to execute it. The problem is that before the Write i have the correct number of points in the output but after i have no more points and no image. i don't understand why there is an error.... I have done some tests that let's me think that the error come from the fact i am using the output....

If you want more precisions don't hesitate, contact me. Below are my files


vtkImageInterpolate.h

#ifndef __VTK_IMAGE_INTERPOLATE_H
#define __VTK_IMAGE_INTERPOLATE_H

#include "vtkPointSet.h"
#include "vtkImageSource.h"

class VTK_EXPORT vtkImageInterpolate : public vtkImageSource {
 public:
  static vtkImageInterpolate *New();
  vtkTypeMacro(vtkImageInterpolate, vtkImageSource);
  void PrintSelf(ostream& os, vtkIndent indent);

  vtkSetMacro(NumberOfXPoints,int);
  vtkGetMacro(NumberOfXPoints,int);
  vtkSetMacro(NumberOfYPoints,int);
  vtkGetMacro(NumberOfYPoints,int);

  vtkSetMacro(DeltaX,int);
  vtkGetMacro(DeltaX,int);
  vtkSetMacro(DeltaY,int);
  vtkGetMacro(DeltaY,int);
  
  vtkSetMacro(OriginX,float);
  vtkGetMacro(OriginX,float);
  vtkSetMacro(OriginY,float);
  vtkGetMacro(OriginY,float);

  void SetInput(vtkPointSet *in);
  vtkPointSet *GetInput();
  void Execute();
 protected:
  vtkImageInterpolate();
  virtual ~vtkImageInterpolate();

  int NumberOfXPoints;
  int NumberOfYPoints;
  int DeltaX;
  int DeltaY;
  float OriginX;
  float OriginY;

 private:
  vtkImageInterpolate(const vtkImageInterpolate&);
  operator=(const vtkImageInterpolate &);

};

#endif

end of 

void vtkImageInterpolate::Execute() {
 this->GetOutput()->SetDimensions(this->NumberOfXPoints - 2, this->NumberOfYPoints - 2, 1);
 this->GetOutput()->SetOrigin(pt[1][1].xp, pt[1][1].yp, 0);
 this->GetOutput()->SetSpacing(this->DeltaX, this->DeltaY, 0);
 this->GetOutput()->SetScalarTypeToUnsignedChar();

 for (i = 1; i <= this->NumberOfXPoints - 2; i++) { 
  for (j = 1; j <= this->NumberOfYPoints - 2; j++) {
   unsigned char* pixel = (unsigned char*) this->GetOutput()->GetScalarPointer(i-1,j-1,0);
   *pixel = (unsigned char) pt[i][j].zp;
  }
 }

}

and here is my tcl script

package require vtklocal

proc read_xyz {data filename delim} {

vtkPoints points

set FILE [open $filename "r"]

while {![eof $FILE]} {

gets $FILE line

set toks [split $line $delim]

#puts $toks

if {[llength $toks] >= 3} {

#puts $toks

points InsertNextPoint [lindex $toks 0] [lindex $toks 1] [lindex $toks 2]

}

}

$data SetPoints points

}

puts "is anyone out there?"

vtkPolyData d

read_xyz d "C:/Documents and Settings/thomas/My Documents/thomas/tfe/points.csv" ","

puts [d GetNumberOfPoints]

d Print

vtkImageInterpolate interper

interper SetNumberOfXPoints 1000

interper SetNumberOfYPoints 1000

interper SetOriginX 3703530

interper SetOriginY 486907

interper SetDeltaX 3140

interper SetDeltaY 4259

interper SetInput d

interper Execute

[interper GetOutput] Print



vtkTIFFWriter w

w SetInput [interper GetOutput]

w SetFileName "plaq.tiff"

puts [[interper GetOutput] GetNumberOfPoints]

w Write

puts [[interper GetOutput] GetNumberOfPoints]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030520/d10bc5f8/attachment.htm>


More information about the vtkusers mailing list