Odczyt z pliku txt i zapis do wartości do zmiennych

0

Hej,

Jestem begginer z c++/qt.
Mam pytanie odnośnie takiego pliku txt :
Musze odczytać wartości transformacji czyli transformparameters oraz CenterOfRotationPoint, a następnie pisać do zmiennych
np. double x1, x2,x3...

(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")

 //------------------------------------------------------------------------------
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();



		}

	}
}
		

Jak mogę odczytać, przeparsować ten plik ?
Bardzo proszę o jaką advice, example.

Będę bardzo wdzięczna za każdą pomoc.

2

Jestem begginer z c++/qt.

Bardzo proszę o jaką advice, example.

Naucz się read, bo napisałaś temat w złej section. Robię move Twojego topic.

1 użytkowników online, w tym zalogowanych: 0, gości: 1