This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-- Matrix | |
float modelview[16]; | |
float projection[16]; | |
glGetFloatv (GL_MODELVIEW_MATRIX, modelview); | |
glGetFloatv (GL_PROJECTION_MATRIX, projection); | |
cv::Mat modelM(4,4,CV_32FC2,modelview); | |
cv::Mat projM(4,4,CV_32FC2,projection); | |
cv::Mat M = projM*modelM; | |
std::cout<<M<<std::endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enable OffScreen Rendering | |
renderWindow->OffScreenRenderingOn(); | |
// Set renderWindow size | |
const int* windowSize = renderWindow->GetSize(); | |
int W = windowSize[0]; | |
int H = windowSize[1]; | |
renderWindow->SetSize(d->exportWidthSpinBox->value(),d->exportHeightSpinBox->value()); | |
// Get Image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# add-sdks.py | |
# Rob Napier <[email protected]> | |
# Alexis girault <[email protected]> | |
# Script to link in all your old SDKs to Xcode | |
# Needs to be run every time you update Xcode | |
# | |
# 1. Create a directory and store the SDKs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Download MacOSX SDK and link them into XCode | |
# Make sure to update XCode beforehand (xcode-select --install) | |
mkdir SDKs | |
cd SDKs | |
git clone https://github.com/phracker/MacOSX-SDKs.git MacOSX.platform | |
cd .. | |
git clone https://gist.github.com/f213c737c0b2b581b13c.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//----------------------------------------------------------------------------- | |
void vtkOpenGLVertexBufferObject::AddDataArray(vtkDataArray *data) | |
{ | |
if (!this->VertexCount) | |
{ | |
this->VertexCount = data->GetNumberOfTuples(); | |
} | |
else if (VertexCount != data->GetNumberOfTuples()) | |
{ | |
vtkErrorMacro("AddDataArray() can not add array with a different number of " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Directory | |
const char *folderASCII = [folder cStringUsingEncoding:NSASCIIStringEncoding]; | |
auto dicomDir = vtkSmartPointer<vtkDICOMDirectory>::New(); | |
dicomDir->SetDirectoryName(folderASCII); | |
dicomDir->Update(); | |
// Reader | |
auto reader = vtkSmartPointer<vtkDICOMReader>::New(); | |
reader->SetFileNames(dicomDir->GetFileNamesForSeries(0)); | |
//reader->SetMemoryRowOrderToFileNative(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const char* objPath = ""; //orientation cube | |
const char* jpgPath = ""; //orientation texture | |
vtkRenderWindow* renderWindow = self.vtkView.renderWindow; | |
// Create & add the renderer | |
renderer = vtkSmartPointer<vtkRenderer>::New(); | |
renderer->SetBackground(0., 0., 0.); | |
renderer->SetViewport(0., 0., 1., 1.); | |
renderer->InteractiveOn(); | |
renderWindow->AddRenderer(renderer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git status with a dirty flag | |
function __git_status_flag { | |
git_status="$(git status 2> /dev/null)" | |
clean_pattern="working tree clean" # For macOS. For Linux: "working directory clean" | |
remote_pattern="Your branch is (.*)" | |
diverge_pattern="Your branch and (.*) have diverged" | |
if [[ ! ${git_status} =~ ${clean_pattern} ]]; then | |
state="⚡ " | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto picker = vtkSmartPointer<vtkPropPicker>::New(); | |
picker->Pick(screen_x, screen_y, 0, renderer); | |
// Check if pick is in bounds | |
vtkAssemblyPath* path = picker->GetPath(); | |
bool validPick = false; | |
if (path) { | |
vtkCollectionSimpleIterator sit; | |
path->InitTraversal(sit); | |
vtkAssemblyNode *node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
void qMRMLSubjectHierarchyTreeView::updateItemsSelectableFlag() | |
{ | |
Q_D(qMRMLSubjectHierarchyTreeView); | |
if (!d->SubjectHierarchyNode) | |
{ | |
return; | |
} | |
qMRMLSubjectHierarchyModel* sceneModel = qobject_cast<qMRMLSubjectHierarchyModel*>(this->model()); |