Back to index

salome-gui  6.5.0
Public Member Functions | Protected Member Functions | Protected Attributes
SVTK_ImageWriter Class Reference

#include <SVTK_ImageWriter.h>

Collaboration diagram for SVTK_ImageWriter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SVTK_ImageWriter (QSemaphore *theSemaphore, vtkImageData *theImageData, const std::string &theName, int theProgressive, int theQuality)
 ~SVTK_ImageWriter ()

Protected Member Functions

virtual void run ()

Protected Attributes

QSemaphore * mySemaphore
vtkImageData * myImageData
std::string myName
int myProgressive
int myQuality
bool myConstraint16Flag

Detailed Description

Definition at line 29 of file SVTK_ImageWriter.h.


Constructor & Destructor Documentation

SVTK_ImageWriter::SVTK_ImageWriter ( QSemaphore *  theSemaphore,
vtkImageData *  theImageData,
const std::string &  theName,
int  theProgressive,
int  theQuality 
)

Definition at line 38 of file SVTK_ImageWriter.cxx.

                                  :
  mySemaphore(theSemaphore),
  myImageData(theImageData),
  myName(theName),
  myProgressive(theProgressive),
  myQuality(theQuality),
  myConstraint16Flag(true)
{}

Definition at line 53 of file SVTK_ImageWriter.cxx.

{
  if(MYDEBUG) cout<<"SVTK_ImageWriter::~SVTK_ImageWriter - this = "<<this<<endl;
}

Member Function Documentation

void SVTK_ImageWriter::run ( ) [protected, virtual]

Definition at line 62 of file SVTK_ImageWriter.cxx.

{
  vtkJPEGWriter *aWriter = vtkJPEGWriter::New();
  vtkImageData *anImageData = myImageData;
  vtkSmartPointer<vtkImageClip> anImageClip;
  //
  if(myConstraint16Flag){ 
    int uExtent[6];
    myImageData->UpdateInformation();
    myImageData->GetUpdateExtent(uExtent);
    unsigned int width = uExtent[1] - uExtent[0] + 1;
    unsigned int height = uExtent[3] - uExtent[2] + 1;
    width = (width / 16) * 16;
    height= (height / 16) * 16;
    uExtent[1] = uExtent[0] + width - 1;
    uExtent[3] = uExtent[2] + height - 1;
    //
    anImageClip = vtkImageClip::New();
    anImageClip->Delete();

    anImageClip->SetInput(myImageData);
    anImageClip->SetOutputWholeExtent(uExtent);
    anImageClip->ClipDataOn();
    anImageData = anImageClip->GetOutput();
  }
  //
  aWriter->WriteToMemoryOff();
  aWriter->SetFileName(myName.c_str());
  aWriter->SetQuality(myQuality);
  aWriter->SetProgressive(myProgressive);
  aWriter->SetInput(anImageData);
  aWriter->Write();

  aWriter->Delete();
  myImageData->Delete();

  if(MYDEBUG) cout<<"SVTK_ImageWriter::run "<<
                "- this = "<<this<<
                //"; total = "<<mySemaphore->total()<<
                "; available = "<<mySemaphore->available()<<endl;
  mySemaphore->release();
}

Member Data Documentation

Definition at line 51 of file SVTK_ImageWriter.h.

vtkImageData* SVTK_ImageWriter::myImageData [protected]

Definition at line 47 of file SVTK_ImageWriter.h.

std::string SVTK_ImageWriter::myName [protected]

Definition at line 48 of file SVTK_ImageWriter.h.

Definition at line 49 of file SVTK_ImageWriter.h.

int SVTK_ImageWriter::myQuality [protected]

Definition at line 50 of file SVTK_ImageWriter.h.

QSemaphore* SVTK_ImageWriter::mySemaphore [protected]

Definition at line 46 of file SVTK_ImageWriter.h.


The documentation for this class was generated from the following files: