How can read PNG JPG image.
hi, i want to read some PNG image in my scene.
in VTK, we can just use VTKPNGReader
to read PNG image perfectly. but how can i read these iamges in iMSTK.
- i try to read PNG image in VTK ways, but it sames i can not convert
vtkimagedata
to imskt'simageData
here's my code
`vtkSmartPointer PNGreader = vtkSmartPointer::New();
PNGreader->SetFileName("xxx.png");
std::shared_ptr imageData(std::move(GeometryUtils::copyToImageData(PNGreader->GetOutput())));`
- then i noticed that renderMaterial got a api
addtexture
which can read PNG image.
i create a plan geometry. then i try to add a PNG image as texture, but nothing happend. here's my code
`auto planGeom = std::make_shared();
planGeom->setWidth(750);
imstkNew texture("xxx.png", Texture::Type::Roughness);
imstkNew Mat;
Mat->addTexture(texture);
imstkNew vm(planGeom, Mat);
imstkNew visualeObj("visual");
visualObj->addVisualModel(vm);`
thanks for any advice. hope you have a good day.