Witam,
Mam pytanie odnośnie odczytu wartości transformacji(TransformParameters) z takiego pliku txt:
(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")
Musze odczytać wartości transformacji czyli transformparameters oraz CenterOfRotationPoint, a następnie wpisać ich wartości do zmiennych
(np. double x1, x2,x3...),aby potem wykonać na nich dalsze obliczenia.
Nie wiem jak mogę odczytać tylko te wartości z pliku, a nie cały albo linie ;/
Bardzo proszę o pomoc jakąkolwiek dobrą radę czy przykład.
Będę bardzo wdzięczna za każdą pomoc
Tutaj już zaczęłam tworzyć w c++/qt i utknęłam w jednym miejscu:
//------------------------------------------------------------------------------
void ToolR::LoadFile()
{
//Open File to read the transformation parameters
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();
// Here !
}
}
}
Bardzo proszę o pomoc :)