What are some libraries in Python that have the ability to read CT model files with extensions such as .vtk or .stl and perform 3D image registration with normal videos. I have found many softwares that have this ability but what I am looking for is not a program but a Python library such as Numpy or OpenCV, where all I need to do is import numpy or import cv2.
Made up example of what I want to do
Step 1 - Get the 3D CT model of a person's skull
Step 2 - Read the 3D CT model into Python
Step 3 - Get a normal video of a person standing still
Step 4 - Perform registration of the 3D CT skull and
person's head from the normal video
Step 5 - Display the registration output
I have found a couple of Python libraries that "seem" to do this sort of thing but they do not have enough information in the library description to be sure that this is what I want. I am also open to using multiple libraries. Is there anyone who has done something similar to this and it would be great if someone with experience with any libraries could give me some recommendations, thanks. If there aren't any, I will also consider libraries in other languages.
What I have considered so far
FW4SPL Libarary in C++
MITK Library in C++
MeVisLab Software in Python
Elastix Library in C++
SimpleElastix Library in Python
ITK Library in C++
SimpleITK Library in Python
For FW4SPL and MITK, I have been unable to successfully compile the source code due to new errors continuously occurring after debugging old errors. It seems that the occurrence of new errors will not stop occurring (I have spent a lot of time doing this and do not wish to continue anymore).
For MeVisLab, this is not a Python library such as numpy or opencv but it is a GUI which is also said to be programmable.
For Elastix, SimpleElastix, ITK and SimpleITK, they are indeed C++ and Python libraries which seem perfect but I am not sure if they provide the requirements of my application described above. Also, I am very confused about the relationship to one another.
I am playing with vtk and stl files for the first time. Your question drove me curious but I am clearly not experienced. I started looking into this before the above comment. I did not realize we were off-topic, sorry. So I give you my conclusions at this point, since there were built for sharing.
1) for .vtk files
It turns out that most of the library I saw are for python 2.7 while I prefer the up to date version (3.5 for now).
For 3.5 I finally adopted the version of ‘woodscn’ that seems promising, for coding it seems to me all the required info is on Reading a .vtk file with python
2) for .stl files
the ‘nestly’ package from 'conda-forge’ looks good, with a typical example on https://github.com/fhcrc/nestly/blob/master/examples/basic_nest/make_nest.py
then you just have to write import vtk and import nestly in the python script.
hope this helps
Related
Let me start off by saying my python knowledge is beginner-to-intermediate level, and I recently started using the language again after a long time.
The Goal:
This morning I came across a bunch of word documents I wanted to convert and concatenate to PDF files, with 2 .doc files creating one PDF.
seemed like a fairly trivial task, so I figured I'd try to learn how to do it in python.
concatenating PDFs wasn't too bad, I found PyPDF2 and managed to write a script that did just that.
But 7 hours later, after countless scripts with broken dependencies- I still can't find a way to automate the doc-pdf conversion.
The Problem(s):
every script I found either:
uses python-docx (my documents are word 2003 .docs)
uses unoconv bridge (which I installed along with OpenOffice, then searched around for documentation but found none- thus I have no idea how to call from a python script or the shell. I saw one example for this but it keeps throwing errors)
uses win32com or win32com.client or pywin32 or somesuch.
I ran into numerous issues with these- installed one but couldn't import it from code (as happened to the guy here), now I can't even find them with pip. searched for documentation for them (are they modules or classes? I have no idea) and found practically nothing that I could understand, beyond that they're connected to ActivePython. (which is apparantly a superset of Python with more capabilities?).
Uses comtypes, which I installed but was unable to use/import either for some reason (maybe I'm using pip wrong somehow?)
I know my question is hardly focused but honestly by now my brain is fried from information overload. any simplifications for a noob would be more than welcome.
TL;DR:
assuming no knowledge of COM stuff and little experience with any external frameworks:
what would I have to do to convert Word 2003 .doc files to .pdf files? I'm running python3.5.1 32-bit on a Windows 10 64-bit machine.
where can I learn more about accessing other software APIs from python? are there big prerequisites for this stuff like knowing how the OS works on a lower level?
Thanks!
From my experience, converting between the various office formats is best done outside of python. With the subprocess module, you can call the external command
soffice --convert-to pdf file.doc --headless
where soffice is the command that comes with LibreOffice.
Im working of a project in python that is intended to be as modular and flexible as possible. The project must to be written in Python, and it involves some image processing (access to individual pixels and image size).
what would be the best way to manipulate an image in Python without the use of external libraries? I am trying to use as little dependancies as possible, so it will be easy to transfer to different platforms.
I would appreciate any other approaches that might work better.
Well I can understand your concern I myself had a similar problem when i did a project on image processing and i had to port it to nanoboard(FPGA) so using external libraries is much of a headache.
What i did was, first programmed the code using the libraries at hand and then looked up for their implementation. You can view the source code for functions in python and they could be used with a little modifications. Hope it helps. Reach me for any furthur queries.
Hi I have a MATLAB function that graphs the trajectory of different divers (the Olympic sport diving) depending on the position of a slider at the bottom of the window. The file takes multiple .mat files (with trajectory information in 3 dimensions) as input. I am trying to put this MATLAB app on to the internet. What would be the easiest/most efficient way of doing this? I have experience programming in Python and little experience programming in Java.
Here are the options that I have considered:
1. MATLAB Builder JA (too expensive)
2. Rewrite entire MATLAB function into Java (not experienced enough in Java)
3. Implement MATLAB file using mlabwrapper and using Django to deploy into web app. (having a lot of trouble installing mlabwrapper onto OSX)
4. Rewrite MATLAB function into Python using SciPy, NumPy, and matlibplot and then using Django.
I do not have any experience with Django but I am willing to learn it. Can someone point me in the right direction?
A cheap and somewhat easy way (with limited functionality) would be:
Install MATLAB on your server, or use the MATLAB Compiler to create a stand alone executable (not sure if that comes with your version of MATLAB or not). If you don't have the compiler and can't install MATLAB on your server, you could always go to a freelancing site such as elance.com, and pay someone $20 to compile your code for you into a windows exe file.
Either way, the end goal is to make your MATLAB function callable from the command line (the server will be doing the calling) You could make your input arguments into the slider value, and the .mat files you want to open, and the compiled version of MATLAB will know how to handle this. Once you do that, have the code create a plot and save an image of it. (using getframe or other figure export tools, check out FEX). Have your server output this image to the client.
Tah-dah, you have a crappy low cost work around!
I hope this helps , if not, I apologize!
You could always just host the MATLAB code and sample .mat on a website for people to download and play with on their own machines if they have a MATLAB license. If you are looking at having some sort of embedded app on your website you are going to need to rewrite your code in another language. The project sounds doable in python using the packages you mentioned however hosting it online will not be as simple as running a program from your command line. Django would help you build a website but I do not think that it will allow you to just run a python script in the browser.
I'm trying to create a means to display QR codes on a small display using a Telit GE-865 as the main controller. In short, the Telit would receive an sms and spin that string out to a display in the form of a QR code. I've found a few different python QR code library's (most from the fukuchi ports), but I'm not exactly sure if they can be imported into a Telit module. If anyone has any experience running python on the Telit modules I'd love to hear your experience and get your thoughts on whether this is feasible or not.
Thanks in advance!
Yes, sorry. Forgot to elaborate a bit. My specific concern is that the scripts Telit provides for examples reference a 1 version of Python. Everything in the QR Encoding library that I've been finding usually require 2.6 or later. I'm not sure if the Telit module can handle a QR encoding script or not with it's PIL library. I'm really just trying to wrap my head around it all before I start figuring out how to actually load the libraries onto the module. I also found this site that seems to have a decent amount of info on this topic. link – user1667373
This device uses a customized version of Python 1.5.2. You may need to back-port whatever library to are using to work with this older version of Python. Note also that not all standard Python modules are available, and floating point math is not supported.
See section 5 of the "Telit Easy Script in Python" manual for details of what is and is not included. You can find it here: http://www.telit.com/en/products/gsm-gprs.php?p_id=12&p_ac=show&p=47
I'm trying to write my own media player (like Foobar), and I'm having trouble tracking down a Python library that'll play MP3s. I know Pymedia does mp3s, but it looks outdated - the latest installer is for Python version 2.4, and I'm using 2.6. I've never had much success with Pygame, and Pyglet doesn't look like it has too much in the way of documentation. Are there any other alternatives?
There is http://pyglet.org/ and also have you tried http://code.google.com/p/mp3play/? It's also available from PyPi (http://pypi.python.org/pypi/mp3play/) However, I think mp3play is Win32 only for now.
Looking at the updates, there were commits within last couple of months.
I've been using PyMedia in Python 2.6.5 on Windows successfully. Caveats: the documentation is bad and wrong -- many of the tutorials have glaring errors or otherwise don't work -- so I had to do some experimentation and Googling to get my code to work right. Also for whatever reason the maintainers seem to have stopped updating the project site 4 years ago, though they seem to be actively doing something.
I found installers here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
The semi-active forum linked from their website includes some code maintainers who are semi-helpful. I'm jboyd99 if anyone is looking for tips.
For reasons that are beyond me the focus is on car audio systems, despite the fact that it is a fairly fully featured library that does some things no other free Python library does, like read MP3s into raw PCM data. The library has some flaws -- I'll probably use PyAudio or PyAudiere for actual playback for better control of synchrony issues.
Maybe it'd be simpler to write that part of your application in Python 2.4 as a separate "backend". This way you could use PyMedia (http://pymedia.org/) (as you mentioned) for the actual playback. It'd allow you to write your GUI in another Python version (like 2.6), which would also mean more decoupling of program components and parallelism (smoother GUI).
If you target only the Windows platform, then using Media Player via COM might help:
http://www.daniweb.com/code/snippet216465.html