Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 3 additions & 36 deletions vmtkScripts/vmtkimagereader.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def __init__(self):
self.InputFileName = ''
self.InputFilePrefix = ''
self.InputFilePattern = ''
self.InputDirectoryName = ''
self.Image = 0
self.Output = 0

Expand All @@ -60,7 +59,6 @@ def __init__(self):
['InputFileName','ifile','str',1,'','input file name'],
['InputFilePrefix','prefix','str',1,'','input file prefix (e.g. foo_)'],
['InputFilePattern','pattern','str',1,'','input file pattern (e.g. %s%04d.png)'],
['InputDirectoryName','d','str',1,'','input directory name - dicom only'],
['DataExtent','extent','int',6,'','3D extent of the image - raw and png'],
['HeaderSize','headersize','int',1,'(0,)','size of the image header - raw only'],
['DataSpacing','spacing','float',3,'','spacing of the image - raw, tiff, png, itk'],
Expand Down Expand Up @@ -180,26 +178,6 @@ def ReadPNGImageFile(self):
reader.Update()
self.Image = reader.GetOutput()

def ReadDICOMFile(self):
if (self.InputFileName == ''):
self.PrintError('Error: no InputFileName.')
self.PrintLog('Reading DICOM file.')
reader = vtkvmtk.vtkvmtkDICOMImageReader()
reader.SetFileName(self.InputFileName)
reader.SetAutoOrientImage(self.AutoOrientDICOMImage)
reader.Update()
self.Image = reader.GetOutput()

def ReadDICOMDirectory(self):
if (self.InputDirectoryName == ''):
self.PrintError('Error: no InputDirectoryName.')
self.PrintLog('Reading DICOM directory.')
reader = vtkvmtk.vtkvmtkDICOMImageReader()
reader.SetDirectoryName(self.InputDirectoryName)
reader.SetAutoOrientImage(self.AutoOrientDICOMImage)
reader.Update()
self.Image = reader.GetOutput()

def ReadITKIO(self):
if self.InputFileName == '':
self.PrintError('Error: no InputFileName.')
Expand Down Expand Up @@ -276,14 +254,6 @@ def Execute(self):
if not self.InputFileName:
self.PrintError('Error: no InputFileName.')

if self.InputDirectoryName == 'BROWSER':
import tkinter.filedialog
initialDir = pypes.pypeScript.lastVisitedPath
self.InputDirectoryName = tkinter.filedialog.askdirectory(title="Input directory",initialdir=initialDir)
pypes.pypeScript.lastVisitedPath = self.InputDirectoryName
if not self.InputDirectoryName:
self.PrintError('Error: no InputDirectoryName.')

if self.GuessFormat and self.InputFileName and not self.Format:
import os.path
extension = os.path.splitext(self.InputFileName)[1]
Expand All @@ -292,18 +262,13 @@ def Execute(self):
if extension in list(extensionFormats.keys()):
self.Format = extensionFormats[extension]

if self.UseITKIO and self.InputFileName and self.Format not in ['vtkxml','vtk','raw'] and not self.InputDirectoryName:
if self.UseITKIO and self.InputFileName and self.Format not in ['vtkxml','vtk','raw']:
self.ReadITKIO()
else:
if self.Format == 'vtkxml':
self.ReadVTKXMLImageFile()
elif self.Format == 'vtk':
self.ReadVTKImageFile()
elif self.Format == 'dicom':
if self.InputDirectoryName != '':
self.ReadDICOMDirectory()
else:
self.ReadDICOMFile()
elif self.Format == 'raw':
self.ReadRawImageFile()
elif self.Format == 'meta':
Expand All @@ -312,6 +277,8 @@ def Execute(self):
self.ReadPNGImageFile()
elif self.Format == 'tiff':
self.ReadTIFFImageFile()
elif self.Format == 'dicom':
self.PrintError('Error: please enable parameter UseITKIO in order to read dicom files')
else:
self.PrintError('Error: unsupported format '+ self.Format + '.')

Expand Down
5 changes: 0 additions & 5 deletions vtkVmtk/CMakeOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ SET(VTK_VMTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
# If this is a build tree, provide an option for putting
# this project's executables and libraries in with VTK's.
IF (EXISTS ${VTK_DIR}/bin)
#this is a hack to make DICOMParser be included correctly - VTK source
# INCLUDE_DIRECTORIES(BEFORE ${VTK_SOURCE_DIR}/Utilities/DICOMParser)
OPTION(USE_VTK_OUTPUT_PATHS
"Use VTK's output directory for this project's executables and libraries."
OFF)
Expand All @@ -50,9 +48,6 @@ IF (EXISTS ${VTK_DIR}/bin)
SET (LIBRARY_OUTPUT_PATH ${VTK_DIR}/bin)
SET (EXECUTABLE_OUTPUT_PATH ${VTK_DIR}/bin)
ENDIF (USE_VTK_OUTPUT_PATHS)
#ELSE (EXISTS ${VTK_DIR}/bin)
#this is a hack to make DICOMParser be included correctly - VTK install
# INCLUDE_DIRECTORIES(BEFORE ${VTK_INCLUDE_DIRS})
ENDIF (EXISTS ${VTK_DIR}/bin)


Expand Down
2 changes: 0 additions & 2 deletions vtkVmtk/IO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ vtkCommonCore
vtkIOImage
vtkIOLegacy
vtkImagingCore
vtkDICOMParser
)
if (VTK_WRAP_PYTHON AND VTK_VMTK_WRAP_PYTHON)
list(APPEND VTK_VMTK_IO_COMPONENTS
Expand All @@ -18,7 +17,6 @@ list( APPEND VTK_VMTK_IO_TARGET_LINK_LIBRARIES ${VTK_LIBRARIES} )


SET (VTK_VMTK_IO_SRCS
vtkvmtkDICOMImageReader.cxx
vtkvmtkDolfinWriter.cxx
vtkvmtkFDNEUTReader.cxx
vtkvmtkFDNEUTWriter.cxx
Expand Down
Loading