Dear Andrea,

great that setting the geometry works now. If you transform the US image there might be a problem using the standard views. You can try to do a reinit on the image or a global reinit, but continous movement might still be a problem. In other projects, we fix the image coordinates to world coordinates and transform other data (e.g., instrument tracking data). If the image should move around, you can move the camera / view instead.


If you want to move your continous US image stream in world coordinates, a better way than the standard views might be a texture on a 3D object. But unfortunately I have no example for this in MITK, so you need to implement it if required.


Hope this still helps,


Alfred




Am 28.07.2022 um 18:08 schrieb Andrea Roberti:
Dear Alfred,
thanks, and sorry for the late reply.
Using the code, you shared we were able to fix our problem!

Now the next step is to attach in the 3D visualization the US image to a probe STL.  (as suggested in the image ��)

Which is the best solution?

to apply the rotation on the image along the z-axis, we use this code
[......]
mitk::Vector3DrotationVector;
rotationVector[0]=0.0;
rotationVector[1]=0.0;
rotationVector[2]=1.0;
floatdegree=eulerGammaDegrees;
mitk::RotationOperation*op=
newmitk::RotationOperation(mitk::OpROTATE,geometry->GetCenter(),rotationVector,degree);
geometry->ExecuteOperation(op);
deleteop;
[...]
but we have problem with the crosshair. The image goes out of visualization .
Thanks in advance,
Andrea

------------------------------------------------------------------------
*From:* Alfred Franz <a.fr...@dkfz-heidelberg.de>
*Sent:* Wednesday, July 6, 2022 3:36 PM
*To:* Andrea Roberti <andrea.robe...@univr.it>; Alfred Franz <a.fr...@dkfz-heidelberg.de>; mitk-users@lists.sourceforge.net <mitk-users@lists.sourceforge.net>
*Cc:* Chiara Tenga <chiarate...@gmail.com>
*Subject:* Re: [mitk-users] Apply a transform to US Image

Dear Andrea,


this sounds as if there is a problem when setting the geometry to the image3d (or with updating the object/view afterwards). Maybe you can compare your code to the class mitk::USCombinedModality (https://phabricator.mitk.org/source/mitk/browse/develop/Modules/US/USNavigation/mitkUSCombinedModality.cpp <https://phabricator.mitk.org/source/mitk/browse/develop/Modules/US/USNavigation/mitkUSCombinedModality.cpp>). In line 75 of this file the geometry of an US image is modified as well. A difference here is that the method "SetIndexToWorldTransform" is used instead of "SetIndexToWorldTransformByVtkMatrix". You can try to convert your matrix to a mitk::AffineTransform3D before and then call the same method as in the example. Beside that I would also check if the object/view is updated after modification of the geometry.


Best,


Alfred



Am 06.07.2022 um 12:45 schrieb Andrea Roberti:
Dear Alfred,
thanks for your reply.
We tried also with a "custom" transform created ad-hoc

[...]
vtkTransform*transform=vtkTransform::New();
transform->SetInput(transfActual);
transform->RotateZ(-90);
transform->Translate(55,0,0);
TelemedTransf->GetData()->GetGeometry()->SetIndexToWorldTransformByVtkMatrix(transform->GetMatrix());
m_DataStorage->Add(TelemedTransform);
[...]
image3d->GetGeometry()->SetIndexToWorldTransformByVtkMatrix(TelemedTransform->GetVtkTransform()->GetMatrix());
std::cout<<"1-----TelemedTransform---------"<<std::endl;
for(inti=0;i<4;i++){
for(intj=0;j<4;j++){
std::cout<<TelemedTransform->GetVtkTransform()->GetMatrix()->GetElement(i,j)<<"";
}
std::cout<<std::endl;
}
std::cout<<"3-----image3d---------"<<std::endl;
for(inti=0;i<4;i++){
for(intj=0;j<4;j++){
std::cout<<
image3d->GetGeometry()->GetVtkTransform()->GetMatrix()->GetElement(i,j)<<"";
}
std::cout<<std::endl;
}

----------------------------------------------------------------------------
The prints are exactly the same .
But as we said in the first email if the image comes from the device the transform is not applied but loaded with the API it works.

Thanks
Andrea

------------------------------------------------------------------------
*From:* Alfred Franz <a.fr...@dkfz-heidelberg.de> <mailto:a.fr...@dkfz-heidelberg.de>
*Sent:* Wednesday, July 6, 2022 7:56 AM
*To:* Andrea Roberti <andrea.robe...@univr.it> <mailto:andrea.robe...@univr.it>; mitk-users@lists.sourceforge.net <mailto:mitk-users@lists.sourceforge.net> <mitk-users@lists.sourceforge.net> <mailto:mitk-users@lists.sourceforge.net>
*Cc:* Chiara Tenga <chiarate...@gmail.com> <mailto:chiarate...@gmail.com>
*Subject:* Re: [mitk-users] Apply a transform to US Image

Dear Andrea,


did you check if the transform was correctly written to "TelemedTransform"? I don't know the code you are using to communicate with the device, but I would check this first.


If you are using the MITK classes for the Telemed device (Modules\US\USHardwareTelemed), there is a known issue that the image is not updated properly (see https://phabricator.mitk.org/T29131 <https://phabricator.mitk.org/T29131>).


Best,


Alfred



Am 05.07.2022 um 10:14 schrieb Andrea Roberti:
Hello everyone,

We would like to apply a transform to an image received in real time from an Ultrasound machine that is a 2D Image.

We can apply the same transform to a .nrrd image (saved offline) and we can see that the transform was applied correctly on the image.

This is the piece of code we are using:

                 [.........]

mitk::Convert2Dto3DImageFilter::PointermultiFilter2=mitk::Convert2Dto3DImageFilter::New();
mitk::Image::Pointerimage2d=dynamic_cast<mitk::Image*>(m_Node.at(i)->GetData());
multiFilter2->SetInput(image2d);
multiFilter2->Update();
mitk::Image::Pointerimage3d;
image3d=multiFilter2->GetOutput();
TelemedTransform->GetVtkTransform()->Update();
image3d->GetGeometry()->SetIndexToWorldTransformByVtkMatrix(TelemedTransform->GetVtkTransform()->GetMatrix());

                 [.........]


If the input is given from the US machine the variable "image2d" is like the 
code we shared and the transform is not applied.
Otherwise we use the Load method from mitk::IOUtil and it works.

What could be the problem?

Thanks in advance,
Andrea


_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net  <mailto:mitk-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/mitk-users  
<https://lists.sourceforge.net/lists/listinfo/mitk-users>

--
Prof. Dr. Alfred Franz

Computer Assisted Medical Interventions / E130

German Cancer Research Center (DKFZ)
Im Neuenheimer Feld 280
69120 Heidelberg, Germany
a.fr...@dkfz.de
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to