//------------------------------------------------------------------------------
void vTool::LoadFile()
{
//Open File to read the transformation parameters
this,
"Choose elastix transfrom parameters file",
vtksys::SystemTools::GetFilenamePath(mCurrentSlicerManager->GetFileName()).c_str(),
"TransformParameters.0.txt");
if(fileName != "") {
QMessageBox::critical(this, tr
("Error"), tr
("Could not open file"));
return;
}
// Center of point
QString Xt_txt, Yt_txt, Zt_txt, Xr_txt, Yr_txt, Zr_txt;
double Xtrans = 0, Ytrans = 0, Ztrans = 0;
double Xrot = 0, Yrot = 0, Zrot = 0;
while(!in.atEnd())
{
if(mText.startsWith("(TransformParameters"))
{
// in <<'/0'<< Xr_txt <<'/0' << Yr_txt<< '/0' << Zr_txt << '/0'<< Xt_txt << '/0' << Yt_txt <<'/0'<< Zt_txt;
mText.split(" ");
Xrot = Xr_txt.toDouble();
Yrot = Yr_txt.toDouble();
Zrot = Zr_txt.toDouble();
xrot_sb->setValue(Xrot);
yrot_sb->setValue(Yrot);
zrot_sb->setValue(Zrot);
Xtrans = Xt_txt.toDouble();
Ytrans = Yt_txt.toDouble();
Ztrans = Zt_txt.toDouble();
xtrans_sb->setValue(Xtrans);
ytrans_sb->setValue(Ytrans);
ztrans_sb->setValue(Ztrans);
}
if(mText.startsWith("(CenterOfRotationPoint"))
{
in << Xcen << Ycen << Zcen;
Xval->setText(Xcen);
Yval->setText(Ycen);
Zval->setText(Zcen);
}
}
}
}
//------------------------------------------------------------------------------
void vTool::LoadFile()
{
//Open File to read the transformation parameters
QString fileName = QFileDialog::getOpenFileName(
this,
"Choose elastix transfrom parameters file",
vtksys::SystemTools::GetFilenamePath(mCurrentSlicerManager->GetFileName()).c_str(),
"TransformParameters.0.txt");
if(fileName != "") {
QFile file(fileName);
if(!file.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, tr("Error"), tr("Could not open file"));
return;
}
// Center of point
QString Xcen, Ycen, Zcen;
QString Xt_txt, Yt_txt, Zt_txt, Xr_txt, Yr_txt, Zr_txt;
double Xtrans = 0, Ytrans = 0, Ztrans = 0;
double Xrot = 0, Yrot = 0, Zrot = 0;
QTextStream in(&file);
while(!in.atEnd())
{
QString mText = in.readLine();
if(mText.startsWith("(TransformParameters"))
{
// in <<'/0'<< Xr_txt <<'/0' << Yr_txt<< '/0' << Zr_txt << '/0'<< Xt_txt << '/0' << Yt_txt <<'/0'<< Zt_txt;
mText.split(" ");
Xrot = Xr_txt.toDouble();
Yrot = Yr_txt.toDouble();
Zrot = Zr_txt.toDouble();
xrot_sb->setValue(Xrot);
yrot_sb->setValue(Yrot);
zrot_sb->setValue(Zrot);
Xtrans = Xt_txt.toDouble();
Ytrans = Yt_txt.toDouble();
Ztrans = Zt_txt.toDouble();
xtrans_sb->setValue(Xtrans);
ytrans_sb->setValue(Ytrans);
ztrans_sb->setValue(Ztrans);
}
if(mText.startsWith("(CenterOfRotationPoint"))
{
in << Xcen << Ycen << Zcen;
Xval->setText(Xcen);
Yval->setText(Ycen);
Zval->setText(Zcen);
}
}
}
}
To copy to clipboard, switch view to plain text mode
Could You help me please ?
Bookmarks