Changeset 872785f in sasview for DataLoader
- Timestamp:
- Mar 27, 2009 3:34:25 PM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 00c3aac
- Parents:
- 31f3f661
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/readers/tiff_reader.py
rbdd71f4 r872785f 16 16 import math, logging, os 17 17 import numpy 18 from DataLoader.data_info import Image2D #Data2D18 from DataLoader.data_info import Image2D 19 19 20 20 class Reader: … … 54 54 raise RuntimeError,"cannot open %s"%(filename) 55 55 data = im.load() 56 print im.mode 57 im.show() 56 58 57 x_range = im.size[0] 59 58 y_range = im.size[1] … … 65 64 x_vals = [] 66 65 y_vals = [] 67 if im.mode == "P":68 data=im.split()69 66 70 67 # x and y vectors … … 85 82 R,G,B= data[i_x,i_y] 86 83 #Converting to L Mode: uses the ITU-R 601-2 luma transform. 87 value = 255-float(R * 299/1000 + G * 587/1000 + B * 114/1000)84 value = float(R * 299/1000 + G * 587/1000 + B * 114/1000) 88 85 89 86 elif len(data[i_x,i_y]) == 4: 90 87 R,G,B,I = data[i_x,i_y] 91 88 #Take only I 92 value = 255-float(R * 299/1000 + G * 587/1000 + B * 114/1000)-float(I)89 value = float(R * 299/1000 + G * 587/1000 + B * 114/1000)+float(I) 93 90 else: 94 91 #Take it as Intensity 95 #value = 255-float(data[i_x,i_y])92 value = float(data[i_x,i_y]) 96 93 except: 97 94 logging.error("tiff_reader: had to skip a non-float point")
Note: See TracChangeset
for help on using the changeset viewer.