How do I know when volshow is done rendering?

15 ビュー (過去 30 日間)
Adam
Adam 2025 年 12 月 7 日 19:53
コメント済み: Matt J 2025 年 12 月 7 日 22:33
I have a folder with hundreds of files containing 3D data. I want to loop through the files and output images to create a movie.
However, when I load new data to the volshow object, it takes a bit of time to render the scene. Hence, when I get the figure frame to write it to a file, I sometimes don't get the fully rendered scene. I don't want to add a pause after drawnow, because the rendering and data retireval is already quite slow. Is there a way to know exactly when volshow is done rendering so I can get the frame to write to an image?
obj = volshow(get_data(file(1)));
viewer = obj.Parent;
for i=1:length(file)
obj.Data = get_data(file(i));
drawnow
frame = getframe(viewer.Parent);
imwrite(frame.cdata, fullfile(save_dir, sprintf('%05i.jpg', i)))
end
  2 件のコメント
Walter Roberson
Walter Roberson 2025 年 12 月 7 日 21:10
Unfortunately, I do not know of any way to do this.
Matt J
Matt J 2025 年 12 月 7 日 22:33
Hence, when I get the figure frame to write it to a file, I sometimes don't get the fully rendered scene
If so, I think you should report it is a bug. drawnow is supposed to block further execution until figure updating is complete. That's the whole point of drawnow.

サインインしてコメントする。

回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by