-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "SVTK_ImageWriter.h"
+#include "utilities.h"
+
#include <QSemaphore>
+#include <vtkAlgorithm.h>
#include <vtkImageData.h>
#include <vtkImageClip.h>
#include <vtkJPEGWriter.h>
#include <vtkSmartPointer.h>
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
//----------------------------------------------------------------------------
SVTK_ImageWriter
::SVTK_ImageWriter(QSemaphore* theSemaphore,
+ vtkAlgorithm* theAlgorithm,
vtkImageData* theImageData,
const std::string& theName,
int theProgressive,
int theQuality):
mySemaphore(theSemaphore),
+ myAlgorithm(theAlgorithm),
myImageData(theImageData),
myName(theName),
myProgressive(theProgressive),
SVTK_ImageWriter
::~SVTK_ImageWriter()
{
- if(MYDEBUG) cout<<"SVTK_ImageWriter::~SVTK_ImageWriter - this = "<<this<<endl;
+ if(SALOME::VerbosityActivated())
+ cout << "SVTK_ImageWriter::~SVTK_ImageWriter - this = " << this << endl;
}
::run()
{
vtkJPEGWriter *aWriter = vtkJPEGWriter::New();
- vtkImageData *anImageData = myImageData;
+ vtkAlgorithmOutput *anImageData = 0;
vtkSmartPointer<vtkImageClip> anImageClip;
//
if(myConstraint16Flag){
int uExtent[6];
- myImageData->UpdateInformation();
- myImageData->GetUpdateExtent(uExtent);
+ myAlgorithm->UpdateInformation();
+ myAlgorithm->GetUpdateExtent(uExtent);
unsigned int width = uExtent[1] - uExtent[0] + 1;
unsigned int height = uExtent[3] - uExtent[2] + 1;
width = (width / 16) * 16;
anImageClip = vtkImageClip::New();
anImageClip->Delete();
- anImageClip->SetInput(myImageData);
+ anImageClip->SetInputData(myImageData);
anImageClip->SetOutputWholeExtent(uExtent);
anImageClip->ClipDataOn();
- anImageData = anImageClip->GetOutput();
+ anImageData = anImageClip->GetOutputPort();
}
//
aWriter->WriteToMemoryOff();
aWriter->SetFileName(myName.c_str());
aWriter->SetQuality(myQuality);
aWriter->SetProgressive(myProgressive);
- aWriter->SetInput(anImageData);
+ if(myConstraint16Flag)
+ aWriter->SetInputConnection(anImageData);
+ else
+ aWriter->SetInputData(myImageData);
aWriter->Write();
aWriter->Delete();
myImageData->Delete();
- if(MYDEBUG) cout<<"SVTK_ImageWriter::run "<<
- "- this = "<<this<<
- //"; total = "<<mySemaphore->total()<<
- "; available = "<<mySemaphore->available()<<endl;
+ if(SALOME::VerbosityActivated())
+ cout << "SVTK_ImageWriter::run - this = " << this <<
+ //"; total = "<<mySemaphore->total()<<
+ "; available = " << mySemaphore->available() << endl;
+
mySemaphore->release();
}