-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XYZ clipping #133
base: master
Are you sure you want to change the base?
XYZ clipping #133
Conversation
added csc.rsp to get compression and color working... idk why
Added shader that will allow clipping from specific dimensions
Added functionality to skip voxels if they lay outside the min/max clip dims
updated volumerenderedobject to account for clipping dimensions
added inspector to change the clipping dimensions min/max
final step, changed shader to account for clip shader
Removed shader.find for clip shader, since it's merged with DirectVolumeRenderingShader now
Changed shader back to DirectVolumeRenderingShader
Not sure, but thought this could be a useful addition. |
Thanks! I'll have a look at it as soon as I'm done with this round of flu/cold/covid 😅 (Hopefully over the weekend) |
Oh no! Get better soon! What happened with the build fail? |
Thank you! :) I'm better now, so I will take a look at this PR in the evening! And I think I just need to update the license for automatic builds (it failed to activate). |
Awesome, no worries. I'm also thinking of coding in something to stream real-time MRI, plus having the ability to play dataset "videos". Do you think that would be a useful addition? |
@smallvalthoss That sounds really cool! And regarding your Pull Request: I did however realise that it effectively does the same as the already implemented "box cutout" cross section tool, so I think I'd prefer to not modify the main shader and instead:
I also noticed that you had changed spaces to tabs in the shader (that easily happens 😅 ) Are you using Visual Studio btw? Maybe I can add an .editorconfig file so that VS will use spaces automatically :) Is it easier that I make these changes, or do you prefer to do them yourself? |
Ohhhh I honestly hadn't known about the box cutout. This is great to know. I didn't want to change your stuff too much, just am a little new and thought that was the only way, haha. The intended use for what I wanted wasn't specifically in the editor. I wanted to add something so that in VR, I could cut away the dataset in a given axis aligned plane. So, I think what you mentioned would work, just slightly modified? I can definitely do what you mentioned for the editor however. It's great to learn best practices for OOP :). As for the real-time dataset streaming. It is for a separate project. I am not extremely sure about the details just yet. It would likely be a byte array that likely gets passed to, as you say, a dynamic texture. We have a similar feature in a custom shader/loader script that only works with mhd files and raw files to import (might be a nice feature to have to import .mhd files to automatically get the dimensions/spacing). This loader has a byte array and creates a texture every x seconds and passes to the shader. Quite inefficient, but I haven't had much time to work on it. The project that this is for is going to get real-time data from an MRI sensor to get it into unity. |
Ah, right! It's probably best to make this as re-usable as possible then. So this is my suggestion: Create new class: public class AxisAlignedCutout : CrossSectionObject
{
// Functions for setting the min and max clipping values for each axis.
// These functions
public void SetAxisClipMin(Vector3 min);
public void SetAxisClipMax(Vector3 max);
// Functions from CrossSectionObject interface
public CrossSectionType GetCrossSectionType(); // return CrossSectionType.BoxExclusive;
public Matrix4x4 GetMatrix(); // Calculate matrix of box based on min/max clipping values (centre = (min+max)/2, scale = max-min)
} Create new editor window for using 3 sliders to set clipping: public class AxisClippingEditorWindow : EditorWindow
{
private void OnEnable()
{
// Create AxisAlignedCutout object and add to CrossSectionManager
}
private void OnDisable()
{
// Remove AxisAlignedCutout from CrossSectionManager
}
} I suppose Matrix4x4.TRS can be used to calculate the matrix. And then in your VR project, you can just do something similar as we do in the new Ok, that sounds interesting! Please let me know if you get somewhere with that project :) |
CLOSES #132
Added functionality to be able to clip dimensionally into the body to only show, say, 60% of the x dimension while still showing the rest of the body