Skip to content
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

First Mandible Surgical Guide Created #36

Merged
merged 45 commits into from
Apr 30, 2021

Conversation

mauigna06
Copy link
Collaborator

@mauigna06 mauigna06 commented Mar 12, 2021

Andras can you check if the mandible surgical guides generation GUI has just enough buttons and parameters? I don't want something crowded or overcomplicated

…deBaseSelector to fibulaSurgicalGuideBaseSelector, makeBooleanOperationsToSurgicalGuideBase to makeBooleanOperationsToFibulaSurgicalGuideBase

Create sawBoxes parameters spinBoxes
Create buttons:
createMandibleSurgicalGuidesBridgeModel, createSawBoxesFromFirstAndLastMandiblePlanes, makeBooleanOperationsToMandibleSurgicalGuideBase
@mauigna06 mauigna06 requested review from lassoan and removed request for lassoan March 12, 2021 23:00
…nality, and some helper functions, update the GUI and make clear what buttons are working
…seModel (and change the name of all variables that had the same problem)

add makeBooleanOperationsToMandibleSurgicalGuideBaseButton and functionality.
add mandibleBridgeModelSelector, mandibleSurgicalGuideBaseSelector, mandibleFiducialListSelector to the GUI
edit bottons enabled on enter function
rename createFiducialList to createFibulaCylindersFiducialList,
define createCylindersFromFiducialListAndMandibleSurgicalGuideBase, createMandibleCylindersFiducialList functions
give content to makeBooleanOperationsToMandibleSurgicalGuideBase function
@mauigna06 mauigna06 changed the title Check if the GUI is okey First Mandible Surgical Guide Created Mar 14, 2021
@mauigna06
Copy link
Collaborator Author

mauigna06 commented Mar 14, 2021

Here is the workflow I developed to create the mandible surgical guides:

  • click "Create saw boxes from first and last mandible planes"
  • create a segment with both surgical guide bases and select it in "Select mandible surgical guide bases"
  • create a mandibleBridgeModel using "Markups to Model" module and transform it a little bit with the interactive handles so it touches the biggerSawBoxes or the surgicalGuideBases slightly
  • make boolean operations with models to create the mandible surgical guide

Result:
Screenshot8

@cmfsx Can you check out this branch and try to do a full surgical plan? Thank you

…ton, delete old corresponding buttons, correct onNodeAboutToBeRemovedEvent functions, SetSliceIntersectionVisibility(True) on created bone models, replace bone model for decimatedModels for visualization
…ePiecesAndTransformThemToMandible, time generateFibulaPlanesFibulaBonePiecesAndTransformThemToMandible function
@mauigna06
Copy link
Collaborator Author

mauigna06 commented Mar 17, 2021

Now all "Update fibula planes over fibula line; update fibula bone pieces and transform them to mandible" is done with one button. And visualization is done with decimatedMeshes.
In my computer with 4 mandible planes it takes 3 to 4 seconds to process. Here it takes approximately 6 seconds to update https://youtu.be/KYZlEP9mHvw?t=198, so I think we are okey. What do you think about this result?
I was thinking about adding other features as:

  • mirror healthy side of the mandible with DynamicModeler
  • automatic fibulaLine creation using centerLine extraction from vmtk (or some algorithm that calculates the centroid of the intersection of one plane and the fibula model distally and proximally could be more exact)
  • improve generateFibulaPlanesFibulaBonePiecesAndTransformThemToMandible time more
  • lines to measure the bone segments length and the start of the fibula till the first fibulaPlane (like in the video, maybe a new markups class would be needed for this)

What else would you like?

@mauigna06 mauigna06 marked this pull request as ready for review March 17, 2021 16:36
@mauigna06 mauigna06 marked this pull request as draft March 17, 2021 16:41
@cmfsx
Copy link
Collaborator

cmfsx commented Mar 18, 2021

@mauigna06 sorry for my inactivity in the last couple of weeks.

I played around today with the Mandible-surgical-guide feature branch today.

VSP component is now fantastic with real-time updates and there is nothing much to be improved in that.

Fibula guide component.

In this branch, i came across the same problem with mitter boxes been placed too close to the fibula.

Screenshot from 2021-03-18 11-06-52

In the mandible guide component,

without me doing any changes the last mitter box was created inside the mandible. Also, the default orientation of the mitter box was not good. How do we control the mitter box orientations?

Screenshot from 2021-03-18 11-30-13

@mauigna06
Copy link
Collaborator Author

mauigna06 commented Mar 18, 2021

@mauigna06 sorry for my inactivity in the last couple of weeks.

No problem Manjula

