X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=gdcmPython%2Fdemo%2FvtkGdcmReader.py.in;h=9070727d2506b37e5cd834d268c4a18b21dd88c6;hb=a8630a49a397462841dcd629e8f38083c0800151;hp=70670b2b9907c60a7452897b841b5d9330f71537;hpb=d24a4150db8e1c04392eece82119098276713d46;p=gdcm.git diff --git a/gdcmPython/demo/vtkGdcmReader.py.in b/gdcmPython/demo/vtkGdcmReader.py.in index 70670b2b..9070727d 100644 --- a/gdcmPython/demo/vtkGdcmReader.py.in +++ b/gdcmPython/demo/vtkGdcmReader.py.in @@ -1,22 +1,29 @@ import sys -import os - -# All paths must be added without system tests, because of ctest... -sys.path.append('${GDCM_BINARY_DIR}') -if os.name == 'posix': - sys.path.append('${GDCM_BINARY_DIR}/bin') -else: - sys.path.append('${GDCM_BINARY_DIR}/bin/Release') - sys.path.append('${GDCM_BINARY_DIR}/bin/Debug') - +import os.path +from gdcmConfigDemo import * from gdcmPython.vtk import * from vtkpython import * +def PrintUse(): + print "" + print "Use :" + print "-----" + print "%s " % sys.argv[0] + print " fileName : path to the DICOM file to see" + print "" + print "" + # Get the file names try: fileName = sys.argv[1] except IndexError: - fileName = os.path.join(GDCM_DATA_PATH, "test.acr") + fileName = os.path.join(GDCM_DATA_ROOT, "test.acr") + if( not os.path.isfile(fileName) ): + fileName=os.path.join(os.path.split(sys.argv[0])[0],"test.acr") + +if( not os.path.isfile(fileName) ): + PrintUse() + sys.exit(1) # read the image reader = vtkGdcmReader() @@ -33,7 +40,7 @@ viewer.SetColorLevel(0.5 * (rng[1] + rng[0])) dim = reader.GetOutput().GetDimensions() viewer.SetSize(dim[0],dim[1]) if(dim[2] != 1): - # For multifame dicom, take a snapshot of the center slice (+/- 1) + # For multiframe dicom, take a snapshot of the center slice (+/- 1) viewer.SetZSlice(dim[2] / 2) else: viewer.SetZSlice(0)