18 #include "milxQtFiniteTransformPlugin.h" 26 #include <nttw/global.h> 27 #include <nttw/image.h> 39 pluginName =
"FiniteTransform";
45 milxQtFiniteTransformPlugin::~milxQtFiniteTransformPlugin()
50 cout <<
"FiniteTransform Plugin Destroyed." << endl;
60 QString openExt =
"Portable Graymap Files (*.pgm)";
85 QString savePythonExt =
"Portable Graymap Files (*.pgm)";
100 cout <<
"NTTW Library (nttw_integer) Type Size: " <<
sizeof(nttw_integer) <<
", Alignment: " << ALIGNOF(nttw_integer) <<
" bytes" << endl;
103 int binaryInFile = isBinaryPGM(filename.toStdString().c_str());
105 if(!readPGM(&image,&rows,&cols,filename.toStdString().c_str(),binaryInFile))
107 cerr <<
"Error Opening File: " << filename.toStdString() << endl;
110 cout <<
"Opened " << filename.toStdString() <<
" as FTL image" << endl;
111 cout <<
"Image of size " << rows <<
"x" << cols << endl;
114 n =
static_cast<unsigned>(rows)*static_cast<unsigned>(cols);
115 vnl_vector<nttw_integer> imgData(image, n);
116 vnl_vector<float> imgFloatData(n);
118 for(
size_t j = 0; j < imgData.size(); j ++)
119 imgFloatData[j] = static_cast<float>(imgData[j]);
121 typedef floatImageType::SizeType SizeType;
123 newSize[0] =
static_cast<unsigned>(cols);
124 newSize[1] =
static_cast<unsigned>(rows);
127 cout <<
"Converting to ITK Image" << endl;
134 img->generateImage();
141 typedef floatImageType::SizeType SizeType;
142 SizeType newSize = images.last()->GetFloatImage()->GetLargestPossibleRegion().GetSize();
143 const size_t n =
static_cast<unsigned>(newSize[1])*static_cast<unsigned>(newSize[0]);
144 vnl_vector<nttw_integer> imgData(n);
146 for(
size_t j = 0; j < imgData.size(); j ++)
147 imgData[j] = static_cast<nttw_integer>(images.last()->GetFloatImage()->GetBufferPointer()[j]);
149 int binaryFile = FALSE;
150 writePGM(imgData.data_block(),newSize[1],newSize[0],255,filename.toStdString().c_str(),binaryFile);
168 images.last()->generateImage();
170 return images.last();
bool threaded
Threaded plugin?
void setName(const QString filename)
Set the name of the data.
This class represents the MILX Qt Render Window Display object using QVTK.
bool consoleWindow
console window?
This class represents the MILX Qt Image Display object using VTK.
bool extension
Extension rather than a plugin?
This class represents the MILX Qt Model/Mesh Display object using VTK.
bool dockable
Dockable plugin?
Represents an image (i.e. an regular rectangular array with scalar values) and their common operation...
The interface for any plugins that can be made for milxQtMain.
static itk::SmartPointer< TImage > DuplicateImage(itk::SmartPointer< TImage > img)
Duplicates the image into a new image.