In this branch, i came across the same problem with mitter boxes been placed too close to the fibula.

I suspect this problem is because fibulaSegment was not surfaceWrapSolidified because the algorithm has trouble positioning boxes when the fibula model mesh has holes inside. The mandible model should also be surfaceWrapSolidified. The first segment of each segmentation is used to create the bone models inside the module, so the surfaceWrapSolidifiedSegments should be the first segment in each segmentation.

In the mandible guide component,
without me doing any changes the last mitter box was created inside the mandible. Also, the default orientation of the mitter box was not good. How do we control the mitter box orientations?

Now the boxes in the mandible are called sawBoxes (to differenciate them from miterBoxes). The position and the orientation are calculated by the algorithm but the part of titanium plate should be a little far from the first and last mandible planes because the algorithm may get confused.
We said on the last meeting that we should try to use so little user inputs as posible, so I did this algorithm to not ask the user anything however if you find the algorithm not good, in the future I can ask for some user inputs

Anyway, for this kind of problems always make an statement of what you wanted the module to do and what it did (like you did) and upload a complete example scene (without the scalar volumes). Please upload an example scene and I'll check it out

@mauigna06
Copy link
Collaborator Author

@lassoan when should I ask you to review this branch? It's almost finished I only have to solve the bugs Manjula found

@lassoan
Copy link
Collaborator

lassoan commented Mar 21, 2021

You can mark as "ready for review" anytime you are done with your changes.

@mauigna06
Copy link
Collaborator Author

mauigna06 commented Mar 22, 2021

With the centerFibulaLineButton and the makeAllMandiblePlanesRotateTogetherCheckBox in addition to all the previous GUI very exact Virtual Surgery Planning is possible. And I'm thinking on doing a frame for each fibulaSegment to make the cuts even more exact

@mauigna06
Copy link
Collaborator Author

Now there is an option to make the planning as accurate as it's possible (I don't think there is space for more improvement after this). One frame is created for each fibula bone piece.
It takes 3 times more time to execute so I recomend using it only when you finish the planning.

@mauigna06
Copy link
Collaborator Author

@cmfsx I found bugs on "Make all mandible planes rotate together" so don't use it to make the surgical planning. Thank you

@mauigna06
Copy link
Collaborator Author

@cmfsx You can use "Make all mandible planes rotate together" I think it works well. Remember that to have perfect planning you need to click on "Automatic mandibular planes positioning for maximum bones contact area" after you finished the surgical plan to get the most out of the module. May be this button will be automatically executed in next versions.

@cmfsx
Copy link
Collaborator

cmfsx commented Mar 25, 2021

