Skip to content

Instantly share code, notes, and snippets.

View tfmoraes's full-sized avatar

Thiago Franco de Moraes tfmoraes

View GitHub Profile
@tfmoraes
tfmoraes / neovim fzf
Created April 15, 2015 19:43
neovim fzf
call plug#begin('~/.nvim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
call plug#end()
@tfmoraes
tfmoraes / test_numpy_memmap.py
Created April 19, 2011 18:26
Testing numpy memmap with multiprocessing
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import multiprocessing
import numpy as np
def print_matrix(matrix):
print matrix
def main():
matrix = np.memmap('test.dat', dtype='int16', mode='w+', shape=(100, 100))
@tfmoraes
tfmoraes / traceback_memmap.py
Created April 27, 2011 12:14
traceback_memmap
<traceback>
Process Process-1:
Traceback (most recent call last):
File "C:\Python26\Lib\multiprocessing\process.py", line 232, in _bootstrap
self.run()
File "C:\Python26\Lib\multiprocessing\process.py", line 88, in run
self._target(*self._args, **self._kwargs)
File "C:\Documents and Settings\phamorim\Desktop\test.py", line 7, in print_ma
trix
print matrix
@tfmoraes
tfmoraes / imshow.py
Created October 14, 2012 01:02
plotting an arrays as image
import pylab
a = [[1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 2],
[1, 1, 2, 2, 2, 1, 2, 3, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 1, 2, 3],
[2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 3, 1],
[2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1],
[1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2],
[1, 1, 1, 1, 3, 1, 2, 3, 1, 2, 4, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2],
[1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 3, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
diff --git a/Library/Formula/vtk.rb b/Library/Formula/vtk.rb
index 073e90f..5858228 100644
--- a/Library/Formula/vtk.rb
+++ b/Library/Formula/vtk.rb
@@ -35,6 +35,7 @@ class Vtk < Formula
-DBUILD_SHARED_LIBS=ON
-DCMAKE_INSTALL_RPATH:STRING='#{lib}/vtk-5.10'
-DCMAKE_INSTALL_NAME_DIR:STRING='#{lib}/vtk-5.10'
+ -DIOKit:FILEPATH=/System/Library/Frameworks/IOKit.framework
]
@tfmoraes
tfmoraes / gdcm.rb
Created April 10, 2016 22:49
Formula to compile gdcm with vtk6.3 (and possibly vtk7)
class Gdcm < Formula
desc "Grassroots DICOM library and utilities for medical files"
homepage "http://sourceforge.net/projects/gdcm/"
url "http://heanet.dl.sourceforge.net/project/gdcm/gdcm%202.x/GDCM%202.6.3/gdcm-2.6.3.tar.bz2"
sha256 "7882e880b8b60efc66a492ae3c1c161799340ad62a90d690823b76eb400c0a8f"
bottle do
sha256 "5e480698f28f6a3d7e16eeec541feb9b6e0ec24edfe4f3c5c35c11f80895d28d" => :el_capitan
sha256 "1d046333077cc1f5325247a9f23260cabc1fe6152c75ddd0333e1ad14bcbdf46" => :yosemite
sha256 "be5cf5f2ffd1d68322a01d22de4f119366fb26cecb9484c801819ec988d804bf" => :mavericks
diff --git a/app.py b/app.py
index a2b76f9..cd4c055 100755
--- a/app.py
+++ b/app.py
@@ -198,7 +198,8 @@ class SplashScreen(wx.SplashScreen):
self.control = Controller(self.main)
self.fc = wx.FutureCall(1, self.ShowMain)
- wx.FutureCall(1, parse_comand_line)
+ options, args = parse_comand_line()
diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py
index 8845085..79ba515 100644
--- a/invesalius/data/surface.py
+++ b/invesalius/data/surface.py
@@ -774,16 +774,16 @@ class SurfaceManager():
session = ses.Session()
session.ChangeProject()
- # The following lines have to be here, otherwise all volumes disappear
- measured_polydata = vtk.vtkMassProperties()
diff --git a/Utilities/VTK/vtkGDCMPolyDataWriter.cxx b/Utilities/VTK/vtkGDCMPolyDataWriter.cxx
index e2c661c39..62eda25f5 100644
--- a/Utilities/VTK/vtkGDCMPolyDataWriter.cxx
+++ b/Utilities/VTK/vtkGDCMPolyDataWriter.cxx
@@ -586,7 +586,11 @@ void vtkGDCMPolyDataWriter::WriteRTSTRUCTData(gdcm::File &file, int pdidx )
if( darray )
{
double tuple[3];
+#if (VTK_MAJOR_VERSION >= 8)
+ darray->GetTypedTuple( 0, tuple );
diff --git a/Utilities/VTK/vtkImageColorViewer.cxx b/Utilities/VTK/vtkImageColorViewer.cxx
index 3d6df39..ea857ef 100644
--- a/Utilities/VTK/vtkImageColorViewer.cxx
+++ b/Utilities/VTK/vtkImageColorViewer.cxx
@@ -539,7 +539,15 @@ public:
if (event == vtkCommand::ResetWindowLevelEvent)
{
-#if (VTK_MAJOR_VERSION >= 6)
+#if VTK_MAJOR_VERSION > 7 || (VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION >= 1)