#define COLUMN_RELOAD_IMAGE 6
#define COLUMN_IMAGE_NAME 7
-#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN )"
+#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr)"
/*Data Tree values
0,Qt::UserRole full filename
//------------------------------------------------------------------------------
-void vvMainWindow::OpenDCStructContour()
+void vvMainWindow::AddDCStructContour(int index, QString file)
{
- if (mSlicerManagers.size() > 0) {
- QString Extensions = "Dicom Files ( *.dcm RS*)";
- Extensions += ";;All Files (*)";
- QString file = QFileDialog::getOpenFileName(this,tr("Merge Images"),mInputPathName,Extensions);
- if (file.isNull())
- return;
- int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
vvMeshReader reader;
reader.SetFilename(file.toStdString());
vvStructSelector selector;
AddContour(index,*i,selector.PropagationEnabled());
QApplication::restoreOverrideCursor();
}
+}
+
+//------------------------------------------------------------------------------
+void vvMainWindow::OpenDCStructContour()
+{
+ if (mSlicerManagers.size() > 0) {
+ QString Extensions = "Dicom Files ( *.dcm RS*)";
+ Extensions += ";;All Files (*)";
+ QString file = QFileDialog::getOpenFileName(this,tr("Merge Images"),mInputPathName,Extensions);
+ if (file.isNull())
+ return;
+ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+ AddDCStructContour(index, file);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-QString vvMainWindow::Get4x4MatrixDoubleAsString(vtkSmartPointer<vtkMatrix4x4> matrix)
+QString vvMainWindow::Get4x4MatrixDoubleAsString(vtkSmartPointer<vtkMatrix4x4> matrix, const int precision)
{
std::ostringstream strmatrix;
+ // Figure out the number of digits of the integer part of the largest absolute value
+ // for each column
+ unsigned width[4];
+ for (unsigned int j = 0; j < 4; j++){
+ double absmax = 0.;
+ for (unsigned int i = 0; i < 4; i++)
+ absmax = std::max(absmax, vnl_math_abs(matrix->GetElement(i, j)));
+ unsigned ndigits = (unsigned)std::max(0.,std::log10(absmax))+1;
+ width[j] = precision+ndigits+3;
+ }
+
+ // Output with correct width, aligned to the right
for (unsigned int i = 0; i < 4; i++) {
for (unsigned int j = 0; j < 4; j++) {
- strmatrix.flags(ios::showpos);
- strmatrix.width(10);
- strmatrix.precision(3);
strmatrix.setf(ios::fixed,ios::floatfield);
+ strmatrix.precision(precision);
strmatrix.fill(' ');
- strmatrix << std::left << matrix->GetElement(i, j);
- //strmatrix.width(10);
- strmatrix << " ";
+ strmatrix.width(width[j]);
+ strmatrix << std::right << matrix->GetElement(i, j);
}
strmatrix << std::endl;
}
} else if (dimension == 3) {
OutputListeFormat.push_back(".mhd");
OutputListeFormat.push_back(".mha");
+ OutputListeFormat.push_back(".nii");
+ OutputListeFormat.push_back(".nrrd");
+ OutputListeFormat.push_back(".nhdr");
OutputListeFormat.push_back(".hdr");
OutputListeFormat.push_back(".vox");
} else if (dimension == 4) {
OutputListeFormat.push_back(".mhd");
OutputListeFormat.push_back(".mha");
+ OutputListeFormat.push_back(".nii");
+ OutputListeFormat.push_back(".nrrd");
+ OutputListeFormat.push_back(".nhdr");
}
QString Extensions = "AllFiles(*.*)";
for (int i = 0; i < OutputListeFormat.count(); i++) {
mpg->SetInput(image);
mpg->SetFileName(fileName.toStdString().c_str());
mpg->SetQuality(2);
- mpg->SetRate(5);
+ bool ok;
+ int fps = QInputDialog::getInt(this, tr("Number of frames per second"),
+ tr("FPS:"), 5, 0, 1024, 1, &ok);
+ if(!ok)
+ fps = 5;
+ mpg->SetRate(fps);
+ mpg->SetBitRateTolerance(int(ceil(12.0*1024*1024/fps)));
mpg->Start();
vvImage * vvImg = mSlicerManagers[smIndex]->GetImage();