Hello,
I am begginer in c++/qt.
I have a small question about read file in c++/qt.
I have to read values of transformation parameters transformparameters and CenterOfRotationPoint and after than pass to variable
ex: double x1, x2,x3...
Example of txt file :
(Transform "EulerTransform")
(NumberOfParameters 6)
(
TransformParameters 0.010616 0.024962 -0.006457 -9.413307 10.784872 12.639569)
(InitialTransformParametersFileName "NoInitialTransform")
(HowToCombineTransforms "Compose")
// Image specific
(FixedImageDimension 3)
(MovingImageDimension 3)
(FixedInternalImagePixelType "float")
(MovingInternalImagePixelType "float")
(Size 84 99 98)
(Index 0 0 0)
(Spacing 2.0000000000 2.0000000000 2.0000000000)
(Origin -80.0000000000 -33.0000000000 -112.0000000000)
(Direction 1.0000000000 0.0000000000 0.0000000000 0.0000000000 1.0000000000 0.0000000000 0.0000000000 0.0000000000 1.0000000000)
(UseDirectionCosines "false")
// EulerTransform specific
(
CenterOfRotationPoint 3.0000000000 65.0000000000 -15.0000000000)
(ComputeZYX "false")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
//------------------------------------------------------------------------------
void ToolR::LoadFile()
{
//Open File to read the transformation parameters from elastix
QString fileName = QFileDialog::getOpenFileName(
this,
"Choose elastix transfrom parameters file",
vtksys::SystemTools::GetFilenamePath(mManager->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;
}
QTextStream in(&file);
in.seek(2);
while(!in.atEnd())
{
QString mText = in.readLine();
}
}
}
|
What I can read these values from this txt file and past into variable ?
I would appreciate for any help please.
agatte