Hi @mauigna06
please find the attached file.
https://mah365-my.sharepoint.com/:u:/g/personal/manjula_herath_mau_se/EQyHu0tBsh9GqydWewN-5uABOWntiKYhRKiPYu08aLXymw?e=K2iLQr

  1. Is there a special advantage in keeping the original Mandible hidden and decimated one visible rather than the other way around when bone models are created? because I thought the original will look better during the surgical planning and i believe you use the decimated one for calculations only.
  2. most of the bugs I found previously have been corrected
  3. The only problem now is the make the saw boxes (Mandible cutting guide) to orient properly (according to the wishes of the surgeon.
    a.One solution would be to make it rotate when you rotate the mandibular plane. (Disadvantage is that the fibula pieces also rotate with it when you do it. )
    b. Make the saw boxes perpendicular to the mandibular curve by default and make it possible to adjust it further using the mandible plane if the surgeon wishes.

@mauigna06
Copy link
Collaborator Author

Hi @mauigna06
please find the attached file.

Hi @cmfsx. Thank you for working on this. I checked the file and there where a two problems with the scene that made the sawBoxes not position well:

  • The bone segmentations must be Wrap-Solidified in the segment editor (you have to install the SurfaceWrapSolidify extension first). Just click apply on Wrap Solidify after you created a bone segment (for example: using threshold and select island effects). After that correct any errors on the result (if there are any) and your segmentation is ready to use in the BoneReconstructionPlanner.
  • First and last mandible cut planes should be at 5mm distance from the titanium thing that is in the mandible, because it's irregular shape confuses the positioning algorithm

Is there a special advantage in keeping the original Mandible hidden and decimated one visible rather than the other way around when bone models are created? because I thought the original will look better during the surgical planning and i believe you use the decimated one for calculations only.

All the visualization is made with decimated model because they are faster to process on the dynamicModelerModule which makes the resectedMandible and the fibulaBonePieces

most of the bugs I found previously have been corrected

If you find any more problems please check the above suggestions.

The only problem now is the make the saw boxes (Mandible cutting guide) to orient properly (according to the wishes of the surgeon.
a.One solution would be to make it rotate when you rotate the mandibular plane. (Disadvantage is that the fibula pieces also rotate with it when you do it. )

I have thought about this. And I'm thinking that rotating the mandible planes one by one is not an useful option. A newly created plane can control rotation of all fibulaPlanes at the same time. Mandible planes X axis could be used as desired direction for the sawBoxes. FibulaPlanes X axis could be used to set up the direction of the miterBoxes allowing different directions (for example: superior and posterior). @cmfsx and @lassoan maybe we can talk more about this on next meeting.

@lassoan I'm letting this code for review because bug causes where identified.

@mauigna06 mauigna06 marked this pull request as ready for review March 25, 2021 19:08
@mauigna06 mauigna06 requested a review from lassoan March 25, 2021 19:09
@mauigna06
Copy link
Collaborator Author

mauigna06 commented Apr 21, 2021

@cmfsx now sawBoxes are moveable, please check the latest commit and give feedback. In a future version of the code only X and Y axis will be shown for translation and only Z axis will be shown for rotation so the surgical plan is protected

@cmfsx
Copy link
Collaborator

cmfsx commented Apr 22, 2021

@mauigna06

I tried the latest version. The Saw box interactions are excellent. With common sense, even it not been constrained to the plane is not a big issue.

I came across few problems though. in the Mandible guide by default sawBoxesModels are hidden and then when I create the guide base the sawBoxesModels are not subtracted and therefore there is no slot created.
Also, the holes were not created in the guide base for some reason.

Screenshot_42

@mauigna06
Copy link
Collaborator Author

mauigna06 commented Apr 22, 2021

@cmfsx

I came across few problems though. in the Mandible guide by default sawBoxesModels are hidden and then when I create the guide base the sawBoxesModels are not subtracted and therefore there is no slot created.

I suspect slots are being created. I suggest you hide "biggerSawBoxes Models" to see the slots. If not upload a scene and I'll check.

Also, the holes were not created in the guide base for some reason.

Please check that "Mandible Cylinders Models" is not empty. Also check that the fiducialList selected is correct (verify is not a fibulaCylinderFiducialList). After that click "Create cylinders from fiducial list and mandible surgical guide base" and try making the surgical guide again and tell me how it goes.

@cmfsx
Copy link
Collaborator

cmfsx commented Apr 22, 2021

I suspect slots are being created. I suggest you hide "biggerSawBoxes Models" to see the slots. If not upload a scene and I'll check

The problem persists, Both the screw holes and the slot is not created.

https://drive.google.com/file/d/1VXJ6P0wNO_PMdBdgOFTaWHVLBE8D45Zd/view?usp=sharing

@mauigna06
Copy link
Collaborator Author

The problem persists, Both the screw holes and the slot is not created.

The bug was solved. Please tell me if you have any more problems

@cmfsx
Copy link
Collaborator

cmfsx commented Apr 23, 2021

Please tell me if you have any more problems

I find it if we create the cutting planes in the wrong order and then simulate it then again or-order the planes proeplry the simulation is not corrected. If we create planes in wrong order but re-order them properly before doing the simulation ( pressing the update button) then simulation work.

Screenshot_35

@mauigna06
Copy link
Collaborator Author

I find it if we create the cutting planes in the wrong order and then simulate it then again or-order the planes proeplry the simulation is not corrected. If we create planes in wrong order but re-order them properly before doing the simulation ( pressing the update button) then simulation work.

You have to reorder them using the data module. If not it doesn't work I don't know why.

It is not much work to implement a button to reorder mandible planes or to reorder the planes when a new plane is added. I can do that if you want

@cmfsx
Copy link
Collaborator

cmfsx commented Apr 23, 2021

You have to reorder them using the data module. If not it doesn't work I don't know why.

Ok I will try it.

@mauigna06 mauigna06 removed the request for review from lassoan April 24, 2021 20:49
…dibleCurve when a new mandiblePlane is added
…use it could work wrong if rotatedMandiblePlaneAxes are not well defined
@mauigna06
Copy link
Collaborator Author

Now mandiblePlanes are ordered when a new mandiblePlane is added.

@cmfsx Please do a last test to the module (VSP and surgical guides), if everything is okay I'll merge this branch to main

@mauigna06
Copy link
Collaborator Author

This branch is quite tested right now. I'll merge

@mauigna06 mauigna06 merged commit d81a2f4 into main Apr 30, 2021
@mauigna06 mauigna06 deleted the Mandible-Surgical-Guide-Feature branch July 9, 2023 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants