MantisBT - VTK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0001748 | VTK | (No Category) | public | 2005-04-05 18:03 | 2016-08-12 09:54 |
| Reporter | john platt | ||||
| Assigned To | John Biddiscombe | ||||
| Priority | low | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Project | |||||
| Type | |||||
| Summary | 0001748: Tensor glyphs always scaled | ||||
| Description | Tensor glyphs are always scaled irrespective of the Scaling ivar. Memory leak if there is no data to glyph. Extend the scaling options. vtkTensorGlyph.h ---------------- Replace // Description: // Turn on/off scaling of glyph with eigenvalues. vtkSetMacro(Scaling,int); By // Description: // Turn on/off scaling of the glyphs. The source glyphs can be scaled by the composite // factor (eigenvalue*ScaleFactor). The ScaleMode controls the use of the eigenvalues in // the composite factor. By default, scaling is on. vtkSetMacro(Scaling,int); Insert //BTX enum { SCALE_BY_EIGENVALUES, DATA_SCALING_OFF, }; //ETX // Description: // Include or exclude the eigenvalues in the composite scale factor. By default, the // eigenvalues are included and the glyphs will be scaled by (eigenvalue*ScaleFactor). vtkSetClampMacro(ScaleMode, int, SCALE_BY_EIGENVALUES, DATA_SCALING_OFF); vtkGetMacro(ScaleMode,int); void SetScaleModeToScaleByEigenvalues() {this->SetScaleMode(SCALE_BY_EIGENVALUES);}; void SetScaleModeToDataScalingOff() {this->SetScaleMode(DATA_SCALING_OFF);}; const char* GetScaleModeAsString(); Insert // Description: // Specify scale factors for each principal direction. The first scale factor is paired // with the most positive eigenvalue. If scale factors are not specified, the single // ScaleFactor is used for all directions. vtkSetVector3Macro(ScaleFactors,double); vtkGetVector3Macro(ScaleFactors,double); New ivars int ScaleMode; // Include the eigenvalues in the geometry scaling double ScaleFactors[3]; // Scale factors for ThreeGlyphs Insert // Description: // Return the method of scaling as a descriptive character string. inline const char* vtkTensorGlyph::GetScaleModeAsString( void ) { if ( this->ScaleMode == SCALE_BY_EIGENVALUES ) { return "ScaleByEigenvalues"; } else { return "DataScalingOff"; } } vtkTensorGlyph.cxx ------------------ vtkTensorGlyph() Add this->ScaleMode = SCALE_BY_EIGENVALUES; and after ScaleFactor has been set this->ScaleFactors[0] = ScaleFactor; this->ScaleFactors[1] = ScaleFactor; this->ScaleFactors[2] = ScaleFactor; Execute() Move the 3 lines pts = new vtkIdType[this->GetSource()->GetMaxCellSize()]; trans = vtkTransform::New(); matrix = vtkMatrix4x4::New(); to after if ( !inTensors || numPts < 1 ) { vtkErrorMacro(<<"No data to glyph!"); return; } This prevents memory leaks when there is no data to glyph. Replace // compute scale factors w[0] *= this->ScaleFactor; w[1] *= this->ScaleFactor; w[2] *= this->ScaleFactor; if ( this->ClampScaling ) by // compute scale factors if ( SCALE_BY_EIGENVALUES == this->ScaleMode ) { // Include the eigenvalues (or vector norms) in the scale factor. w[0] *= this->ScaleFactors[0]; w[1] *= this->ScaleFactors[1]; w[2] *= this->ScaleFactors[2]; } else { // Exclude tensor data from the scale factor. w[0] = this->ScaleFactors[0]; w[1] = this->ScaleFactors[1]; w[2] = this->ScaleFactors[2]; } if ( this->ClampScaling && (DATA_SCALING_OFF != this->ScaleMode) ) Replace if (this->ThreeGlyphs) { trans->Scale(w[eigen_dir], this->ScaleFactor, this->ScaleFactor); } else { trans->Scale(w[0], w[1], w[2]); } by // Apply the scaling. if ( this->Scaling ) { if (this->ThreeGlyphs) { trans->Scale(w[eigen_dir], this->ScaleFactor, this->ScaleFactor); } else { trans->Scale(w[0], w[1], w[2]); } } PrintSelf(ostream& os, vtkIndent indent) Insert os << indent << "Scale Mode: " << this->ScaleMode << endl; os << indent << "ScaleFactors: (" << this->ScaleFactors[0] << ", " << this->ScaleFactors[1] << ", " << this->ScaleFactors[2] << ")\n"; Thanks. | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2011-06-16 13:11 | Zack Galbreath | Category | => (No Category) | ||
| 2016-08-12 09:54 | Kitware Robot | Note Added: 0036780 | |||
| 2016-08-12 09:54 | Kitware Robot | Status | expired => closed | ||
| 2016-08-12 09:54 | Kitware Robot | Resolution | open => moved | ||
| Notes | |||||
|
|
|||||
|
|
||||