[Insight-users] pixel values change just by reading them ?

jp cervellone at gmail.com
Tue Jul 30 07:42:04 EDT 2013


Hi Matt 

here is a sample code that gives the error in pixel intensity
I have single plane tiffs and i write into single volume tiff
I look at the results with fiji/ imageJ


thanks 
jp


--------------------------------------------------------------------------
import itk
import Tkinter, tkFileDialog
import os
import glob
imageSpacing = [1,1,1]

fileReadPath  = tkFileDialog.askdirectory(initialdir="/home/" ,title='Please
select a read directory')
fileWriteRootPath = tkFileDialog.askdirectory(initialdir="/home/"
,title='Please select a write directory')
os.chdir(fileReadPath)


filenames = glob.glob('*.tif')# specify the extension of your fileseries
filenames.sort()

itkImageType = itk.Image.UC3


            
reader= itk.ImageSeriesReader[itkImageType].New()
reader.SetFileNames(filenames)
#reader.Update()
volume = reader.GetOutput()
volume.SetSpacing(imageSpacing)
volume.Update()
            
        
fileString= fileWriteRootPath + '/ ' + 'test.tif'
writer=itk.ImageFileWriter[itkImageType].New()
writer.SetInput(volume)
writer.SetFileName(fileString)
#writer.Update()
writer.Write()





--
View this message in context: http://itk-users.7.n7.nabble.com/pixel-values-change-just-by-reading-them-tp32002p32008.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list