Hi all,
I am working on a module for exporting image data from slicer to a format for our medical simulation systems. I have started with a simple python module for thresholding, scaling and normalizing the data (0 – 1) and writing them to a file format our simulation system can read. Getting the image data and writing them to file seems straight forward.
But for me it is not clear how to change the actual image data and get the values for writing them to an output file. I see people using vtk filters to change the displayed views, but they do not change the actual image data.
My code looks somewhat like this:
# getimage dimentions and spacing imageData = inVolumeData.GetImageData() imageDimention = imageData.GetDimensions() scalarRange = imageData.GetScalarRange(); imageSpaceing = inVolumeData.GetSpacing() # filter, let use existing filters and not make my own shiftScale = vtk.vtkImageShiftScale() shiftScale.SetInputData( imageData ) shiftScale.SetShift(3000) shiftScale.SetScale(0.07) shiftScale.SetOutputScalarTypeToUnsignedChar() ### how to get the raw data values for output the file? ### and update the slicer views?