Skip to content

Instantly share code, notes, and snippets.

View cpinter's full-sized avatar

Csaba Pinter cpinter

View GitHub Profile
using PixelType = unsigned short;
constexpr unsigned int Dimension = 5;
using ImageType = itk::Image< PixelType, Dimension >;
using ReaderType = itk::ImageFileReader< ImageType >;
ReaderType::Pointer reader = ReaderType::New();
using InputImageType = itk::Image<PixelType, Dimension>;
reader->SetFileName("d:/pynrrd_test.nrrd");
reader->Update();
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
from slicer.util import VTKObservationMixin
#
# CalibrationPhantomSegmentation
#
class CalibrationPhantomSegmentation(ScriptedLoadableModule):
def __init__(self, parent):
@cpinter
cpinter / AbstractMyAppModuleWidget.py
Last active January 20, 2022 17:55
Custom app parameter node
import logging
import vtk, qt, ctk, slicer
import Lib.MyAppParameters as Parameters
#
# AbstractModuleWidget
#
class AbstractMyAppModuleWidget():
@cpinter
cpinter / setPresetOffest.py
Created June 11, 2020 19:28
Set volume rendering preset
def setPresetOffset(self, x, y, dontMoveFirstLast, presetsCombobox):
volRenWidget = slicer.modules.volumerendering.widgetRepresentation()
if volRenWidget is None:
logging.error('Failed to access volume rendering module')
return
# Make sure the proper volume property node is set
volumePropertyNode = presetsCombobox.mrmlVolumePropertyNode()
if volumePropertyNode is None:
logging.error('Failed to access volume properties')
@cpinter
cpinter / qSlicerDataStoreModuleCxxTests.cxx
Created January 29, 2020 21:12
Generated test file causing build error with VTK 8.90 with Slicer 4.11
#include <ctype.h> /* NOLINT */
#include <stdio.h> /* NOLINT */
#include <stdlib.h> /* NOLINT */
#include <string.h> /* NOLINT */
#if defined(_MSC_VER)
#pragma warning(disable : 4996) /* deprecation */
#endif
#include "vtkWin32OutputWindow.h"
@cpinter
cpinter / vtkMRMLMarkupsDisplayNode.cxx
Created July 11, 2019 15:56
Python wrapping of static constant string
/*==============================================================================
Program: 3D Slicer
Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
Unless required by applicable law or agreed to in writing, software