drmichaeldouglass / MedBlend

A Medical Visualisation Add-On for Blender
MIT License
66 stars 4 forks source link

Sequence support #5

Open thomasediolausson opened 1 year ago

thomasediolausson commented 1 year ago

Hi,

Thank you for the open release!

Is there support for sequence data? 4D?

drmichaeldouglass commented 1 year ago

Not yet but I have plans to support it

drmichaeldouglass commented 1 year ago

As a work around, you can import the different phases of the 4DCT in separately, one at a time. Every time you load a CT, MedBlend creates a CT.vdb file in the same directory as the CT data. Rename the CT.vdb file to something else before loading in a new CT, Phase0.vdb, phase10.vdb etc. Once you have a VDB file for each of the phases, Blender can import a VDB sequence directly. Then you will have an animated 4DCT in Blender

thomasediolausson commented 1 year ago

Ah yes, this makes sense. However I am dealing with 200 time frames.

My own implementation using pyopenvdb did not work directly, so I was hoping maybe to use whatever tricks you are doing.

drmichaeldouglass commented 1 year ago

UNOFFICIAL

Hi,

From the blender 3D workspace, if you select Add-->Volume-->Import OpenVDB

Select all the VDB files you want to import as a sequence.

Once loaded, click on the dose object so that it is selected. Click the Object Data Properties tab on the right side (green cloud icon). In the OpenVDB File section, make sure sequence is enabled and type in the number of frames that are in the 4DCT. Change mode to Ping-Pong.

Hope that helps.

Cheers,

Michael

From: Thomas Olausson @.> Sent: Thursday, 1 June 2023 5:27 PM To: drmichaeldouglass/MedBlend @.> Cc: Michael John James Douglass @.>; Comment @.> Subject: Re: [drmichaeldouglass/MedBlend] Sequence support (Issue #5)

I have this dummy example inspired by your tutorial.

import h5py

import numpy as np

import pyopenvdb as openvdb

for i in range(0,15):

print(i)

grid = openvdb.FloatGrid()

Volume = np.zeros([30,30,30])

Volume[20:30,:,2] = 0.5

Volume[:,20,10:15] = 0.5

Volume[5:10,i:i+5,5:10] = i

grid.copyFromArray(Volume.astype(float))

grid.transform = openvdb.createLinearTransform([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])

grid.gridClass = openvdb.GridClass.FOG_VOLUME

grid.name = 'density'

openvdb.write('C:/Users/thoma/test/{0:02}_volume.vdb'.format(i),grid)

Viewing the individual vdb files shows that each frame is different. However, once loading all vdb files and scrolling through the timeline in Blender does not show the animation.

- Reply to this email directly, view it on GitHubhttps://github.com/drmichaeldouglass/MedBlend/issues/5#issuecomment-1571546346, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMSIJMYOKZZXW3P36BEYQDDXJBDN3ANCNFSM6AAAAAAXMRXMOE. You are receiving this because you commented.Message ID: @.***>