Moving meshes between 3matic and Mimics

I’m moving large meshes between Mimics and 3matic using the workflow laid out in the relevant demo script, and would like to discuss other, faster possibilities. I have a mesh of 4.5M elements that takes 7 minutes to import into mimics, after exporting from 3matic. It takes just over a minute if I manually copy from 3matic to mimics ,or use the remesh button in the mimics window to start my edits.

I’d like to be able to access the remesh tool to move meshes between mimics and 3matic. Is that going to be added to the api at any point?

A second option would be to allow the export and import that occurs during the copy-paste to be a python function.

Hi Nathan,

Thanks for your question. What the copy-paste function does in the background is saving a small subproject (Mimics or 3-matic) and then importing it again. This is significantly faster than exporting and importing to and from non-Materialise formats. Would this be possible within your workflow? If at all feasible, try to remove all other objects from the projects before saving and importing. In Mimics, you can use the save_subproject function:
mimics.file.save_subproject(r"C:\Users\jdeckx\Desktop\Temp\test.mcs",[mimics.data.images.get_active()])

I hope this helps!

Julien

Thanks for the response. That’s useful insight into the background functionality. It’d be nice if I could save particular objects as subprojects. This function looks to only support images. Will that carry the mesh through to 3matic?

I tried to run the code and got an error that I don’t quite understand. It’s complaining about a tuple and I’m not passing it any tuples.

In the meantime, I’m able to use pyautogui to use the copy and paste speed to move files between mimics and 3matic. It’s a bit of a hack because I have to start with my windows in a certain position now, but not overly burdensome. I just added a popup dialog at the beginning of my script to remind myself.

def move_mesh_to_3matic(part_name='Smoothed_Femur 1'):
user_answer = pyautogui.confirm(text='Are 3matic and mimics open and on the right side and left side of the primary screen?',
                  title='PyAutoGUI Reminder', buttons=['OK', 'Cancel'])
if user_answer =='OK':
    # This works if mimics and 3matic are open, with Mimics on the left and 3matic on the right on a single screen.
    pyautogui.PAUSE = 0.5
    part = mimics.data.objects.find(part_name)
    part.selected = True
    # Opens context menu for selected part
    pyautogui.keyDown('ctrl')
    pyautogui.rightClick(700, 800)
    pyautogui.keyUp('ctrl')
    # Selects copy
    pyautogui.click(800,385)
    # Activates 3matic, if 3matic is open next to mimics
    pyautogui.click(1400, 385)
    #
    pyautogui.hotkey('ctrl', 'v')
else:
    raise IOError('User manually stopped move from mimics to 3matic')

Hi Nathan,

Great workaround, thanks for sharing! As for the error above, I’m not sure why it’s referring to a tuple, but I am able to reproduce the same error if I don’t have any images loaded. Did you have any active images when you ran that code? Normally it should export all objects linked to the image stack you pass.

Julien

I did have active images.

Hi Nathan,

Would you be able to send your mimics project and python script by PM or e-mail? This way we can take a look at what’s going wrong.

Thanks,

Julien

I’m afraid I cannot send these out. There could be some HIPPA issues.

Hi Nathan,

You can completely de-identify the Mimics project, either in the UI (File>Anonymize) or through scripting ( mimics.dicom.anonymize_file).

Julien