Changeset 872785f in sasview for DataLoader


Ignore:
Timestamp:
Mar 27, 2009 3:34:25 PM (16 years ago)
Author:
Jae Cho <jhjcho@…>
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
Message:

working on tiff reader and plotter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/readers/tiff_reader.py

    rbdd71f4 r872785f  
    1616import math, logging, os 
    1717import numpy 
    18 from DataLoader.data_info import Image2D#Data2D 
     18from DataLoader.data_info import Image2D 
    1919     
    2020class Reader: 
     
    5454            raise  RuntimeError,"cannot open %s"%(filename) 
    5555        data = im.load() 
    56         print im.mode 
    57         im.show() 
     56 
    5857        x_range = im.size[0] 
    5958        y_range = im.size[1] 
     
    6564        x_vals = [] 
    6665        y_vals = []  
    67         if im.mode == "P": 
    68             data=im.split() 
    6966 
    7067        # x and y vectors 
     
    8582                            R,G,B= data[i_x,i_y] 
    8683                            #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)  
    8885                          
    8986                        elif len(data[i_x,i_y]) == 4:    
    9087                            R,G,B,I = data[i_x,i_y] 
    9188                            #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) 
    9390                    else: 
    9491                        #Take it as Intensity 
    95                         #value = 255-float(data[i_x,i_y]) 
     92                        value = float(data[i_x,i_y]) 
    9693                except: 
    9794                    logging.error("tiff_reader: had to skip a non-float point") 
Note: See TracChangeset for help on using the changeset viewer.