repo
string
commit
string
message
string
diff
string
LTS5/connectomeviewer
d9c452626446779dd48a627886e48404a4bd776e
Add split fibers script to scratch
diff --git a/scratch/split_fibers.py b/scratch/split_fibers.py new file mode 100755 index 0000000..0253685 --- /dev/null +++ b/scratch/split_fibers.py @@ -0,0 +1,88 @@ +# check if fibers touch other grey matter labeled regions + +import numpy as np +import cfflib as cf + +# load data +a=cf.load('DATAALE/control01_tp1_run3.cff_FILES/meta.cml') + +print "Load fiberlabels...." +# fiberlabels +fiblabels = a.get_by_name('Fiber labels (freesurferaparc)') +fiblabels.load() + +print "Load fiberarray..." +# fiberarray +fibarr = a.get_by_name('Filtered Tractography') +fibarr.load() + +print "Load ROI parcellation..." +# segmentation volume in diffusion space +segvol = a.get_by_name('ROI Scale freesurferaparc (b0 space)') +segvol.load() + +print "Load GFA..." +# segmentation volume in diffusion space +gfavol = a.get_by_name('GFA Scalar Map') +gfavol.load() +# XXX: need to use voxel dimension + +# short cut references +sd=segvol.data.get_data() +voxdim=fibarr.data[1]['voxel_size'] +fib=fibarr.get_fibers_as_numpy() + +def print_fiblabels(fib, sd, fromid = 0, toid = 10): + # loop over fibers + ret = [] + for i in xrange(fromid,toid+1): + #print "Path for fiber ", i + # if voxdim is 1,1,1, we do not have to divide + # convert mm to vox + idx = fib[i].astype('int32') + # retrieve labels along the fiber + fiblabels = sd[idx[:,0],idx[:,1],idx[:,2]] +# print "Start: ", fiblabels[0] +# print "End: ", fiblabels[-1] +# print "Max inbetween: ###############", fiblabels[1:-1].max() +# print "----" + # number of nonzero elements + #print "Max inbetween: ###############", fiblabels[1:-1] + ret.append(len(np.where( fiblabels[1:-1] != 0.0 )[0])) + return ret + + +def most_select_rois(fib, sd, fromid = 0, toid = 10): + ret = [] + cnt = 0 + for i in xrange(fromid,toid+1): +# print "Path for fiber ", i + # if voxdim is 1,1,1, we do not have to divide + # convert mm to vox + idx = fib[i].astype('int32') + # retrieve labels along the fiber + fiblabels = sd[idx[:,0],idx[:,1],idx[:,2]] +# print "Start: ", fiblabels[0] +# print "End: ", fiblabels[-1] +# print "Max inbetween: ###############", fiblabels[1:-1] +# print "----" + # number of nonzero elements + #print "Max inbetween: ###############", fiblabels[1:-1] + fibinbetween = fiblabels[1:-1] + validx = np.where( fibinbetween != 0.0 )[0] + #print validx + if len(validx) == 0: + cnt += 1 + else: + #print fibinbetween[validx] + ret = ret + fibinbetween[validx].tolist() + print "We counted clean fibers", cnt + return ret + +e=most_select_rois(fib,sd, fromid = 0, toid = fib.shape[0]-1) + +#inf=print_fiblabels(fib, sd, fromid = 0, toid = fib.shape[0]-1) +#plot(inf) + + +
LTS5/connectomeviewer
cf3a9a83b75c123356ba3b73b136b1336d223a0e
Add cortico-cortico CTrack Code Oracle
diff --git a/cviewer/plugins/codeoracle/actions.py b/cviewer/plugins/codeoracle/actions.py index 9d12a75..21bde65 100644 --- a/cviewer/plugins/codeoracle/actions.py +++ b/cviewer/plugins/codeoracle/actions.py @@ -1,321 +1,341 @@ import logging from enthought.io.api import File from enthought.pyface.api import FileDialog, OK from enthought.pyface.action.api import Action from enthought.traits.api import Any from cviewer.plugins.text_editor.editor.text_editor import TextEditor from cviewer.plugins.ui.preference_manager import preference_manager # Logging imports import logging logger = logging.getLogger('root.'+__name__) class NetworkVizTubes(Action): tooltip = "Show 3D Network with Tubes" description = "Show 3D Network with Tubes and colorcoded Nodes" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import threedviz2 import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(threedviz2) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class NetworkReport(Action): tooltip = "Network Report" description = "Network Report" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import reportlab import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(reportlab) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) +class CorticoCortico(Action): + tooltip = "Extract cortico-cortico fibers" + description = "Extract cortico-cortico fibers" + + # The WorkbenchWindow the action is attached to. + window = Any() + + def perform(self, event=None): + + from scripts import corticocortico + + import tempfile + myf = tempfile.mktemp(suffix='.py', prefix='my') + f=open(myf, 'w') + f.write(corticocortico) + f.close() + + self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) + + class NipypeBet(Action): tooltip = "Brain extraction using BET" description = "Brain extraction using BET" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import nipypebet import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nipypebet) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowTracks(Action): tooltip = "Show tracks between two regions" description = "Show tracks between two regions" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import ctrackedge import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(ctrackedge) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class XNATPushPull(Action): tooltip = "Push and pull files from and to XNAT Server" description = "Push and pull files from and to XNAT Server" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import pushpull import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(pushpull) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ComputeNBS(Action): tooltip = "Compute NBS" description = "Compute NBS" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): # from cnetwork_nbs_action import NBSNetworkParameter, NBSMoreParameter from scripts import nbsscript # cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') # # no = NBSNetworkParameter(cfile) # no.edit_traits(kind='livemodal') # # if (len(no.selected1) == 0 or len(no.selected2) == 0): # return # # mo = NBSMoreParameter(cfile, no.selected1[0], no.selected2[0]) # mo.edit_traits(kind='livemodal') # # import datetime as dt # a=dt.datetime.now() # ostr = '%s%s%s' % (a.hour, a.minute, a.second) # if not (len(no.selected1) == 0 or len(no.selected2) == 0): # # if cancel, not create surface # # create a temporary file # import tempfile # myf = tempfile.mktemp(suffix='.py', prefix='my') # f=open(myf, 'w') # f.write(nbsscript % (str(no.selected1), # mo.first_edge_value, # str(no.selected2), # mo.second_edge_value, # mo.THRES, # mo.K, # mo.TAIL, # ostr)) # f.close() # # self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nbsscript) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowNetworks(Action): tooltip = "Create a 3D Network" description = "Create a 3D Network" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import NetworkParameter from scripts import netscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(netscript % (no.netw[no.graph]['name'], no.node_position, no.edge_value, no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ConnectionMatrix(Action): tooltip = "Show connection matrix" description = "Show connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixNetworkParameter from scripts import conmatrix cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrix % (no.netw[no.graph]['name'], no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class SimpleConnectionMatrix(Action): tooltip = "Show simple connection matrix" description = "Show simple connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixEdgeNetworkParameter from scripts import conmatrixpyplot cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixEdgeNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrixpyplot % (no.netw[no.graph]['name'], no.edge_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowSurfaces(Action): """ Open a new file in the text editor """ tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from csurface_action import SurfaceParameter from scripts import surfscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = SurfaceParameter(cfile) so.edit_traits(kind='livemodal') if not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') if so.labels_da[so.labels].has_key('da_idx'): labels = so.labels_da[so.labels]['da_idx'] else: labels = 0 f.write(surfscript % (so.pointset_da[so.pointset]['name'], so.pointset_da[so.pointset]['da_idx'], so.faces_da[so.faces]['name'], so.faces_da[so.faces]['da_idx'], so.labels_da[so.labels]['name'], labels)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowVolumes(Action): """ Open a new file in the text editor """ tooltip = "Create a volume" description = "Create a volume" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cvolume_action import VolumeParameter from scripts import volslice cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = VolumeParameter(cfile) so.edit_traits(kind='livemodal') if True: #not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(volslice % so.volumes[so.myvolume]['name']) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) diff --git a/cviewer/plugins/codeoracle/oracle_action_set.py b/cviewer/plugins/codeoracle/oracle_action_set.py index 3a8a019..adf5635 100644 --- a/cviewer/plugins/codeoracle/oracle_action_set.py +++ b/cviewer/plugins/codeoracle/oracle_action_set.py @@ -1,110 +1,119 @@ """ Action set for the Oracl plugin """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Enthought library imports from enthought.envisage.ui.action.api import Action, Group, Menu, ToolBar from enthought.envisage.ui.workbench.api import WorkbenchActionSet networkrepo = Action( id = "OracleCNetworkReport", class_name = "cviewer.plugins.codeoracle.actions.NetworkReport", name = "Network Report", path = "MenuBar/Code Oracle/Connectome/CNetwork/Analysis" ) xnat_pushpull = Action( id = "OracleXNATPushPull", class_name = "cviewer.plugins.codeoracle.actions.XNATPushPull", name = "XNAT Push and Pull", path = "MenuBar/Code Oracle/Other/XNAT" ) show_surface = Action( id = "OracleCSurface", class_name = "cviewer.plugins.codeoracle.actions.ShowSurfaces", name = "Show Surface", path = "MenuBar/Code Oracle/Connectome/CSurface/Visualization" ) show_volumecre = Action( id = "OracleCVolumeCre", class_name = "cviewer.plugins.codeoracle.actions.ShowVolumes", name = "Volume Creation", path = "MenuBar/Code Oracle/Connectome/CVolume/Visualization" ) show_network = Action( id = "OracleCNetwork3D", class_name = "cviewer.plugins.codeoracle.actions.ShowNetworks", name = "3D Network", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) show_network2 = Action( id = "OracleCNetwork3D2", class_name = "cviewer.plugins.codeoracle.actions.NetworkVizTubes", name = "3D Network (with tubes and node color)", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) connection_matrix = Action( id = "OracleCNetworkMat", class_name = "cviewer.plugins.codeoracle.actions.ConnectionMatrix", name = "Connection Matrix", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) simple_connection_matrix = Action( id = "OracleCNetworkSimpleMat", class_name = "cviewer.plugins.codeoracle.actions.SimpleConnectionMatrix", name = "Simple Connection Matrix", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) compute_nbs = Action( id = "OracleNBS", class_name = "cviewer.plugins.codeoracle.actions.ComputeNBS", name = "Network-based statistic (NBS)", path = "MenuBar/Code Oracle/Statistics" ) show_tracks = Action( id = "OracleShowTracks", class_name = "cviewer.plugins.codeoracle.actions.ShowTracks", name = "Tracks between regions", path = "MenuBar/Code Oracle/Connectome/CTrack/Visualization" ) +cortico_cortico = Action( + id = "OracleCorticoCorticoTracks", + class_name = "cviewer.plugins.codeoracle.actions.CorticoCortico", + name = "Extract cortico-cortico fiber tracks", + path = "MenuBar/Code Oracle/Connectome/CTrack/Analysis" +) + + nipype_bet = Action( id = "OracleNipypeBet", class_name = "cviewer.plugins.codeoracle.actions.NipypeBet", name = "Brain extraction using BET", path = "MenuBar/Code Oracle/Other/Nipype" ) class OracleActionSet(WorkbenchActionSet): """ The actionset for the Oracle plugin """ id = "cviewer.plugins.codeoracle.action_set" actions = [ show_surface, show_network, show_network2, compute_nbs, show_volumecre, connection_matrix, simple_connection_matrix, show_tracks, + cortico_cortico, xnat_pushpull, nipype_bet, networkrepo ] diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index ad4af36..87bdf0e 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,512 +1,785 @@ +corticocortico =''' +""" Extract cortio-cortico fibers from tractography outputs of CMTK, +apply clustering and visualize them. The basic idea is to remove sets of +fibers such as the corpus callosum first, and then inspect various histograms +of start-endpoint-distances, mean curvature etc. and downsample to +incrementally filter out fibers until only cortico-cortico fibers remain. +The remaining fibers are then clustered to yield bundles of cortico-cortical fibers. + +This script shows the outcome of the power of interactively working with +scientific datasets for exploration and parameter estimation. + +Stephan Gerhard, May 2011 """ + +import numpy as np +import nibabel as ni +from os.path import join as j +import os.path as op +import time + +from nibabel import trackvis +import cfflib as cf + +from dipy.tracking import metrics as tm +from dipy.tracking import distances as td +from dipy.io import pickles as pkl +from dipy.tracking.metrics import length, mean_curvature +import dipy.viz.fvtk as fvtk + +from fos import World, Window +from fos.actor.curve import InteractiveCurves + +# Load the relevant data files +# load connectome file object + +con = cfile.obj +# alternatively when loading from Ipython directly with cfflib +# con = cf.load('meta.cml') + +def load_data(con): + + fibobj = con.get_by_name('Final Tractography (freesurferaparc)') + fibobj.load() + fibers = fibobj.get_fibers_as_numpy() + fibershdr = fibers.data[1] + + epmmobj = con.get_by_name('Fiber mean curvature') + + eleobj = con.get_by_name('Final fiber lengths (freesurferaparc)') + eleobj.load() + lenghts = eleobj.data + + emobj = con.get_by_name('Fiber mean curvature') + emobj.load() + meancurv = emobj.data + + print "Compute endpoints [mm] array" + endpoints = np.zeros( (len(fibers), 2, 3), dtype = np.float32 ) + for i in xrange(len(fibers)): + endpoints[i,0,:] = fibers[i][0,:] + endpoints[i,1,:] = fibers[i][-1,:] + + return fibers, fibershdr, lenghts, meancurv, endpoints + +# load stuff, can uncomment for rerunning the script in ipython with +# run -i script.py +fibers, fibershdr, lenghts, meancurv, endpoints = load_data(con) + +# Helper functions + +def compute_start_end_distances(endpoints): + n = endpoints.shape[0] + di = np.zeros( (n, 1) ) + for i in xrange(n): + d = np.abs(endpoints[i,0,:]-endpoints[i,1,:]) + di[i,0] = np.sqrt(np.dot(d,d)) + return di + +def sidx(arr, value): + """ Returns the indices that are smaller or equal to the given array """ + return np.where( arr <= value)[0] + +def randcolarr(arr): + """ Returns a random color for each row in arr """ + return np.random.rand(1,3).repeat(len(arr),axis=0) + +def filterfibers(fibarr, filtarr, lower, upper): + return fibarr[ np.where((filtarr>lower) & (filtarr<upper))[0] ] + +def filterfibersidx(filtarr, lower, upper): + return np.where((filtarr>lower) & (filtarr<upper))[0] + +def filterfibersidxcomplement(filtarr, lower, upper): + return np.where((filtarr<=lower) | (filtarr>=upper))[0] + +def filterhemisphere(endpointsmean, xcut, hemi = 0): + if hemi == 1: + return np.where( (endpointsmean < xcut) )[0] + elif hemi == 2: + return np.where( (endpointsmean > xcut) )[0] + +def filterfibersidx2(filtarr, lower, upper, curvarr, value): + return np.where((filtarr>lower) & (filtarr<upper) & (curvarr >value) )[0] + +def filterccidx(endpoints, xcenterline): + """ Returns the index of all fibers where the start or endpoint + of each fiber is opposite the x centerline """ + return np.where((endpoints[:,0,0]>xcenterline) & (endpoints[:,1,0]<xcenterline))[0] + +def compfilterccidx(endpoints, xcenterline, onlyleft = True): + """ Returns the index of all fibers where the start or endpoint + of each fiber is opposite the x centerline """ + if onlyleft: + return np.where( (((endpoints[:,0,0]>xcenterline) & (endpoints[:,1,0]>xcenterline)) | + ((endpoints[:,0,0]<xcenterline) & (endpoints[:,1,0]<xcenterline))) & + ((endpoints[:,0,0]<xcenterline) & (endpoints[:,1,0]<xcenterline)) )[0] + else: + return np.where( ((endpoints[:,0,0]>xcenterline) & (endpoints[:,1,0]>xcenterline)) | + ((endpoints[:,0,0]<xcenterline) & (endpoints[:,1,0]<xcenterline)) )[0] + +def showfibfvtk(fibarr, colarr, percentage = 100): + fibarr2 = fibarr[::percentage] + colarr2 = colarr[::percentage] + fibarr2list = fibarr2.tolist() + r=fvtk.ren(); + #fvtk.add(r,fvtk.axes()) + r.SetBackground(1, 1, 1) + [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; + fvtk.show(r, title = "Fibers", size = (500,500)) + +def showfibfos(fibarr, colarr, percentage = 100): + fibarr2 = fibarr[::percentage] + colarr2 = colarr[::percentage].astype('f4') + cu = InteractiveCurves(curves = fibarr2.tolist(), colors = colarr2) + w=World() + w.add(cu) + wi = Window(caption="Multi-Modal 1", width = 800, height = 800) + wi.attach(w) + +def preparecolorarray(clustering, number_of_fibers): + colors=np.zeros((number_of_fibers,4)) + for c in clustering: + color=np.random.rand(1,4) + for i in clustering[c]['indices']: + colors[i]=color + colors[:,3] = 1.0 # need alpha channel + return colors + +def angle(x,y): return np.rad2deg(np.arccos(np.dot(x,y)/np.sqrt(np.dot(x,x))/np.sqrt(np.dot(y,y)))) + +def compute_angle_array(tracksobj, downsampling = 3): + n = tracksobj.shape[0] + fiberangles = np.zeros( (n, 1) ) + if downsampling == 3: + for i in xrange(n): + x=tracksobj[i][0]-tracksobj[i][1] + y=tracksobj[i][2]-tracksobj[i][1] + fiberangles[i] = angle(x,y) + return fiberangles + +# start script + +# Compute the distance array +dist = compute_start_end_distances(endpoints) + +# Inspect histogram to find xcenterline +# hist(endpoints[:,0,0],200) +# -> e.g. found x coordinate 103 + +# compute distance mean +distmean = np.mean(endpoints[:,:,0],axis=1) +# noccidx = filterfibersidx(distmean, 70, 104) # good to have cc and few corticospinal +noccidx = filterfibersidxcomplement(distmean, 70, 104) # good to have cc and few corticospinal + +# change hemi parameter to switch hemisphere +onlyleftidx = filterhemisphere(distmean, 84, hemi = 1) + +noccidx = np.intersect1d(noccidx , onlyleftidx) + +# 4. filter out corpous callosum fibers +# noccidx = compfilterccidx(endpoints, 84, False) + +noccfibers = fibers[noccidx] + +# 5. show fibers without cc +#showfibfvtk(noccfibers,randcolarr(noccfibers), 1000) + +# 6. look at distance histogram +#hist(dist,100) + +# 7. compute new distance histogram for fibers without cc +distnocc = compute_start_end_distances(endpoints[noccidx,:,:]) +meancuvnocc = meancurv[noccidx] +#hist(distnocc,100) +#hist(meancuvnocc,100) + +# 8. find short fibers and show them +#shortfibers = noccfibers[filterfibersidx(distnocc, 0, 30)] +#showfibfvtk(shortfibers,randcolarr(shortfibers), 100) + +# using meancurvature +shortfibers = noccfibers[filterfibersidx2(distnocc, 10, 30, meancuvnocc, 0.05)] +#showfibfvtk(shortfibers,randcolarr(shortfibers), 10) + +#shortfibers = noccfibers[filterfibersidx(dist, 8, 40)] +# 120-180: long range +# around 85: some projection, cortico spinal, temporal association +# 8-40: enough U fibers + +# 9. fiber clustering +fiblist = shortfibers.tolist() +print("Downsampling...") +tracks=[tm.downsample(t,3) for t in fiblist] + +# calculate the angle of downsampled fibers +tracksobj=np.array(tracks, dtype=np.object) + +fiberangles = compute_angle_array(tracksobj) + +# filter fibers +fiberangleidx = filterfibersidx(fiberangles, 20, 80) + +# create new short fiber set +shortfibersnew = shortfibers[fiberangleidx] +tracksobjnew = tracksobj[fiberangleidx] + +print("Clustering....") +now=time.clock() +C=td.local_skeleton_clustering(tracksobjnew.tolist(),d_thr=10) +print('Done in %.2f s' % (time.clock()-now,)) + +# 10. prepare color array and show +mycols = preparecolorarray(C, len(shortfibersnew)) +#showfibfvtk(shortfibersnew,mycols, 10) + +#mycols = preparecolorarray(C, len(shortfibers)) +#mycols = randcolarr(shortfibers) +#showfibfvtk(shortfibers,mycols, 50) + +# only show left hemisphere + +# show number of fibers in each bundle histogram +a=np.array([(id,v['N']) for id, v in C.items()]) +idx=np.where(a[:,1] < 100)[0] +allidx = np.arange(tracksobjnew.shape[0]) +for i in idx: + idxremove = C[i]['indices'] + allidx = np.lib.arraysetops.setdiff1d(allidx, C[i]['indices']) + #del C[i] + +shortfibersnew2 = shortfibersnew[allidx] +tracksobjnew2 = tracksobjnew[allidx] +C2=td.local_skeleton_clustering(tracksobjnew2.tolist(),d_thr=9) +mycols2 = preparecolorarray(C2, len(shortfibersnew2)) + +# show with fos +showfibfvtk(shortfibersnew2,mycols2, 10) +#showfibfos(shortfibersnew2,mycols2, 50) +#hist(a,100) + +# use fos to show with bigger sized tubes +""" +percentage=1 +fibarr2 = shortfibersnew2[::percentage] +colarr2 = mycols2[::percentage].astype('f4') +cu = InteractiveCurves(curves = fibarr2.tolist(), colors = colarr2, line_width = 6.0) +w=World() +w.add(cu) +wi = Window(caption="Multi-Modal 1", width = 1200, height = 900, bgcolor = (1,1,1,0)) +wi.attach(w) +# w.delete(cu) +""" +''' + threedviz2 = """ # Modified from NetworkX drawing # https://networkx.lanl.gov/trac/browser/networkx/examples/drawing/mayavi2_spring.py import networkx as nx import numpy as np from enthought.mayavi import mlab # Retrieve NetworkX graph G = cfile.obj.get_by_name("connectome_freesurferaparc").data # Key value on the nodes to transform to scalar value for node coloring node_scalar_key = "dn_correspondence_id" # Network Layouting: 2d circular layout pos=nx.circular_layout(G,dim=2,scale=1) # numpy array of x,y,z positions in sorted node order xyz=np.array([pos[v] for v in sorted(G)]) # adding zero z coordinate xyz = np.hstack( (xyz, np.zeros( (len(xyz), 1) ) ) ) # Network Layouting: 3d spring layout #pos=nx.spring_layout(G,dim=3) # numpy array of x,y,z positions in sorted node order #xyz=np.array([pos[v] for v in sorted(G)]) # If you do not want to apply a layouting algorithm # You can create the xyz array from your node positions # as displayed in Code Oracle "3D Network" # scalar colors scalars = np.zeros( (len(G.nodes()),) ) for i,data in enumerate(G.nodes(data=True)): scalars[i] = float(data[1][node_scalar_key]) mlab.figure(1, bgcolor=(0, 0, 0)) mlab.clf() pts = mlab.points3d(xyz[:,0], xyz[:,1], xyz[:,2], scalars, scale_factor=0.05, scale_mode='none', colormap='Blues', resolution=20) # Defines only the connectivity # You can combine this script with the "3D Network" Code Oracle pts.mlab_source.dataset.lines = np.array(G.edges()) tube = mlab.pipeline.tube(pts, tube_radius=0.008) mlab.pipeline.surface(tube, color=(0.8, 0.8, 0.8)) # You can store the resulting figure programmatically # mlab.savefig('mynetwork.png') """ nipypebet = """ # Prerequisite: # 1. You need to have Nipype installed on your system. You can check this by entering # import nipype # In the IPython console. If it gives an error, you might want to install it from NeuroDebian. # See http://neuro.debian.net/ - Documentation is on http://nipy.sourceforge.net/nipype/ # 2. For this simple brain extraction script, you need to have FSL installed. # Goal: # This script shows how to extract the brain using BET through the Nipype interface. # It is derived from http://nipy.sourceforge.net/nipype/users/dartmouth_workshop_2010.html # As an input, you need a T1-weighted image that as an input to the Nipype node. rawimage = cfile.obj.get_by_name('MYRAWT1IMAGE') # Let's check if the metadata agrees with what is expected (it should say "T1-weighted") print rawimage.dtype # We do not necessarily need to load the connectome object - if the connectome file is extracted # locally. We just need to retrieve the absolute file path rawimage_pwd = rawimage.get_abs_path() # We need the Nipype FSL interface import nipype.interfaces.fsl as fsl # We set the FSL default output type to compressed Nifti-1 fsl.FSLCommand.set_default_output_type('NIFTI_GZ') # We want to store the processed file in the temporary folder for now. fname_out = '/tmp/only_brain.nii.gz' # Now, we run the Nipype BET node, providing the correct input result = fsl.BET(in_file=rawimage_pwd, out_file = fname_out ).run() # We can print the result print result.outputs # To add the processed data file to the currently loaded connectome file, ... #cvol = cf.CVolume(name="BETed brain", src=fname_out, fileformat='Nifti1GZ', dtype='T1-weighted') #cfile.obj.add_connectome_volume(cvol) # Make sure that you save the connectome file if you want to keep the processed file. """ pushpull = """ # Prerequisite: # 1. For this script to run, you need to have PyXNAT installed # on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ # 2. You need to have access to an XNAT server and a project # You can create a login and project here: # http://central.xnat.org/ # http://sandbox.xnat.org/ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server # Hint: # If you plan to retrieve or upload big datasets, it is recommended to run this # script in an external Python shell, as long script executions block the IPython # shell within the Connectome Viewer. # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. # We need to load cfflib import cfflib as cf # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection cf.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT cf.xnat_push( connectome_obj = a, projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. #cf.xnat_pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data labelname = "%s" surface_file_labels = cfile.obj.get_by_name(labelname) # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if labelname == "None": labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Import Numpy import numpy as np # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Final Tractography (freesurferaparc)").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Final fiber labels (freesurferaparc)").data fromid = 8 toid = 10 # Defining some helper functions # ------------------------------ def sidx(arr, fromval, toval): " Returns the indices that are equal to a given value " return np.where( (arr[:,0] == fromval) & (arr[:,1] == toval) )[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromid, toid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.groupstatistics.nbs as nbs # For documentation of Network-based statistic parameters # do in IPython: nbs.compute_nbs? # https://github.com/LTS5/connectomeviewer/blob/master/cviewer/libs/pyconto/groupstatistics/nbs/_nbs.py # Retrieving the data and set parameters # -------------------------------------- # Define the two groups of networks you want to compare, # setting the connectome network name. These objects need # to exist in the loaded connectome file. first = ['FirstNetwork_control', 'SecondNetwork_control'] # The same for the second group: second = ['FirstNetwork_patient', 'SecondNetwork_patient'] # Select the edge value to use for the first group first_edge_value = 'number_of_fibers' # Select the edge value to use for the second group second_edge_value = 'number_of_fibers' # More parameters for threshold (THRESH) # andd the number of # permutations (K) THRESH=3 K=10 # Can be one of 'left', 'equal', 'right' TAIL='left' SHOW_MATRIX = True # Perform task # ------------ # Get the connectome objects for the given connectome network names firstgroup = [cfile.obj.get_by_name(n) for n in first] secondgroup = [cfile.obj.get_by_name(n) for n in second] # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup)
LTS5/connectomeviewer
b0e532267ad2d2ee8e3fb5176b9d2a87840b770b
Fix bug with None View. Thanks to Christian Haselgrove for reporting
diff --git a/cviewer/app.py b/cviewer/app.py index 35582d2..d71df52 100644 --- a/cviewer/app.py +++ b/cviewer/app.py @@ -1,340 +1,340 @@ """ The Connectome Viewer Envisage application with Plugins """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Modified version. Adapted from the MayaVi2 application # Standard library imports import sys import os.path import os # Enthought library imports from enthought.traits.api import (HasTraits, Instance, Int, on_trait_change) from enthought.etsconfig.api import ETSConfig from enthought.logger.api import LogFileHandler, FORMATTER # ConnectomeViewer imports from cviewer.cviewer_workbench_application import CViewerWorkbenchApplication from cviewer.plugins.ui.preference_manager import preference_manager from cviewer.info import version as ver # Logger imports import logging, logging.handlers logger = logging.getLogger('root') logger_envisage = logging.getLogger('enthought.envisage.plugin') logger_ipython = logging.getLogger('enthought.plugins.ipython_shell.view.ipython_shell_view') logger_pyface = logging.getLogger('enthought.pyface.ui.wx.workbench.editor_set_structure_handler') logger_pyfaceview = logging.getLogger('enthought.pyface.workbench.i_view') def setup_logger(logger, fname, stream=True, mode=logging.ERROR): """Setup a log file and the logger. Parameters ---------- fname : string File name the logger should use. stream : bool Add a stream handler. mode : logging type The logging mode of the stream handler. """ if not os.path.isabs(fname): path = os.path.join(ETSConfig.application_data, fname) else: path = fname create_file_handler = True # check if path exists dirname = os.path.dirname(path) if not(os.path.exists(dirname)): try: os.makedirs(dirname) except OSError: #logger.error('Can not create path to store the log file.') create_file_handler = False # check if path is writable if not os.access(dirname, os.W_OK): print "===========================================" print "The application data path is not writable: ", dirname print "Please remove it with:" print "sudo rm -rf " + dirname print "and re-run the Connectome Viewer with:" print "connectomeviewer -v" print "===========================================" raise Exception("PermissionError") # check if files exists, if not open it if not(os.path.exists(path)): # XXX add try catch file = open(path, 'w') file.close() # setting the logging level logger.setLevel(mode) # create formatter formatter = logging.Formatter("%(levelname)s - %(name)s - %(message)s") # old: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" if stream: # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(mode) # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) if create_file_handler: filehandler = logging.handlers.RotatingFileHandler(path, maxBytes=1000000, backupCount=4) filehandler.setLevel(mode) filehandler.setFormatter(formatter) logger.addHandler(filehandler) logger_envisage.addHandler(filehandler) # does this fix the # no handlers could be found for logger "enthought.envisage.plugin" logger_ipython.addHandler(filehandler) logger_pyface.addHandler(filehandler) logger_pyfaceview.addHandler(filehandler) import datetime import sys import platform dt = datetime.datetime.now() outdate = dt.strftime("%A, %d. %B %Y %I:%M%p") logger.info("*"*5) if create_file_handler: logger.info("logfile: %s" % os.path.abspath(path)) logger.info("cviewer version: %s " % ver) # logger.info("cviewer executable: %s " % str(__main__)) logger.info("python executable: %s" % sys.executable) logger.info("python version: %s" % sys.version.replace('\n', '')) logger.info("uname: %s" % ' '.join(platform.uname())) logger.info("distribution: %s" % ' '.join(platform.linux_distribution())) logger.info("execution date and time: %s" % outdate) logger.info("*"*5) def get_non_gui_plugin_classes(): """Get list of basic mayavi plugin classes that do not add any views or actions.""" from enthought.envisage.core_plugin import CorePlugin from enthought.envisage.ui.workbench.workbench_plugin import WorkbenchPlugin from enthought.tvtk.plugins.scene.scene_plugin import ScenePlugin from enthought.mayavi.plugins.mayavi_plugin import MayaviPlugin plugins = [CorePlugin, WorkbenchPlugin, MayaviPlugin, ScenePlugin, ] return plugins def get_non_gui_plugins(): """Get list of basic mayavi plugins that do not add any views or actions.""" return [cls() for cls in get_non_gui_plugin_classes()] def get_plugin_classes(): """Get list of default plugin classes to use for Connectome Viewer.""" # Force the selection of a toolkit: from enthought.traits.ui.api import toolkit toolkit() from enthought.etsconfig.api import ETSConfig try_use_ipython = preference_manager.cviewerui.useipython use_ipython = False if ETSConfig.toolkit == 'wx' and try_use_ipython: try: # If the right versions of IPython, EnvisagePlugins and # Pyface are not installed, this import will fail. from enthought.plugins.ipython_shell.view.ipython_shell_view \ import IPythonShellView use_ipython = True except: pass if use_ipython: from enthought.plugins.ipython_shell.ipython_shell_plugin import \ IPythonShellPlugin PythonShellPlugin = IPythonShellPlugin else: from enthought.plugins.python_shell.python_shell_plugin import PythonShellPlugin from enthought.tvtk.plugins.scene.ui.scene_ui_plugin import SceneUIPlugin from cviewer.plugins.text_editor.text_editor_plugin import TextEditorPlugin plugins = get_non_gui_plugin_classes() plugins.extend([ SceneUIPlugin, TextEditorPlugin, PythonShellPlugin, ]) return plugins def get_plugins(): """Get list of default plugins to use for Mayavi.""" return [cls() for cls in get_plugin_classes()] def get_cviewer_plugins(): """ Get list of Connectome Viewer plugins """ plugins = [] logger.info('Plugins') logger.info('*******') # from cviewer.plugins.cff.cff_plugin import ConnectomeFilePlugin # # add ConnectomeFile plugin # plugins.insert(0, ConnectomeFilePlugin()) # logger.info('Added ConnectomeFilePlugin') from cviewer.plugins.cff2.cff_plugin import ConnectomeFile2Plugin # add ConnectomeFile plugin plugins.insert(0, ConnectomeFile2Plugin()) logger.info('Added ConnectomeFile2Plugin') #from cviewer.plugins.analysis.analysis_ui_plugin import AnalysisUIPlugin # add ConnectomeAnalysis UI plugin #plugins.insert(0, AnalysisUIPlugin()) #logger.info('Added AnalysisUIPlugin') from cviewer.plugins.ui.cviewer_ui_plugin import CViewerUIPlugin # add ConnectomeViewerUserInterface plugin plugins.insert(0, CViewerUIPlugin()) logger.info('Added CViewerUIPlugin') # add Bindings plugin from cviewer.plugins.bindings.bindings_plugin import BindingsPlugin plugins.append(BindingsPlugin()) logger.info('Added BindingsPlugin') # add sLORETA Converter plugin from cviewer.plugins.codeoracle.oracle_plugin import OraclePlugin plugins.append(OraclePlugin()) logger.info('Added Oracle Plugin') # add NBS plugin from cviewer.plugins.nbs.nbs_plugin import NBSPlugin plugins.append(NBSPlugin()) logger.info('Added Network Based Statistics (NBS) Plugin') # add cmp - try: - cmp_works = True - from cviewer.plugins.cmp.cmp_plugin import CMPPlugin - except ImportError: - cmp_works = False - if cmp_works: - plugins.append(CMPPlugin()) - logger.info('Added Connectome Mapper Plugin') + #try: + # cmp_works = True + # from cviewer.plugins.cmp.cmp_plugin import CMPPlugin + # except ImportError: + # cmp_works = False + # if cmp_works: + # plugins.append(CMPPlugin()) + # logger.info('Added Connectome Mapper Plugin') return plugins ########################################################################### # `CViewer` class. ########################################################################### class CViewer(HasTraits): """The Connectome Viewer application class. """ # The main envisage application. application = Instance('enthought.envisage.ui.workbench.api.WorkbenchApplication') # The MayaVi Script instance. script = Instance('enthought.mayavi.plugins.script.Script') # The logging mode. log_mode = Int(logging.ERROR, desc='the logging mode to use') def main(self, argv=None): """The main application is created and launched here. Parameters ---------- argv : list of strings The list of command line arguments. The default is `None` where no command line arguments are parsed. To support command line arguments you can pass `sys.argv[1:]`. log_mode : The logging mode to use. """ # parse any cmd line args. if argv is None: argv = [] self.parse_command_line(argv) # setup logging self.setup_logger() # add all default plugins plugins = get_plugins() # add ConnectomeViewer plugins plugins = get_cviewer_plugins() + plugins # create the application prefs = preference_manager.preferences # create the application object self.application = CViewerWorkbenchApplication(plugins=plugins, preferences=prefs) # start the application. self.application.run() logger.info('We hope you enjoyed using the ConnectomeViewer!') def setup_logger(self): """ Setting up the root logger """ from enthought.etsconfig.api import ETSConfig path = os.path.join(ETSConfig.application_data, 'ch.connectome.viewer', 'cviewer.log') path = os.path.abspath(path) setup_logger(logger, path, mode=self.log_mode) def parse_command_line(self, argv): """Parse command line options. Parameters ---------- - argv : `list` of `strings` The list of command line arguments. """ from optparse import OptionParser usage = "usage: %prog [options]" parser = OptionParser(usage) (options, args) = parser.parse_args(argv) def run(self): """This function is called after the GUI has started. """ pass def main(argv=None): """ Helper to start up the ConnectomeViewer application. """ m = CViewer() m.main(argv) return m
LTS5/connectomeviewer
86d883a3f0ba048b624f054dc7ec3d55b5064f33
Removed obsolete folder in setup.py
diff --git a/cviewer/setup.py b/cviewer/setup.py index c7465bf..c239d11 100644 --- a/cviewer/setup.py +++ b/cviewer/setup.py @@ -1,26 +1,25 @@ import ConfigParser import os ################################################################################ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import system_info config = Configuration('cviewer', parent_package, top_path) # List all packages to be loaded here config.add_subpackage('action') config.add_subpackage('libs') config.add_subpackage('plugins') config.add_subpackage('resources') # necessary when in data_dir? - config.add_subpackage('sources') config.add_subpackage('visualization') # List all data directories to be loaded here config.add_data_dir('resources') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(top_path='').todict()) \ No newline at end of file
LTS5/connectomeviewer
58815a607efcab07e8f231949a4c8435ca9af4ec
Fix setup.py import
diff --git a/cviewer/plugins/setup.py b/cviewer/plugins/setup.py index 93aa534..f96a82a 100644 --- a/cviewer/plugins/setup.py +++ b/cviewer/plugins/setup.py @@ -1,23 +1,20 @@ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('plugins', parent_package, top_path) config.add_subpackage('bindings') config.add_subpackage('cff2') config.add_subpackage('codeoracle') - config.add_subpackage('sloreta') - config.add_subpackage('dipy') config.add_subpackage('text_editor') config.add_subpackage('ui') config.add_subpackage('nbs') - config.add_subpackage('sloreta') config.add_subpackage('cmp') config.add_data_files('ui/preferences.ini') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(top_path='').todict())
LTS5/connectomeviewer
d83f1fe0e5eeaff1ad69917e921eb77a1613eb94
Fix of no edge value network
diff --git a/cviewer/plugins/codeoracle/cnetwork_action.py b/cviewer/plugins/codeoracle/cnetwork_action.py index f2bd088..d43a2fe 100644 --- a/cviewer/plugins/codeoracle/cnetwork_action.py +++ b/cviewer/plugins/codeoracle/cnetwork_action.py @@ -1,163 +1,164 @@ from enthought.traits.api import Code, Button, Int, on_trait_change, Any, HasTraits,List, Str, Enum, Instance, Bool from enthought.traits.ui.api import (View, Item, Group, HGroup, CodeEditor, spring, Handler, EnumEditor) from cviewer.plugins.cff2.cnetwork import CNetwork class MatrixNetworkParameter(HasTraits): view = View( Item('graph', label = "Graph"), Item('node_label', label="Node Label"), id='cviewer.plugins.codeoracle.matrixnetworkparameter', buttons=['OK'], resizable=True, title = "Connection Matrix Generator Script" ) def _graph_changed(self, value): self.remove_trait("node_label") - self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) + self.add_trait('node_label', Enum(self.netw[value]['lab']) ) def __init__(self, cfile, **traits): super(MatrixNetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.nodes_iter(data=True) n, dn = a.next() lab = [] for k in dn.keys(): if 'name' in k or 'label' in k: lab.append(k) if len(lab) == 0: lab = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] - self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) + self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) class MatrixEdgeNetworkParameter(HasTraits): view = View( Item('graph', label = "Graph"), Item('edge_label', label="Edge Label"), id='cviewer.plugins.codeoracle.matrixnetworkparameter', buttons=['OK'], resizable=True, title = "Connection Matrix Generator Script" ) def _graph_changed(self, value): self.remove_trait("edge_label") - self.add_trait('edge_label', Enum(self.netw[firstk]['lab']) ) + self.add_trait('edge_label', Enum(self.netw[value]['lab']) ) def __init__(self, cfile, **traits): super(MatrixEdgeNetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.edges_iter(data=True) u,v, dn = a.next() lab = [] for k in dn.keys(): if not k in lab: lab.append(k) if len(lab) == 0: lab = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('edge_label', Enum(self.netw[firstk]['lab']) ) class NetworkParameter(HasTraits): engine = Enum("Mayavi", ["Mayavi"]) view = View( Item('engine', label = "Engine"), Item('graph', label = "Graph"), Item('node_position', label = "Node Positions"), Item('edge_value', label="Edge Value"), Item('node_label', label="Node Label"), id='cviewer.plugins.codeoracle.networkparameter', buttons=['OK'], resizable=True, title = "3D Network Generator Script" ) def _graph_changed(self, value): self.remove_trait("node_position") self.remove_trait("edge_value") self.remove_trait("node_label") self.add_trait('node_position', Enum(self.netw[value]['pos']) ) + # fixme: does not update the edge value (e.g. when none) self.add_trait('edge_value', Enum(self.netw[value]['ev']) ) - self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) + self.add_trait('node_label', Enum(self.netw[value]['lab']) ) def __init__(self, cfile, **traits): super(NetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.nodes_iter(data=True) n, dn = a.next() npos = [] lab = [] for k in dn.keys(): if 'position' in k or 'pos' in k or 'location' in k: npos.append(k) if 'name' in k or 'label' in k: lab.append(k) if len(npos) == 0: npos = ["None"] if len(lab) == 0: lab = ["None"] a=cobj.obj.data.edges_iter(data=True) if len(cobj.obj.data.edges()) == 0: ev = ["None"] else: e1, e2, de = a.next() ev = [] for k in de.keys(): if isinstance(de[k], float) or isinstance(de[k], int): ev.append(k) if len(ev) == 0: ev = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'ev' : ev, 'pos' : npos, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'ev' : "None", 'pos' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('node_position', Enum(self.netw[firstk]['pos']) ) self.add_trait('edge_value', Enum(self.netw[firstk]['ev']) ) self.add_trait('node_label', Enum(self.netw[firstk]['lab']) )
LTS5/connectomeviewer
6862e30f09ce2d5c1cd19734d4b7d627a6f5d075
Fix for no edges network in code oracle
diff --git a/cviewer/plugins/codeoracle/cnetwork_action.py b/cviewer/plugins/codeoracle/cnetwork_action.py index 7253cab..f2bd088 100644 --- a/cviewer/plugins/codeoracle/cnetwork_action.py +++ b/cviewer/plugins/codeoracle/cnetwork_action.py @@ -1,163 +1,163 @@ from enthought.traits.api import Code, Button, Int, on_trait_change, Any, HasTraits,List, Str, Enum, Instance, Bool from enthought.traits.ui.api import (View, Item, Group, HGroup, CodeEditor, spring, Handler, EnumEditor) from cviewer.plugins.cff2.cnetwork import CNetwork class MatrixNetworkParameter(HasTraits): view = View( Item('graph', label = "Graph"), Item('node_label', label="Node Label"), id='cviewer.plugins.codeoracle.matrixnetworkparameter', buttons=['OK'], resizable=True, title = "Connection Matrix Generator Script" ) def _graph_changed(self, value): self.remove_trait("node_label") self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) def __init__(self, cfile, **traits): super(MatrixNetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.nodes_iter(data=True) n, dn = a.next() lab = [] for k in dn.keys(): if 'name' in k or 'label' in k: lab.append(k) if len(lab) == 0: lab = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) class MatrixEdgeNetworkParameter(HasTraits): view = View( Item('graph', label = "Graph"), Item('edge_label', label="Edge Label"), id='cviewer.plugins.codeoracle.matrixnetworkparameter', - buttons=['OK'], + buttons=['OK'], resizable=True, title = "Connection Matrix Generator Script" ) def _graph_changed(self, value): self.remove_trait("edge_label") self.add_trait('edge_label', Enum(self.netw[firstk]['lab']) ) def __init__(self, cfile, **traits): super(MatrixEdgeNetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.edges_iter(data=True) u,v, dn = a.next() lab = [] for k in dn.keys(): if not k in lab: lab.append(k) if len(lab) == 0: lab = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('edge_label', Enum(self.netw[firstk]['lab']) ) class NetworkParameter(HasTraits): engine = Enum("Mayavi", ["Mayavi"]) view = View( Item('engine', label = "Engine"), Item('graph', label = "Graph"), Item('node_position', label = "Node Positions"), Item('edge_value', label="Edge Value"), Item('node_label', label="Node Label"), id='cviewer.plugins.codeoracle.networkparameter', buttons=['OK'], resizable=True, title = "3D Network Generator Script" ) def _graph_changed(self, value): self.remove_trait("node_position") self.remove_trait("edge_value") self.remove_trait("node_label") self.add_trait('node_position', Enum(self.netw[value]['pos']) ) self.add_trait('edge_value', Enum(self.netw[value]['ev']) ) self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) def __init__(self, cfile, **traits): super(NetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.nodes_iter(data=True) n, dn = a.next() npos = [] lab = [] for k in dn.keys(): if 'position' in k or 'pos' in k or 'location' in k: npos.append(k) if 'name' in k or 'label' in k: lab.append(k) if len(npos) == 0: npos = ["None"] if len(lab) == 0: lab = ["None"] a=cobj.obj.data.edges_iter(data=True) if len(cobj.obj.data.edges()) == 0: - raise Exception("No edges exist in the connectome network") - - e1, e2, de = a.next() - ev = [] - for k in de.keys(): - if isinstance(de[k], float) or isinstance(de[k], int): - ev.append(k) - if len(ev) == 0: ev = ["None"] + else: + e1, e2, de = a.next() + ev = [] + for k in de.keys(): + if isinstance(de[k], float) or isinstance(de[k], int): + ev.append(k) + if len(ev) == 0: + ev = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'ev' : ev, 'pos' : npos, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'ev' : "None", 'pos' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('node_position', Enum(self.netw[firstk]['pos']) ) self.add_trait('edge_value', Enum(self.netw[firstk]['ev']) ) self.add_trait('node_label', Enum(self.netw[firstk]['lab']) )
LTS5/connectomeviewer
4a08fcbf61173d755502ee0b8bb648db510fdc1c
Adding a button to run the script
diff --git a/cviewer/plugins/text_editor/editor/text_editor.py b/cviewer/plugins/text_editor/editor/text_editor.py index 692c494..eff59aa 100644 --- a/cviewer/plugins/text_editor/editor/text_editor.py +++ b/cviewer/plugins/text_editor/editor/text_editor.py @@ -1,234 +1,243 @@ """ A text editor. """ # Standard library imports. from os.path import basename # Enthought library imports. from enthought.pyface.workbench.api import TraitsUIEditor from enthought.pyface.api import FileDialog, CANCEL from enthought.traits.api import Code, Instance from enthought.traits.ui.api import CodeEditor, Group, Item, View from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings -from enthought.traits.ui.menu import NoButtons +from enthought.traits.ui.menu import NoButtons,ApplyButton, OKCancelButtons # Local imports. from text_editor_handler import TextEditorHandler def _id_generator(): """ A generator that returns the next number for untitled files. """ i = 1 while True: yield(i) i += 1 return _id_generator = _id_generator() +from enthought.traits.api import Button class TextEditor(TraitsUIEditor): """ A text editor. """ #### 'TextEditor' interface ############################################### # The key bindings used by the editor. key_bindings = Instance(KeyBindings) # The text being edited. text = Code + # Run + runbut = Button + ########################################################################### # 'IEditor' interface. ########################################################################### + def _runbut_fired(self): + self.run() + def save(self): """ Saves the text to disk. """ # If the file has not yet been saved then prompt for the file name. if len(self.obj.path) == 0: self.save_as() else: f = file(self.obj.path, 'w') f.write(self.text) f.close() # We have just saved the file so we ain't dirty no more! self.dirty = False return def save_as(self): """ Saves the text to disk after prompting for the file name. """ dialog = FileDialog( parent = self.window.control, action = 'save as', default_filename = self.name, wildcard = FileDialog.WILDCARD_PY ) if dialog.open() != CANCEL: # Update the editor. self.id = dialog.path self.name = basename(dialog.path) # Update the resource. self.obj.path = dialog.path # Save it! self.save() return ########################################################################### # 'TraitsUIEditor' interface. ########################################################################### def create_ui(self, parent): """ Creates the traits UI that represents the editor. """ ui = self.edit_traits( parent=parent, view=self._create_traits_ui_view(), kind='subpanel' ) return ui ########################################################################### # 'TextEditor' interface. ########################################################################### def run(self): """ Runs the file as Python. """ # The file must be saved first! self.save() # Execute the code. if len(self.obj.path) > 0: view = self.window.get_view_by_id( 'enthought.plugins.python_shell_view' ) if view is not None: view.execute_command( 'execfile(r"%s")' % self.obj.path, hidden=False ) return def select_line(self, lineno): """ Selects the specified line. """ self.ui.info.text.selected_line = lineno return ########################################################################### # Private interface. ########################################################################### #### Trait initializers ################################################### def _key_bindings_default(self): """ Trait initializer. """ key_bindings = KeyBindings( KeyBinding( binding1 = 'Ctrl-s', description = 'Save the file', method_name = 'save' ), KeyBinding( binding1 = 'Ctrl-r', description = 'Run the file', method_name = 'run' ) ) return key_bindings #### Trait change handlers ################################################ def _obj_changed(self, new): """ Static trait change handler. """ # The path will be the empty string if we are editing a file that has # not yet been saved. if len(new.path) == 0: self.id = self._get_unique_id() self.name = self.id else: self.id = new.path self.name = basename(new.path) f = file(new.path, 'r') self.text = f.read() f.close() return def _text_changed(self, trait_name, old, new): """ Static trait change handler. """ if self.traits_inited(): self.dirty = True return def _dirty_changed(self, dirty): """ Static trait change handler. """ if len(self.obj.path) > 0: if dirty: self.name = basename(self.obj.path) + '*' else: self.name = basename(self.obj.path) return #### Methods ############################################################## def _create_traits_ui_view(self): """ Create the traits UI view used by the editor. fixme: We create the view dynamically to allow the key bindings to be created dynamically (we don't use this just yet, but obviously plugins need to be able to contribute new bindings). """ view = View( Group( Item( 'text', editor=CodeEditor(key_bindings=self.key_bindings) ), + Item('runbut', label = 'Run script...', show_label = False), show_labels = False ), id = 'enthought.envisage.editor.text_editor', handler = TextEditorHandler(), kind = 'live', resizable = True, width = 1.0, height = 1.0, - buttons = NoButtons, + #buttons = NoButtons, + buttons=['OK'], ) return view def _get_unique_id(self, prefix='Untitled '): """ Return a unique id for a new file. """ id = prefix + str(_id_generator.next()) while self.window.get_editor_by_id(id) is not None: id = prefix + str(_id_generator.next()) return id #### EOF ######################################################################
LTS5/connectomeviewer
2f46aae7e943676b44fe6916e18cc5b37153b9e1
Fix copyright
diff --git a/COPYRIGHT b/COPYRIGHT index 8a27dd7..e83ef1f 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,34 +1,27 @@ Copyright (C) 2009-2011, Ecole Polytechnique Fédérale de Lausanne (EPFL) and Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Ecole Polytechnique Fédérale de Lausanne (EPFL) and Hospital Center and University of Lausanne (UNIL-CHUV) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL "Ecole Polytechnique Fédérale de Lausanne (EPFL) and Hospital Center and University of Lausanne (UNIL-CHUV)" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -THIS SOFTWARE IS FOR RESEARCH PURPOSES ONLY AND SHALL NOT BE USED FOR -ANY CLINICAL USE. THIS SOFTWARE HAS NOT BEEN REVIEWED OR APPROVED BY -THE FOOD AND DRUG ADMINISTRATION OR EQUIVALENT AUTHORITY, AND IS FOR -NON-CLINICAL, IRB-APPROVED RESEARCH USE ONLY. IN NO EVENT SHALL DATA -OR IMAGES GENERATED THROUGH THE USE OF THE SOFTWARE BE USED IN THE -PROVISION OR PATIENT CARE. \ No newline at end of file +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
LTS5/connectomeviewer
472e0b0cf3ae82f68885a6bb0a51518db40ab09c
Cleanup
diff --git a/cviewer/cviewer_workbench_application.py b/cviewer/cviewer_workbench_application.py index ff52c67..5595622 100755 --- a/cviewer/cviewer_workbench_application.py +++ b/cviewer/cviewer_workbench_application.py @@ -1,127 +1,128 @@ """ The Connectome Viewer Envisage Workbench Application class """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Standard library imports from enthought.traits.api import Bool # Enthought library import from enthought.envisage.ui.workbench.api import WorkbenchApplication from enthought.pyface.api import AboutDialog, ImageResource, SplashScreen # ConnectomeViewer imports from cviewer.plugins.ui.preference_manager import preference_manager from cviewer.action.common import IMAGE_PATH +from .info import version # Logging imports import logging logger = logging.getLogger('root.'+__name__) class CViewerWorkbenchApplication(WorkbenchApplication): """ The ConnectoneViewer workbench application. """ # Turn this off if you don't want the workbench to start a GUI event loop. start_gui_event_loop = Bool(True, desc='start a GUI event loop') # Create an Envisage application. id = 'ch.connectome.viewer' # Path used to search for images _image_path = [IMAGE_PATH, ] # The icon used on window title bars etc. icon = ImageResource('favicon.ico', search_path=_image_path) # The name of the application (also used on window title bars etc). - name = "Connectome Viewer" + name = "Connectome Viewer " + str(version) ########################################################################### # 'WorkbenchApplication' interface. ########################################################################### def run(self): """ Run the application. This does the following: 1) Starts the application 2) Creates and opens a workbench window 3) Starts the GUI event loop (only if start_gui_event_loop is True) 4) When the event loop terminates, stops the application This particular method is overridden from the parent class to allow the user to not run the gui event loop as would be necessary when the loop is started elsewhere or when run fron IPython. """ # Make sure the GUI has been created (so that, if required, the splash # screen is shown). gui = self.gui # Start the application. if self.start(): # Create and open the first workbench window. window = self.workbench.create_window( position=self.window_position, size=self.window_size ) window.open() # We stop the application when the workbench has exited. #self.workbench.on_trait_change(self._on_workbench_exited, 'exited') # Start the GUI event loop if needed. if self.start_gui_event_loop: # THIS CALL DOES NOT RETURN UNTIL THE GUI IS CLOSED. gui.start_event_loop() return def _about_dialog_default(self): """ Initialize the About Dialog """ #from vtk import vtkVersion #vtk_version = vtkVersion().GetVTKVersion() #'VTK version %s' % (vtk_version), from cviewer.version import version adds = ['Connectome Viewer - Version %s' % ( version ), '', 'Copyright &copy; 2009-2011, Ecole Polytechnique F&eacute;d&eacute;rale de Lausanne (EPFL) and', 'University Hospital Center and University of Lausanne (UNIL-CHUV)', '', 'Author: Stephan Gerhard <em>info [at] connectomics.org</em>', 'Contributors: <em>see README file</em>', '', 'This program comes with ABSOLUTELY NO WARRANTY', 'It is licensed under Modified BSD License', ] about_dialog = AboutDialog( parent = self.workbench.active_window.control, image = ImageResource('cviewer_about.png', search_path=self._image_path), additions = adds, ) return about_dialog def _splash_screen_default(self): """ Initialize the Splash Screen """ if preference_manager.cviewerui.show_splash_screen: splash_screen = SplashScreen( image = ImageResource('cviewer_about.png', search_path=self._image_path), show_log_messages = True, ) else: splash_screen = None return splash_screen
LTS5/connectomeviewer
8744663c9405776461b65e87a86a4625aee7924d
fixing up executable permissions
diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/COPYRIGHT b/COPYRIGHT old mode 100755 new mode 100644 diff --git a/MANIFEST.in b/MANIFEST.in old mode 100755 new mode 100644 diff --git a/README.rst b/README.rst old mode 100755 new mode 100644 diff --git a/build_helpers.py b/build_helpers.py old mode 100755 new mode 100644 diff --git a/cviewer/__init__.py b/cviewer/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/__version__.py b/cviewer/__version__.py old mode 100755 new mode 100644 diff --git a/cviewer/action/__init__.py b/cviewer/action/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/action/common.py b/cviewer/action/common.py old mode 100755 new mode 100644 diff --git a/cviewer/action/help.py b/cviewer/action/help.py old mode 100755 new mode 100644 diff --git a/cviewer/action/load_cff.py b/cviewer/action/load_cff.py old mode 100755 new mode 100644 diff --git a/cviewer/action/run_script.py b/cviewer/action/run_script.py old mode 100755 new mode 100644 diff --git a/cviewer/app.py b/cviewer/app.py old mode 100755 new mode 100644 diff --git a/cviewer/cviewer_workbench_application.py b/cviewer/cviewer_workbench_application.py old mode 100755 new mode 100644 diff --git a/cviewer/libs/pyconto/__init__.py b/cviewer/libs/pyconto/__init__.py old mode 100755 new mode 100644 index 5f19021..2c629fd --- a/cviewer/libs/pyconto/__init__.py +++ b/cviewer/libs/pyconto/__init__.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - def test(level=1, verbosity=1): from numpy.testing import Tester return Tester().test(level, verbosity) diff --git a/cviewer/plugins/__init__.py b/cviewer/plugins/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/bindings/__init__.py b/cviewer/plugins/bindings/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/bindings/bindings_plugin.py b/cviewer/plugins/bindings/bindings_plugin.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/__init__.py b/cviewer/plugins/cff/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/cff_plugin.py b/cviewer/plugins/cff/cff_plugin.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/cfile.py b/cviewer/plugins/cff/cfile.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/__init__.py b/cviewer/plugins/cff/interfaces/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/i_cfile.py b/cviewer/plugins/cff/interfaces/i_cfile.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/i_meta.py b/cviewer/plugins/cff/interfaces/i_meta.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/i_network.py b/cviewer/plugins/cff/interfaces/i_network.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/i_surface.py b/cviewer/plugins/cff/interfaces/i_surface.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/i_surface_container.py b/cviewer/plugins/cff/interfaces/i_surface_container.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/i_trackfile.py b/cviewer/plugins/cff/interfaces/i_trackfile.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/interfaces/i_volume.py b/cviewer/plugins/cff/interfaces/i_volume.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/meta.py b/cviewer/plugins/cff/meta.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/network.py b/cviewer/plugins/cff/network.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/surface.py b/cviewer/plugins/cff/surface.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/surface_container.py b/cviewer/plugins/cff/surface_container.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/trackfile.py b/cviewer/plugins/cff/trackfile.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/trackvis/__init__.py b/cviewer/plugins/cff/trackvis/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/trackvis/trackvis.py b/cviewer/plugins/cff/trackvis/trackvis.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/__init__.py b/cviewer/plugins/cff/ui/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/cff_view.py b/cviewer/plugins/cff/ui/cff_view.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/edge_parameters_view.py b/cviewer/plugins/cff/ui/edge_parameters_view.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/network_tree_node.py b/cviewer/plugins/cff/ui/network_tree_node.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/node_view.py b/cviewer/plugins/cff/ui/node_view.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/surface_tree_node.py b/cviewer/plugins/cff/ui/surface_tree_node.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/trackfile_tree_node.py b/cviewer/plugins/cff/ui/trackfile_tree_node.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/ui/volume_tree_node.py b/cviewer/plugins/cff/ui/volume_tree_node.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff/volume.py b/cviewer/plugins/cff/volume.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff2/__init__.py b/cviewer/plugins/cff2/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff2/ui/__init__.py b/cviewer/plugins/cff2/ui/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/cff2/ui/cff_view.py b/cviewer/plugins/cff2/ui/cff_view.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/dipy/__init__.py b/cviewer/plugins/dipy/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/dipy/dipy_plugin.py b/cviewer/plugins/dipy/dipy_plugin.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/sloreta/__init__.py b/cviewer/plugins/sloreta/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/sloreta/converter.py b/cviewer/plugins/sloreta/converter.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/sloreta/sloreta_action_set.py b/cviewer/plugins/sloreta/sloreta_action_set.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/sloreta/sloreta_actions.py b/cviewer/plugins/sloreta/sloreta_actions.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/sloreta/sloreta_plugin.py b/cviewer/plugins/sloreta/sloreta_plugin.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/text_editor/__init__.py b/cviewer/plugins/text_editor/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/text_editor/actions.py b/cviewer/plugins/text_editor/actions.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/text_editor/text_editor_action_set.py b/cviewer/plugins/text_editor/text_editor_action_set.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/text_editor/text_editor_plugin.py b/cviewer/plugins/text_editor/text_editor_plugin.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/ui/__init__.py b/cviewer/plugins/ui/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/ui/cviewer_ui_action_set.py b/cviewer/plugins/ui/cviewer_ui_action_set.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/ui/cviewer_ui_plugin.py b/cviewer/plugins/ui/cviewer_ui_plugin.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/ui/cviewer_ui_preferences_helper.py b/cviewer/plugins/ui/cviewer_ui_preferences_helper.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/ui/cviewer_ui_preferences_page.py b/cviewer/plugins/ui/cviewer_ui_preferences_page.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/ui/preference_manager.py b/cviewer/plugins/ui/preference_manager.py old mode 100755 new mode 100644 diff --git a/cviewer/plugins/ui/preferences.ini b/cviewer/plugins/ui/preferences.ini old mode 100755 new mode 100644 diff --git a/cviewer/resources/MNI-BAs-6239-voxels.csv b/cviewer/resources/MNI-BAs-6239-voxels.csv old mode 100755 new mode 100644 diff --git a/cviewer/resources/__init__.py b/cviewer/resources/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/bug.png b/cviewer/resources/images/bug.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/cdb.png b/cviewer/resources/images/cdb.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/cff-open.png b/cviewer/resources/images/cff-open.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/cff.png b/cviewer/resources/images/cff.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/cviewer_about1.png b/cviewer/resources/images/cviewer_about1.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/cviewer_about2.png b/cviewer/resources/images/cviewer_about2.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/cviewer_about3.png b/cviewer/resources/images/cviewer_about3.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/cviewer_about4.png b/cviewer/resources/images/cviewer_about4.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/face.svg b/cviewer/resources/images/face.svg old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/favicon.ico b/cviewer/resources/images/favicon.ico old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/help-browser.png b/cviewer/resources/images/help-browser.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/home.png b/cviewer/resources/images/home.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/home3.png b/cviewer/resources/images/home3.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/keyboard.png b/cviewer/resources/images/keyboard.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/logos/brain.png b/cviewer/resources/images/logos/brain.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/logos/python.png b/cviewer/resources/images/logos/python.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/logos/swissquality.png b/cviewer/resources/images/logos/swissquality.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/logos/welcome.png b/cviewer/resources/images/logos/welcome.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/surface1.png b/cviewer/resources/images/surface1.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/surface2.png b/cviewer/resources/images/surface2.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/surfacecontainer.png b/cviewer/resources/images/surfacecontainer.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/surfacecontainer1.png b/cviewer/resources/images/surfacecontainer1.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/surfacecontainer2.png b/cviewer/resources/images/surfacecontainer2.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/trackvis.png b/cviewer/resources/images/trackvis.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/visualize.png b/cviewer/resources/images/visualize.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/images/volume1.png b/cviewer/resources/images/volume1.png old mode 100755 new mode 100644 diff --git a/cviewer/resources/keybindings/index.html b/cviewer/resources/keybindings/index.html old mode 100755 new mode 100644 diff --git a/cviewer/run.py b/cviewer/run.py old mode 100755 new mode 100644 diff --git a/cviewer/sources/__init__.py b/cviewer/sources/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/sources/datasource_manager.py b/cviewer/sources/datasource_manager.py old mode 100755 new mode 100644 diff --git a/cviewer/version.py b/cviewer/version.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/__init__.py b/cviewer/visualization/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/matrix/__init__.py b/cviewer/visualization/matrix/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/matrix/cmatrix_viewer.py b/cviewer/visualization/matrix/cmatrix_viewer.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/matrix/matrix_viewer_old.py b/cviewer/visualization/matrix/matrix_viewer_old.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/node_picker.py b/cviewer/visualization/node_picker.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/render_volume.py b/cviewer/visualization/render_volume.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/volume/__init__.py b/cviewer/visualization/volume/__init__.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/volume/thread_volslice.py b/cviewer/visualization/volume/thread_volslice.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/volume/volume_slicer.py b/cviewer/visualization/volume/volume_slicer.py old mode 100755 new mode 100644 diff --git a/cviewer/visualization/volume/volume_slicer_advanced.py b/cviewer/visualization/volume/volume_slicer_advanced.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/Makefile b/doc/doc2/source/Makefile old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/CFFmodel_legacy/connectome.xsd b/doc/doc2/source/_static/CFFmodel_legacy/connectome.xsd old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/CFFmodel_legacy/connectome_v1.xsd b/doc/doc2/source/_static/CFFmodel_legacy/connectome_v1.xsd old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/CFFmodel_legacy/graphml+xlink+gifti.xsd b/doc/doc2/source/_static/CFFmodel_legacy/graphml+xlink+gifti.xsd old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/basic.css b/doc/doc2/source/_static/basic.css old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cdb_prefs.png b/doc/doc2/source/_static/cdb_prefs.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cdbplugin.png b/doc/doc2/source/_static/cdbplugin.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cff/fibers.png b/doc/doc2/source/_static/cff/fibers.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cff/fibers.resized.png b/doc/doc2/source/_static/cff/fibers.resized.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cff/graph.png b/doc/doc2/source/_static/cff/graph.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cff/graph.resized.png b/doc/doc2/source/_static/cff/graph.resized.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cff/surface.png b/doc/doc2/source/_static/cff/surface.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cff/surface.resized.png b/doc/doc2/source/_static/cff/surface.resized.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cff/volume.png b/doc/doc2/source/_static/cff/volume.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/contents.png b/doc/doc2/source/_static/contents.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cviewer_about3.png b/doc/doc2/source/_static/cviewer_about3.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cviewerlogo.png b/doc/doc2/source/_static/cviewerlogo.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/cviewerlogo2.jpg b/doc/doc2/source/_static/cviewerlogo2.jpg old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/dipy_result.png b/doc/doc2/source/_static/dipy_result.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/doctools.js b/doc/doc2/source/_static/doctools.js old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/file.png b/doc/doc2/source/_static/file.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/jquery.js b/doc/doc2/source/_static/jquery.js old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/keybindings.html b/doc/doc2/source/_static/keybindings.html old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/minus.png b/doc/doc2/source/_static/minus.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/navigation.png b/doc/doc2/source/_static/navigation.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/nice_first_dipy_segmentation_small.png b/doc/doc2/source/_static/nice_first_dipy_segmentation_small.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/nipy.css b/doc/doc2/source/_static/nipy.css old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/plus.png b/doc/doc2/source/_static/plus.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/pygments.css b/doc/doc2/source/_static/pygments.css old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/searchtools.js b/doc/doc2/source/_static/searchtools.js old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/sloreta_conv.png b/doc/doc2/source/_static/sloreta_conv.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/sloreta_conv2.png b/doc/doc2/source/_static/sloreta_conv2.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/sloreta_conv3.png b/doc/doc2/source/_static/sloreta_conv3.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/sphinxdoc.css b/doc/doc2/source/_static/sphinxdoc.css old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/trackvis_in_view.png b/doc/doc2/source/_static/trackvis_in_view.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_static/tut_graphlayout1.png b/doc/doc2/source/_static/tut_graphlayout1.png old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_templates/indexsidebar.html b/doc/doc2/source/_templates/indexsidebar.html old mode 100755 new mode 100644 diff --git a/doc/doc2/source/_templates/layout.html b/doc/doc2/source/_templates/layout.html old mode 100755 new mode 100644 diff --git a/doc/doc2/source/about.rst b/doc/doc2/source/about.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/conf.py b/doc/doc2/source/conf.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/index.rst b/doc/doc2/source/index.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/license.rst b/doc/doc2/source/license.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/links.rst b/doc/doc2/source/links.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/links_names.txt b/doc/doc2/source/links_names.txt old mode 100755 new mode 100644 diff --git a/doc/doc2/source/plugins.rst b/doc/doc2/source/plugins.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/publications.rst b/doc/doc2/source/publications.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/README.txt b/doc/doc2/source/sphinxext/README.txt old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/autosummary.py b/doc/doc2/source/sphinxext/autosummary.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/docscrape.py b/doc/doc2/source/sphinxext/docscrape.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/docscrape_sphinx.py b/doc/doc2/source/sphinxext/docscrape_sphinx.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/inheritance_diagram.py b/doc/doc2/source/sphinxext/inheritance_diagram.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/ipython_console_highlighting.py b/doc/doc2/source/sphinxext/ipython_console_highlighting.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/mathmpl.py b/doc/doc2/source/sphinxext/mathmpl.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/numpydoc.py b/doc/doc2/source/sphinxext/numpydoc.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/only_directives.py b/doc/doc2/source/sphinxext/only_directives.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/sphinxext/plot_directive.py b/doc/doc2/source/sphinxext/plot_directive.py old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/connectomefileformat.rst b/doc/doc2/source/users/connectomefileformat.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/index.rst b/doc/doc2/source/users/index.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/installation.rst b/doc/doc2/source/users/installation.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/tutorial.rst b/doc/doc2/source/users/tutorial.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/tutorials/tut_addnet.rst b/doc/doc2/source/users/tutorials/tut_addnet.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/tutorials/tut_basicinter.rst b/doc/doc2/source/users/tutorials/tut_basicinter.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/tutorials/tut_dipy.rst b/doc/doc2/source/users/tutorials/tut_dipy.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/tutorials/tut_graphlayout.rst b/doc/doc2/source/users/tutorials/tut_graphlayout.rst old mode 100755 new mode 100644 diff --git a/doc/doc2/source/users/tutorials/tut_sloretacon.rst b/doc/doc2/source/users/tutorials/tut_sloretacon.rst old mode 100755 new mode 100644 diff --git a/doc/source/_static/CFFmodel_legacy/connectome.xsd b/doc/source/_static/CFFmodel_legacy/connectome.xsd old mode 100755 new mode 100644 diff --git a/doc/source/_static/CFFmodel_legacy/connectome_v1.xsd b/doc/source/_static/CFFmodel_legacy/connectome_v1.xsd old mode 100755 new mode 100644 diff --git a/doc/source/_static/CFFmodel_legacy/graphml+xlink+gifti.xsd b/doc/source/_static/CFFmodel_legacy/graphml+xlink+gifti.xsd old mode 100755 new mode 100644 diff --git a/doc/source/_static/basic.css b/doc/source/_static/basic.css old mode 100755 new mode 100644 diff --git a/doc/source/_static/cdb_prefs.png b/doc/source/_static/cdb_prefs.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cdbplugin.png b/doc/source/_static/cdbplugin.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cff/fibers.png b/doc/source/_static/cff/fibers.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cff/fibers.resized.png b/doc/source/_static/cff/fibers.resized.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cff/graph.png b/doc/source/_static/cff/graph.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cff/graph.resized.png b/doc/source/_static/cff/graph.resized.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cff/surface.png b/doc/source/_static/cff/surface.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cff/surface.resized.png b/doc/source/_static/cff/surface.resized.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cff/volume.png b/doc/source/_static/cff/volume.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/contents.png b/doc/source/_static/contents.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cviewer_about3.png b/doc/source/_static/cviewer_about3.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cviewerlogo.png b/doc/source/_static/cviewerlogo.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/cviewerlogo2.jpg b/doc/source/_static/cviewerlogo2.jpg old mode 100755 new mode 100644 diff --git a/doc/source/_static/dipy_result.png b/doc/source/_static/dipy_result.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/doctools.js b/doc/source/_static/doctools.js old mode 100755 new mode 100644 diff --git a/doc/source/_static/file.png b/doc/source/_static/file.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/jquery.js b/doc/source/_static/jquery.js old mode 100755 new mode 100644 diff --git a/doc/source/_static/keybindings.html b/doc/source/_static/keybindings.html old mode 100755 new mode 100644 diff --git a/doc/source/_static/minus.png b/doc/source/_static/minus.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/navigation.png b/doc/source/_static/navigation.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/nice_first_dipy_segmentation_small.png b/doc/source/_static/nice_first_dipy_segmentation_small.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/nipy.css b/doc/source/_static/nipy.css old mode 100755 new mode 100644 diff --git a/doc/source/_static/plus.png b/doc/source/_static/plus.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/pygments.css b/doc/source/_static/pygments.css old mode 100755 new mode 100644 diff --git a/doc/source/_static/searchtools.js b/doc/source/_static/searchtools.js old mode 100755 new mode 100644 diff --git a/doc/source/_static/sloreta_conv.png b/doc/source/_static/sloreta_conv.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/sloreta_conv2.png b/doc/source/_static/sloreta_conv2.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/sloreta_conv3.png b/doc/source/_static/sloreta_conv3.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/sphinxdoc.css b/doc/source/_static/sphinxdoc.css old mode 100755 new mode 100644 diff --git a/doc/source/_static/trackvis_in_view.png b/doc/source/_static/trackvis_in_view.png old mode 100755 new mode 100644 diff --git a/doc/source/_static/tut_graphlayout1.png b/doc/source/_static/tut_graphlayout1.png old mode 100755 new mode 100644 diff --git a/doc/source/_templates/indexsidebar.html b/doc/source/_templates/indexsidebar.html old mode 100755 new mode 100644 diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html old mode 100755 new mode 100644 diff --git a/doc/source/about.rst b/doc/source/about.rst old mode 100755 new mode 100644 diff --git a/doc/source/conf.py b/doc/source/conf.py old mode 100755 new mode 100644 diff --git a/doc/source/index.rst b/doc/source/index.rst old mode 100755 new mode 100644 diff --git a/doc/source/license.rst b/doc/source/license.rst old mode 100755 new mode 100644 diff --git a/doc/source/links.rst b/doc/source/links.rst old mode 100755 new mode 100644 diff --git a/doc/source/links_names.txt b/doc/source/links_names.txt old mode 100755 new mode 100644 diff --git a/doc/source/plugins.rst b/doc/source/plugins.rst old mode 100755 new mode 100644 diff --git a/doc/source/publications.rst b/doc/source/publications.rst old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/README.txt b/doc/source/sphinxext/README.txt old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/autosummary.py b/doc/source/sphinxext/autosummary.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/docscrape.py b/doc/source/sphinxext/docscrape.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/docscrape_sphinx.py b/doc/source/sphinxext/docscrape_sphinx.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/inheritance_diagram.py b/doc/source/sphinxext/inheritance_diagram.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/ipython_console_highlighting.py b/doc/source/sphinxext/ipython_console_highlighting.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/mathmpl.py b/doc/source/sphinxext/mathmpl.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/numpydoc.py b/doc/source/sphinxext/numpydoc.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/only_directives.py b/doc/source/sphinxext/only_directives.py old mode 100755 new mode 100644 diff --git a/doc/source/sphinxext/plot_directive.py b/doc/source/sphinxext/plot_directive.py old mode 100755 new mode 100644 diff --git a/doc/source/users/connectomefileformat.rst b/doc/source/users/connectomefileformat.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/index.rst b/doc/source/users/index.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/installation.rst b/doc/source/users/installation.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/tutorial.rst b/doc/source/users/tutorial.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/tutorials/tut_addnet.rst b/doc/source/users/tutorials/tut_addnet.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/tutorials/tut_basicinter.rst b/doc/source/users/tutorials/tut_basicinter.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/tutorials/tut_dipy.rst b/doc/source/users/tutorials/tut_dipy.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/tutorials/tut_graphlayout.rst b/doc/source/users/tutorials/tut_graphlayout.rst old mode 100755 new mode 100644 diff --git a/doc/source/users/tutorials/tut_sloretacon.rst b/doc/source/users/tutorials/tut_sloretacon.rst old mode 100755 new mode 100644 diff --git a/examples/sLORETA/A-CorrCoeff-IndVar01.txt b/examples/sLORETA/A-CorrCoeff-IndVar01.txt old mode 100755 new mode 100644 diff --git a/examples/sLORETA/List19e.sxyz b/examples/sLORETA/List19e.sxyz old mode 100755 new mode 100644 diff --git a/examples/sLORETA/List19e_40mm-ROI.slor b/examples/sLORETA/List19e_40mm-ROI.slor old mode 100755 new mode 100644 diff --git a/examples/sLORETA/VP01R1-ROIlaggedCoh.txt b/examples/sLORETA/VP01R1-ROIlaggedCoh.txt old mode 100755 new mode 100644 diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 diff --git a/setup_egg.py b/setup_egg.py old mode 100644 new mode 100755 diff --git a/src/bct-cpp-read-only/density_dir.cpp b/src/bct-cpp-read-only/density_dir.cpp old mode 100755 new mode 100644 diff --git a/src/bct-cpp-read-only/density_und.cpp b/src/bct-cpp-read-only/density_und.cpp old mode 100755 new mode 100644 diff --git a/src/bct-cpp-read-only/strengths_dir.cpp b/src/bct-cpp-read-only/strengths_dir.cpp old mode 100755 new mode 100644 diff --git a/src/bct-cpp-read-only/strengths_und.cpp b/src/bct-cpp-read-only/strengths_und.cpp old mode 100755 new mode 100644
LTS5/connectomeviewer
e9560139dce73508e4dbc83b2a1374fbd6d8cb2d
Adding another CNetwork viz script
diff --git a/cviewer/plugins/codeoracle/actions.py b/cviewer/plugins/codeoracle/actions.py index c03426e..9d12a75 100644 --- a/cviewer/plugins/codeoracle/actions.py +++ b/cviewer/plugins/codeoracle/actions.py @@ -1,302 +1,321 @@ import logging from enthought.io.api import File from enthought.pyface.api import FileDialog, OK from enthought.pyface.action.api import Action from enthought.traits.api import Any from cviewer.plugins.text_editor.editor.text_editor import TextEditor from cviewer.plugins.ui.preference_manager import preference_manager # Logging imports import logging logger = logging.getLogger('root.'+__name__) +class NetworkVizTubes(Action): + tooltip = "Show 3D Network with Tubes" + description = "Show 3D Network with Tubes and colorcoded Nodes" + + # The WorkbenchWindow the action is attached to. + window = Any() + + def perform(self, event=None): + + from scripts import threedviz2 + + import tempfile + myf = tempfile.mktemp(suffix='.py', prefix='my') + f=open(myf, 'w') + f.write(threedviz2) + f.close() + + self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) + class NetworkReport(Action): tooltip = "Network Report" description = "Network Report" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import reportlab import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(reportlab) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class NipypeBet(Action): tooltip = "Brain extraction using BET" description = "Brain extraction using BET" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import nipypebet import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nipypebet) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowTracks(Action): tooltip = "Show tracks between two regions" description = "Show tracks between two regions" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import ctrackedge import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(ctrackedge) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class XNATPushPull(Action): tooltip = "Push and pull files from and to XNAT Server" description = "Push and pull files from and to XNAT Server" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import pushpull import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(pushpull) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ComputeNBS(Action): tooltip = "Compute NBS" description = "Compute NBS" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): # from cnetwork_nbs_action import NBSNetworkParameter, NBSMoreParameter from scripts import nbsscript # cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') # # no = NBSNetworkParameter(cfile) # no.edit_traits(kind='livemodal') # # if (len(no.selected1) == 0 or len(no.selected2) == 0): # return # # mo = NBSMoreParameter(cfile, no.selected1[0], no.selected2[0]) # mo.edit_traits(kind='livemodal') # # import datetime as dt # a=dt.datetime.now() # ostr = '%s%s%s' % (a.hour, a.minute, a.second) # if not (len(no.selected1) == 0 or len(no.selected2) == 0): # # if cancel, not create surface # # create a temporary file # import tempfile # myf = tempfile.mktemp(suffix='.py', prefix='my') # f=open(myf, 'w') # f.write(nbsscript % (str(no.selected1), # mo.first_edge_value, # str(no.selected2), # mo.second_edge_value, # mo.THRES, # mo.K, # mo.TAIL, # ostr)) # f.close() # # self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nbsscript) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowNetworks(Action): - tooltip = "Create a surface" - description = "Create a surface" + tooltip = "Create a 3D Network" + description = "Create a 3D Network" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import NetworkParameter from scripts import netscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(netscript % (no.netw[no.graph]['name'], no.node_position, no.edge_value, no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ConnectionMatrix(Action): tooltip = "Show connection matrix" description = "Show connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixNetworkParameter from scripts import conmatrix cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrix % (no.netw[no.graph]['name'], no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class SimpleConnectionMatrix(Action): tooltip = "Show simple connection matrix" description = "Show simple connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixEdgeNetworkParameter from scripts import conmatrixpyplot cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixEdgeNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrixpyplot % (no.netw[no.graph]['name'], no.edge_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowSurfaces(Action): """ Open a new file in the text editor """ tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from csurface_action import SurfaceParameter from scripts import surfscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = SurfaceParameter(cfile) so.edit_traits(kind='livemodal') if not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') if so.labels_da[so.labels].has_key('da_idx'): labels = so.labels_da[so.labels]['da_idx'] else: labels = 0 f.write(surfscript % (so.pointset_da[so.pointset]['name'], so.pointset_da[so.pointset]['da_idx'], so.faces_da[so.faces]['name'], so.faces_da[so.faces]['da_idx'], so.labels_da[so.labels]['name'], labels)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowVolumes(Action): """ Open a new file in the text editor """ tooltip = "Create a volume" description = "Create a volume" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cvolume_action import VolumeParameter from scripts import volslice cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = VolumeParameter(cfile) so.edit_traits(kind='livemodal') if True: #not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(volslice % so.volumes[so.myvolume]['name']) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) diff --git a/cviewer/plugins/codeoracle/oracle_action_set.py b/cviewer/plugins/codeoracle/oracle_action_set.py index 54d986c..3a8a019 100644 --- a/cviewer/plugins/codeoracle/oracle_action_set.py +++ b/cviewer/plugins/codeoracle/oracle_action_set.py @@ -1,102 +1,110 @@ """ Action set for the Oracl plugin """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Enthought library imports from enthought.envisage.ui.action.api import Action, Group, Menu, ToolBar from enthought.envisage.ui.workbench.api import WorkbenchActionSet networkrepo = Action( id = "OracleCNetworkReport", class_name = "cviewer.plugins.codeoracle.actions.NetworkReport", name = "Network Report", path = "MenuBar/Code Oracle/Connectome/CNetwork/Analysis" ) xnat_pushpull = Action( id = "OracleXNATPushPull", class_name = "cviewer.plugins.codeoracle.actions.XNATPushPull", name = "XNAT Push and Pull", path = "MenuBar/Code Oracle/Other/XNAT" ) show_surface = Action( id = "OracleCSurface", class_name = "cviewer.plugins.codeoracle.actions.ShowSurfaces", name = "Show Surface", path = "MenuBar/Code Oracle/Connectome/CSurface/Visualization" ) show_volumecre = Action( id = "OracleCVolumeCre", class_name = "cviewer.plugins.codeoracle.actions.ShowVolumes", name = "Volume Creation", path = "MenuBar/Code Oracle/Connectome/CVolume/Visualization" ) show_network = Action( id = "OracleCNetwork3D", class_name = "cviewer.plugins.codeoracle.actions.ShowNetworks", name = "3D Network", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) +show_network2 = Action( + id = "OracleCNetwork3D2", + class_name = "cviewer.plugins.codeoracle.actions.NetworkVizTubes", + name = "3D Network (with tubes and node color)", + path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" +) + connection_matrix = Action( id = "OracleCNetworkMat", class_name = "cviewer.plugins.codeoracle.actions.ConnectionMatrix", name = "Connection Matrix", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) simple_connection_matrix = Action( id = "OracleCNetworkSimpleMat", class_name = "cviewer.plugins.codeoracle.actions.SimpleConnectionMatrix", name = "Simple Connection Matrix", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) compute_nbs = Action( id = "OracleNBS", class_name = "cviewer.plugins.codeoracle.actions.ComputeNBS", name = "Network-based statistic (NBS)", path = "MenuBar/Code Oracle/Statistics" ) show_tracks = Action( id = "OracleShowTracks", class_name = "cviewer.plugins.codeoracle.actions.ShowTracks", name = "Tracks between regions", path = "MenuBar/Code Oracle/Connectome/CTrack/Visualization" ) nipype_bet = Action( id = "OracleNipypeBet", class_name = "cviewer.plugins.codeoracle.actions.NipypeBet", name = "Brain extraction using BET", path = "MenuBar/Code Oracle/Other/Nipype" ) class OracleActionSet(WorkbenchActionSet): """ The actionset for the Oracle plugin """ id = "cviewer.plugins.codeoracle.action_set" actions = [ show_surface, show_network, + show_network2, compute_nbs, show_volumecre, connection_matrix, simple_connection_matrix, show_tracks, xnat_pushpull, nipype_bet, networkrepo ] diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index 410e91a..ad4af36 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,512 +1,566 @@ +threedviz2 = """ +# Modified from NetworkX drawing +# https://networkx.lanl.gov/trac/browser/networkx/examples/drawing/mayavi2_spring.py + +import networkx as nx +import numpy as np +from enthought.mayavi import mlab + +# Retrieve NetworkX graph +G = cfile.obj.get_by_name("connectome_freesurferaparc").data + +# Key value on the nodes to transform to scalar value for node coloring +node_scalar_key = "dn_correspondence_id" + +# Network Layouting: 2d circular layout +pos=nx.circular_layout(G,dim=2,scale=1) +# numpy array of x,y,z positions in sorted node order +xyz=np.array([pos[v] for v in sorted(G)]) +# adding zero z coordinate +xyz = np.hstack( (xyz, np.zeros( (len(xyz), 1) ) ) ) + +# Network Layouting: 3d spring layout +#pos=nx.spring_layout(G,dim=3) +# numpy array of x,y,z positions in sorted node order +#xyz=np.array([pos[v] for v in sorted(G)]) + +# If you do not want to apply a layouting algorithm +# You can create the xyz array from your node positions +# as displayed in Code Oracle "3D Network" + +# scalar colors +scalars = np.zeros( (len(G.nodes()),) ) +for i,data in enumerate(G.nodes(data=True)): + scalars[i] = float(data[1][node_scalar_key]) + +mlab.figure(1, bgcolor=(0, 0, 0)) +mlab.clf() + +pts = mlab.points3d(xyz[:,0], xyz[:,1], xyz[:,2], + scalars, + scale_factor=0.05, + scale_mode='none', + colormap='Blues', + resolution=20) + +# Defines only the connectivity +# You can combine this script with the "3D Network" Code Oracle +pts.mlab_source.dataset.lines = np.array(G.edges()) +tube = mlab.pipeline.tube(pts, tube_radius=0.008) +mlab.pipeline.surface(tube, color=(0.8, 0.8, 0.8)) + +# You can store the resulting figure programmatically +# mlab.savefig('mynetwork.png') +""" nipypebet = """ # Prerequisite: # 1. You need to have Nipype installed on your system. You can check this by entering # import nipype # In the IPython console. If it gives an error, you might want to install it from NeuroDebian. # See http://neuro.debian.net/ - Documentation is on http://nipy.sourceforge.net/nipype/ # 2. For this simple brain extraction script, you need to have FSL installed. # Goal: # This script shows how to extract the brain using BET through the Nipype interface. # It is derived from http://nipy.sourceforge.net/nipype/users/dartmouth_workshop_2010.html # As an input, you need a T1-weighted image that as an input to the Nipype node. rawimage = cfile.obj.get_by_name('MYRAWT1IMAGE') # Let's check if the metadata agrees with what is expected (it should say "T1-weighted") print rawimage.dtype # We do not necessarily need to load the connectome object - if the connectome file is extracted # locally. We just need to retrieve the absolute file path rawimage_pwd = rawimage.get_abs_path() # We need the Nipype FSL interface import nipype.interfaces.fsl as fsl # We set the FSL default output type to compressed Nifti-1 fsl.FSLCommand.set_default_output_type('NIFTI_GZ') # We want to store the processed file in the temporary folder for now. fname_out = '/tmp/only_brain.nii.gz' # Now, we run the Nipype BET node, providing the correct input result = fsl.BET(in_file=rawimage_pwd, out_file = fname_out ).run() # We can print the result print result.outputs # To add the processed data file to the currently loaded connectome file, ... #cvol = cf.CVolume(name="BETed brain", src=fname_out, fileformat='Nifti1GZ', dtype='T1-weighted') #cfile.obj.add_connectome_volume(cvol) # Make sure that you save the connectome file if you want to keep the processed file. """ pushpull = """ # Prerequisite: # 1. For this script to run, you need to have PyXNAT installed # on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ # 2. You need to have access to an XNAT server and a project # You can create a login and project here: # http://central.xnat.org/ # http://sandbox.xnat.org/ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server # Hint: # If you plan to retrieve or upload big datasets, it is recommended to run this # script in an external Python shell, as long script executions block the IPython # shell within the Connectome Viewer. # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. # We need to load cfflib import cfflib as cf # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection cf.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT cf.xnat_push( connectome_obj = a, projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. #cf.xnat_pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data labelname = "%s" surface_file_labels = cfile.obj.get_by_name(labelname) # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if labelname == "None": labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Import Numpy import numpy as np # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Final Tractography (freesurferaparc)").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Final fiber labels (freesurferaparc)").data fromid = 8 toid = 10 # Defining some helper functions # ------------------------------ def sidx(arr, fromval, toval): " Returns the indices that are equal to a given value " return np.where( (arr[:,0] == fromval) & (arr[:,1] == toval) )[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromid, toid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.groupstatistics.nbs as nbs # For documentation of Network-based statistic parameters # do in IPython: nbs.compute_nbs? # https://github.com/LTS5/connectomeviewer/blob/master/cviewer/libs/pyconto/groupstatistics/nbs/_nbs.py # Retrieving the data and set parameters # -------------------------------------- # Define the two groups of networks you want to compare, # setting the connectome network name. These objects need # to exist in the loaded connectome file. first = ['FirstNetwork_control', 'SecondNetwork_control'] # The same for the second group: second = ['FirstNetwork_patient', 'SecondNetwork_patient'] # Select the edge value to use for the first group first_edge_value = 'number_of_fibers' # Select the edge value to use for the second group second_edge_value = 'number_of_fibers' # More parameters for threshold (THRESH) # andd the number of # permutations (K) THRESH=3 K=10 # Can be one of 'left', 'equal', 'right' TAIL='left' SHOW_MATRIX = True # Perform task # ------------ # Get the connectome objects for the given connectome network names firstgroup = [cfile.obj.get_by_name(n) for n in first] secondgroup = [cfile.obj.get_by_name(n) for n in second] # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a seperate script PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # Find a date import datetime as dt a=dt.datetime.now() ostr = '%s:%s:%s' % (a.hour, a.minute, a.second) # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s' % ostr, nbsgraph, dtype='NBSResult') cfile.update_children()
LTS5/connectomeviewer
23174828ffc3a32c54427eff673897b9e31cac63
Release Candidate 2.0
diff --git a/cviewer/info.py b/cviewer/info.py index 6a9b73e..1b1d204 100644 --- a/cviewer/info.py +++ b/cviewer/info.py @@ -1,83 +1,83 @@ ''' Release data for ConnectomeViewer This script should do no imports. It only defines variables. ''' -version = '2.0.0-RC1' +version = '2.0.0-RC2' is_release = False long_description = \ """ ConnectomeViewer - A Framework for the Visualization and Analysis of Multi-Modal Multi-Scale Connectome Data in Python The aim of ConnectomeViewer is to produce a platform-independent Python framework for the analysis and visualization of Connectome data using an open development model. The ConnectomeViewer is a extensible, scriptable, pythonic software tool for visualization and analysis in neuroimaging research on many spatial scales. Employing the Connectome File Format, diverse data such as networks, surfaces, volumes, tracks and metadata are handled and integrated. Specifically, we aim to: 1. Provide an open source, mixed language scientific programming framework for rapid development and quantitative analysis 2. Provide a visualization platform to readily visualize multi-modal data for interactive data exploration 3. Allow for enhanced brain connectivity analysis and plotting 4. Provide the Connectome File Format to store a wide range of data types: metadata, networks, surfaces, volumes, fiber tracks, time series 5. Create and maintain a wide base of developers to contribute plugins to this framework. 6. To integrate this framework with software packages in neuroimaging and provide an easily installable bundle. """ # these have to be done per install_requires envisagecore_min_version = '3.1.2' traitsbackendwx_min_version = '3.2.1' envisageplugins_min_version = '3.1.2' enthoughtbase_min_version = '3.0.4' traitsgui_min_version = '3.1.1' chaco_min_version = '3.2.1' lxml_min_version = '2.2.6' pymysql_min_version = '0.2' # these can be done safely traits_min_version = '3.2.0' networkx_min_version = '1.4' mayavi_min_version = '3.3.2' h5py_min_version = '1.2.0' scipy_min_version = '0.5' # for ubuntu 10.04 ### envisagecore_min_version = '3.1.1' # python-envisagecore envisageplugins_min_version = '3.1.1' # python-envisageplugins traitsbackendwx_min_version = '3.2.0' # python-traitsbackendwx traitsbackendqt_min_version = '3.2.0' # python-traitsbackendqt traitsgui_min_version = '3.1.0' # python-traitsgui traits_min_version = '3.2.0' # python-traits python_enthought_traits_ui = '3.1.0' # python-enthought-traits-ui enthoughtbase_min_version = '3.0.3' # python-enthoughtbase chaco_min_version = '3.2.0' # python-chaco lxml_min_version = '2.2.4' # python-lxml scipy_min_version = '0.5' # python-scipy (0.7.0) numpy_min_version = '1.3.0' # python-numpy h5py_min_version = '1.2.1' # python-h5py mayavi_min_version = '3.3.0' # mayavi2 # python-apptools (3.3.0), python-enthought-traits (3.1.0), python-numpy (1.3.0) # outdated or not available pymysql_min_version = '0.2' # not available networkx_min_version = '1.4' # python-network (0.99) diff --git a/doc/source/conf.py b/doc/source/conf.py index 23767c9..c71a73b 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,214 +1,214 @@ # -*- coding: utf-8 -*- # # sampledoc documentation build configuration file, created by # sphinx-quickstart on Tue Jun 3 12:40:24 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're removed automatically). # # All configuration values have a default value; values that are commented out # serve to show the default value. import sys, os # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. sys.path.append(os.path.abspath('sphinxext')) # Import support for ipython console session syntax highlighting (lives # in the sphinxext directory defined above) import ipython_console_highlighting # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'ipython_console_highlighting', 'inheritance_diagram', 'numpydoc', 'autosummary'] # Matplotlib sphinx extensions # ---------------------------- # Currently we depend on some matplotlib extentions that are only in # the trunk, so we've added copies of these files to fall back on, # since most people install releases. Once theses extensions have # been released for a while we should remove this hack. I'm assuming # any modifications to these extensions will be done upstream in # matplotlib! The matplotlib trunk will have more bug fixes and # feature updates so we'll try to use that one first. try: import matplotlib.sphinxext extensions.append('matplotlib.sphinxext.mathmpl') extensions.append('matplotlib.sphinxext.only_directives') extensions.append('matplotlib.sphinxext.plot_directive') except ImportError: extensions.append('mathmpl') extensions.append('only_directives') extensions.append('plot_directive') # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General substitutions. project = 'Connectome Viewer' copyright = '2010, EPFL & UNIL-CHUV. Author: Stephan Gerhard' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. # # The short X.Y version. -version = '2.0.0 RC1' +version = '2.0.0 RC2' # The full version, including alpha/beta/rc tags. -release = '2.0.0 RC1' +release = '2.0.0 RC2' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. unused_docs = [] # List of directories, relative to source directories, that shouldn't # be searched for source files. exclude_trees = ['www'] # what to put into API doc (just class doc, just init, or both) autoclass_content = 'class' # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # Options for HTML output # ----------------------- # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. #html_style = 'nipy.css' # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". html_title = 'ConnectomeViewer Documentation' # The name of an image file (within the static path) to place at the top of # the sidebar. #html_logo = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Content template for the index page. html_index = 'www/index.html' # Custom sidebar templates, maps document names to template names. html_sidebars = {'index': 'indexsidebar.html'} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If true, the reST sources are included in the HTML build as _sources/<name>. html_copy_source = False # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' html_theme = 'sphinxdoc' # Output file base name for HTML help builder. htmlhelp_basename = project # Options for LaTeX output # ------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class # [howto/manual]). latex_documents = [ ('contents', 'cviewer.tex', 'ConnectomeViewer Documentation', ur'Multi-Modal, Multi-Level pythonic Network Visualization and Analysis','manual'), ## ('devel/index', 'nipy_devel.tex', ## 'Neuroimaging in Python Developer Documentation', ## ur'The Neuroimaging in Python documentation team.','manual'), ## ('api/index', 'nipy_ref.tex', ## 'Neuroimaging in Python Reference Guide', ## ur'The Neuroimaging in Python documentation team.','manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. latex_use_parts = True # Additional stuff for the LaTeX preamble. latex_preamble = """ \usepackage{amsmath} \usepackage{amssymb} % Uncomment these two if needed %\usepackage{amsfonts} %\usepackage{txfonts} """ # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. latex_use_modindex = True diff --git a/doc/source/users/installation.rst b/doc/source/users/installation.rst index 9ee9008..7494f45 100755 --- a/doc/source/users/installation.rst +++ b/doc/source/users/installation.rst @@ -1,71 +1,69 @@ .. _installation: ========================== Download and Installation ========================== .. warning:: This content is soon deprecated and replaced by an easier installation procedure using Neuro Debian. Step-by-Step Guide for Installation on Ubuntu/Debian ---------------------------------------------------- The Python Version 2.6 is needed minimally. Add the NeuroDebian repository to your system. The steps are explained here:: firefox http://neuro.debian.net/ There are many dependencies to install (the exact package names might change slightly if using Ubuntu version smaller than 10.10):: sudo apt-get update sudo apt-get install git-core python-setuptools libvtk5.4 python-vtk python-numpy python-wxversion python2.6-dev g++ swig python-configobj glutg3 glutg3-dev libxtst-dev ipython python-lxml sudo apt-get install python-matplotlib python-qscintilla2 gcc scons python-xlib pyqt4-dev-tools python-scipy python-pyrex python-all-dev python-dicom sudo apt-get install libxt-dev libglu1-mesa-dev python-pip wget python-wxgtk2.8 python-h5py python-envisagecore python-envisageplugins python-traitsbackendwx python-traitsbackendqt python-traitsgui python-enthoughtbase python-chaco python-lxml python-h5py mayavi2 python-tables python-tables-doc python-apptools python-pip python-wxtools python-sphinx Upgrade NetworkX:: sudo pip install --upgrade networkx Install cfflib:: sudo pip install cfflib Install Nibabel (from the NeuroDebian repository):: sudo apt-get install python-nibabel python-nibabel-doc python-dicom -.. note:: Currently, NeuroDebian include Nibabel version 1.0.2, but 1.1.0 is required for the Connectome Viewer 2.0 RC1. The new Nibabel version will be available in a few days. +.. note:: Currently, NeuroDebian include Nibabel version 1.0.2, but 1.1.0 is required for the Connectome Viewer 2.0 RC2. The new Nibabel version will be available in a few days. You can install the development version in the meanwhile. -Nibabel 1.1.0 development version:: +Nibabel 1.1.0 version:: - git clone https://github.com/nipy/nibabel.git - cd nibabel - sudo python setup.py install + sudo easy_install nibabel Download the `Connectome Viewer source code <http://www.cmtk.org/users/download>`_, extract and install it:: tar xzf LTS5-....tar.gz cd LTS5-connectomeviewer-..../ sudo python setup.py install You should now be able to start with:: connectomeviewer -v .. On first startup, a directory is created in your home folder (*$HOME/.enthought/ch.connectome.viewer*) to store the logfile and window settings. If the first startup was as root, you do not have write permission in this folder, leading to a *Permission Error*. Simply remove this folder (*sudo rm -rf $HOME/.enthought/ch.connectome.viewer/*) and start ConnectomeViewer again as user. .. Step-by-Step Guide for Installation on Windows .. ---------------------------------------------- .. * Install the recent EPD_ (License: Academic, Option: Install for all users). It is free for academic purposes, see button at the bottom of the page. .. * To access HDF5 files, we need H5Py, you `install it from here <http://code.google.com/p/h5py/downloads/list>`_ .. * Install ConnectomeViewer executable `(from the download page) <http://www.connectomeviewer.org/users/download>`_ .. * Either select the ConnectomeViewer from the Startmenu (Connectome->ConnectomeViewer) or open a Command Prompt and type:: .. connectomeviewer.py -v .. * You can `download example datasets <http://connectomeviewer.org/viewer/datasets>`_. Make sure that they end with *.cff* (however they are regular ZIP archives). .. If you encounter any problems, please send an email to `info AT connectomics.org <mailto:infoATconnectomics.org>`_! .. include:: ../links_names.txt Installation on Other Platforms ------------------------------- .. note:: Currently, the support for a Windows installer has been dropped. But you can install `VirtualBox <http://www.virtualbox.org/wiki/Downloads>`_ and a recent `Ubuntu <http://www.ubuntu.com/desktop/get-ubuntu/download>`_ and then carry out the steps above.
LTS5/connectomeviewer
d3a8d3ea618acce4375f49ca89349590688ccf65
Updating cfflib XNAT API in Code Oracle
diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index a4e8c8a..410e91a 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,599 +1,602 @@ nipypebet = """ # Prerequisite: # 1. You need to have Nipype installed on your system. You can check this by entering # import nipype # In the IPython console. If it gives an error, you might want to install it from NeuroDebian. # See http://neuro.debian.net/ - Documentation is on http://nipy.sourceforge.net/nipype/ # 2. For this simple brain extraction script, you need to have FSL installed. # Goal: # This script shows how to extract the brain using BET through the Nipype interface. # It is derived from http://nipy.sourceforge.net/nipype/users/dartmouth_workshop_2010.html # As an input, you need a T1-weighted image that as an input to the Nipype node. rawimage = cfile.obj.get_by_name('MYRAWT1IMAGE') # Let's check if the metadata agrees with what is expected (it should say "T1-weighted") print rawimage.dtype # We do not necessarily need to load the connectome object - if the connectome file is extracted # locally. We just need to retrieve the absolute file path rawimage_pwd = rawimage.get_abs_path() # We need the Nipype FSL interface import nipype.interfaces.fsl as fsl # We set the FSL default output type to compressed Nifti-1 fsl.FSLCommand.set_default_output_type('NIFTI_GZ') # We want to store the processed file in the temporary folder for now. fname_out = '/tmp/only_brain.nii.gz' # Now, we run the Nipype BET node, providing the correct input result = fsl.BET(in_file=rawimage_pwd, out_file = fname_out ).run() # We can print the result print result.outputs # To add the processed data file to the currently loaded connectome file, ... #cvol = cf.CVolume(name="BETed brain", src=fname_out, fileformat='Nifti1GZ', dtype='T1-weighted') #cfile.obj.add_connectome_volume(cvol) # Make sure that you save the connectome file if you want to keep the processed file. """ pushpull = """ # Prerequisite: # 1. For this script to run, you need to have PyXNAT installed # on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ # 2. You need to have access to an XNAT server and a project # You can create a login and project here: # http://central.xnat.org/ # http://sandbox.xnat.org/ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server # Hint: # If you plan to retrieve or upload big datasets, it is recommended to run this # script in an external Python shell, as long script executions block the IPython # shell within the Connectome Viewer. # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. +# We need to load cfflib +import cfflib as cf + # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection -a.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) +cf.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT -a.push( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) +cf.xnat_push( connectome_obj = a, projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. -#a.pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') +#cf.xnat_pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data labelname = "%s" surface_file_labels = cfile.obj.get_by_name(labelname) # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if labelname == "None": labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Import Numpy import numpy as np # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Final Tractography (freesurferaparc)").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Final fiber labels (freesurferaparc)").data fromid = 8 toid = 10 # Defining some helper functions # ------------------------------ def sidx(arr, fromval, toval): " Returns the indices that are equal to a given value " return np.where( (arr[:,0] == fromval) & (arr[:,1] == toval) )[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromid, toid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.groupstatistics.nbs as nbs # For documentation of Network-based statistic parameters # do in IPython: nbs.compute_nbs? # https://github.com/LTS5/connectomeviewer/blob/master/cviewer/libs/pyconto/groupstatistics/nbs/_nbs.py # Retrieving the data and set parameters # -------------------------------------- # Define the two groups of networks you want to compare, # setting the connectome network name. These objects need # to exist in the loaded connectome file. first = ['FirstNetwork_control', 'SecondNetwork_control'] # The same for the second group: second = ['FirstNetwork_patient', 'SecondNetwork_patient'] # Select the edge value to use for the first group first_edge_value = 'number_of_fibers' # Select the edge value to use for the second group second_edge_value = 'number_of_fibers' # More parameters for threshold (THRESH) # andd the number of # permutations (K) THRESH=3 K=10 # Can be one of 'left', 'equal', 'right' TAIL='left' SHOW_MATRIX = True # Perform task # ------------ # Get the connectome objects for the given connectome network names firstgroup = [cfile.obj.get_by_name(n) for n in first] secondgroup = [cfile.obj.get_by_name(n) for n in second] # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a seperate script PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # Find a date import datetime as dt a=dt.datetime.now() ostr = '%s:%s:%s' % (a.hour, a.minute, a.second) # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s' % ostr, nbsgraph, dtype='NBSResult') cfile.update_children() """ volrendering = """ from enthought.mayavi import mlab import numpy as np data=np.random.random( (10,10,10)) min = data.min() max = data.max() source=mlab.pipeline.scalar_field(data) vol = mlab.pipeline.volume(source, vmin=min+0.65*(max-min), vmax=min+0.9*(max-min)) """ volslice = """ # Import Mayavi mlab interface from enthought.mayavi import mlab # Import NumPy import numpy as np # Retrieving the data and set parameters # -------------------------------------- # the CVolume name volname="%s" # Retrieve volume data (as Nibabel Image) voldat = cfile.obj.get_by_name(volname).data # Retrieve the image data data = voldat.get_data() # Retrieve the affine affine = voldat.get_affine() center = np.r_[0, 0, 0, 1] # Perform task # ------------ # create A ScalarField with spacing and origin from the affine data_src = mlab.pipeline.scalar_field(data) data_src.spacing = np.diag(affine)[:3] data_src.origin = np.dot(affine, center)[:3] # Create an outline mlab.pipeline.outline(data_src) # Create a simple x-aligned image plane widget image_plane_widget = mlab.pipeline.image_plane_widget(data_src, name=volname) image_plane_widget.ipw.plane_orientation = 'x_axes' image_plane_widget.ipw.reslice_interpolate = 'nearest_neighbour' """ reportlab = """ # Credits # http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/ from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import networkx as nx import numpy as np import datetime import tempfile import os.path PAGE_HEIGHT=defaultPageSize[1] styles = getSampleStyleSheet() Title = "Connectome Report for " Elements=[] HeaderStyle = styles["Heading1"] ParaStyle = styles["Normal"] PreStyle = styles["Code"] today = datetime.date.today() tmpdir = tempfile.gettempdir() # Retrieving the data # ------------------- # the network for the reporting net = cfile.obj.get_by_name('connectome_freesurferaparc') net.load() # the edge key de_key = 'number_of_fibers' # output file name fname = os.path.join(tmpdir, 'out.pdf')
LTS5/connectomeviewer
b60ec097e54064315835bcdff34930cb8a5827d1
Adding network report to Code Oracle
diff --git a/cviewer/plugins/codeoracle/actions.py b/cviewer/plugins/codeoracle/actions.py index 94e9265..c03426e 100644 --- a/cviewer/plugins/codeoracle/actions.py +++ b/cviewer/plugins/codeoracle/actions.py @@ -1,281 +1,302 @@ import logging from enthought.io.api import File from enthought.pyface.api import FileDialog, OK from enthought.pyface.action.api import Action from enthought.traits.api import Any from cviewer.plugins.text_editor.editor.text_editor import TextEditor from cviewer.plugins.ui.preference_manager import preference_manager # Logging imports import logging logger = logging.getLogger('root.'+__name__) + +class NetworkReport(Action): + tooltip = "Network Report" + description = "Network Report" + + # The WorkbenchWindow the action is attached to. + window = Any() + + def perform(self, event=None): + + from scripts import reportlab + + import tempfile + myf = tempfile.mktemp(suffix='.py', prefix='my') + f=open(myf, 'w') + f.write(reportlab) + f.close() + + self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) + + class NipypeBet(Action): tooltip = "Brain extraction using BET" description = "Brain extraction using BET" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import nipypebet import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nipypebet) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowTracks(Action): tooltip = "Show tracks between two regions" description = "Show tracks between two regions" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import ctrackedge import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(ctrackedge) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class XNATPushPull(Action): tooltip = "Push and pull files from and to XNAT Server" description = "Push and pull files from and to XNAT Server" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import pushpull import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(pushpull) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ComputeNBS(Action): tooltip = "Compute NBS" description = "Compute NBS" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): # from cnetwork_nbs_action import NBSNetworkParameter, NBSMoreParameter from scripts import nbsscript # cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') # # no = NBSNetworkParameter(cfile) # no.edit_traits(kind='livemodal') # # if (len(no.selected1) == 0 or len(no.selected2) == 0): # return # # mo = NBSMoreParameter(cfile, no.selected1[0], no.selected2[0]) # mo.edit_traits(kind='livemodal') # # import datetime as dt # a=dt.datetime.now() # ostr = '%s%s%s' % (a.hour, a.minute, a.second) # if not (len(no.selected1) == 0 or len(no.selected2) == 0): # # if cancel, not create surface # # create a temporary file # import tempfile # myf = tempfile.mktemp(suffix='.py', prefix='my') # f=open(myf, 'w') # f.write(nbsscript % (str(no.selected1), # mo.first_edge_value, # str(no.selected2), # mo.second_edge_value, # mo.THRES, # mo.K, # mo.TAIL, # ostr)) # f.close() # # self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nbsscript) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowNetworks(Action): tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import NetworkParameter from scripts import netscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(netscript % (no.netw[no.graph]['name'], no.node_position, no.edge_value, no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ConnectionMatrix(Action): tooltip = "Show connection matrix" description = "Show connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixNetworkParameter from scripts import conmatrix cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrix % (no.netw[no.graph]['name'], no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class SimpleConnectionMatrix(Action): tooltip = "Show simple connection matrix" description = "Show simple connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixEdgeNetworkParameter from scripts import conmatrixpyplot cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixEdgeNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrixpyplot % (no.netw[no.graph]['name'], no.edge_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowSurfaces(Action): """ Open a new file in the text editor """ tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from csurface_action import SurfaceParameter from scripts import surfscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = SurfaceParameter(cfile) so.edit_traits(kind='livemodal') if not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') if so.labels_da[so.labels].has_key('da_idx'): labels = so.labels_da[so.labels]['da_idx'] else: labels = 0 f.write(surfscript % (so.pointset_da[so.pointset]['name'], so.pointset_da[so.pointset]['da_idx'], so.faces_da[so.faces]['name'], so.faces_da[so.faces]['da_idx'], so.labels_da[so.labels]['name'], labels)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowVolumes(Action): """ Open a new file in the text editor """ tooltip = "Create a volume" description = "Create a volume" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cvolume_action import VolumeParameter from scripts import volslice cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = VolumeParameter(cfile) so.edit_traits(kind='livemodal') if True: #not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(volslice % so.volumes[so.myvolume]['name']) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) diff --git a/cviewer/plugins/codeoracle/oracle_action_set.py b/cviewer/plugins/codeoracle/oracle_action_set.py index e66b37f..54d986c 100644 --- a/cviewer/plugins/codeoracle/oracle_action_set.py +++ b/cviewer/plugins/codeoracle/oracle_action_set.py @@ -1,92 +1,102 @@ """ Action set for the Oracl plugin """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Enthought library imports from enthought.envisage.ui.action.api import Action, Group, Menu, ToolBar from enthought.envisage.ui.workbench.api import WorkbenchActionSet + + +networkrepo = Action( + id = "OracleCNetworkReport", + class_name = "cviewer.plugins.codeoracle.actions.NetworkReport", + name = "Network Report", + path = "MenuBar/Code Oracle/Connectome/CNetwork/Analysis" +) + xnat_pushpull = Action( id = "OracleXNATPushPull", class_name = "cviewer.plugins.codeoracle.actions.XNATPushPull", name = "XNAT Push and Pull", path = "MenuBar/Code Oracle/Other/XNAT" ) show_surface = Action( id = "OracleCSurface", class_name = "cviewer.plugins.codeoracle.actions.ShowSurfaces", name = "Show Surface", path = "MenuBar/Code Oracle/Connectome/CSurface/Visualization" ) show_volumecre = Action( id = "OracleCVolumeCre", class_name = "cviewer.plugins.codeoracle.actions.ShowVolumes", name = "Volume Creation", path = "MenuBar/Code Oracle/Connectome/CVolume/Visualization" ) show_network = Action( id = "OracleCNetwork3D", class_name = "cviewer.plugins.codeoracle.actions.ShowNetworks", name = "3D Network", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) connection_matrix = Action( id = "OracleCNetworkMat", class_name = "cviewer.plugins.codeoracle.actions.ConnectionMatrix", name = "Connection Matrix", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) simple_connection_matrix = Action( id = "OracleCNetworkSimpleMat", class_name = "cviewer.plugins.codeoracle.actions.SimpleConnectionMatrix", name = "Simple Connection Matrix", path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) compute_nbs = Action( id = "OracleNBS", class_name = "cviewer.plugins.codeoracle.actions.ComputeNBS", name = "Network-based statistic (NBS)", path = "MenuBar/Code Oracle/Statistics" ) show_tracks = Action( id = "OracleShowTracks", class_name = "cviewer.plugins.codeoracle.actions.ShowTracks", name = "Tracks between regions", path = "MenuBar/Code Oracle/Connectome/CTrack/Visualization" ) nipype_bet = Action( id = "OracleNipypeBet", class_name = "cviewer.plugins.codeoracle.actions.NipypeBet", name = "Brain extraction using BET", path = "MenuBar/Code Oracle/Other/Nipype" ) class OracleActionSet(WorkbenchActionSet): """ The actionset for the Oracle plugin """ id = "cviewer.plugins.codeoracle.action_set" actions = [ show_surface, show_network, compute_nbs, show_volumecre, connection_matrix, simple_connection_matrix, show_tracks, xnat_pushpull, - nipype_bet + nipype_bet, + networkrepo ] diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index c627889..a4e8c8a 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -54,615 +54,616 @@ pushpull = """ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server # Hint: # If you plan to retrieve or upload big datasets, it is recommended to run this # script in an external Python shell, as long script executions block the IPython # shell within the Connectome Viewer. # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection a.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT a.push( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. #a.pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data labelname = "%s" surface_file_labels = cfile.obj.get_by_name(labelname) # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if labelname == "None": labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Import Numpy import numpy as np # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Final Tractography (freesurferaparc)").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Final fiber labels (freesurferaparc)").data fromid = 8 toid = 10 # Defining some helper functions # ------------------------------ def sidx(arr, fromval, toval): " Returns the indices that are equal to a given value " return np.where( (arr[:,0] == fromval) & (arr[:,1] == toval) )[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromid, toid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.groupstatistics.nbs as nbs # For documentation of Network-based statistic parameters # do in IPython: nbs.compute_nbs? # https://github.com/LTS5/connectomeviewer/blob/master/cviewer/libs/pyconto/groupstatistics/nbs/_nbs.py # Retrieving the data and set parameters # -------------------------------------- # Define the two groups of networks you want to compare, # setting the connectome network name. These objects need # to exist in the loaded connectome file. first = ['FirstNetwork_control', 'SecondNetwork_control'] # The same for the second group: second = ['FirstNetwork_patient', 'SecondNetwork_patient'] # Select the edge value to use for the first group first_edge_value = 'number_of_fibers' # Select the edge value to use for the second group second_edge_value = 'number_of_fibers' # More parameters for threshold (THRESH) # andd the number of # permutations (K) THRESH=3 K=10 # Can be one of 'left', 'equal', 'right' TAIL='left' SHOW_MATRIX = True # Perform task # ------------ # Get the connectome objects for the given connectome network names firstgroup = [cfile.obj.get_by_name(n) for n in first] secondgroup = [cfile.obj.get_by_name(n) for n in second] # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a seperate script PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # Find a date import datetime as dt a=dt.datetime.now() ostr = '%s:%s:%s' % (a.hour, a.minute, a.second) # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s' % ostr, nbsgraph, dtype='NBSResult') cfile.update_children() """ volrendering = """ from enthought.mayavi import mlab import numpy as np data=np.random.random( (10,10,10)) min = data.min() max = data.max() source=mlab.pipeline.scalar_field(data) vol = mlab.pipeline.volume(source, vmin=min+0.65*(max-min), vmax=min+0.9*(max-min)) """ volslice = """ # Import Mayavi mlab interface from enthought.mayavi import mlab # Import NumPy import numpy as np # Retrieving the data and set parameters # -------------------------------------- # the CVolume name volname="%s" # Retrieve volume data (as Nibabel Image) voldat = cfile.obj.get_by_name(volname).data # Retrieve the image data data = voldat.get_data() # Retrieve the affine affine = voldat.get_affine() center = np.r_[0, 0, 0, 1] # Perform task # ------------ # create A ScalarField with spacing and origin from the affine data_src = mlab.pipeline.scalar_field(data) data_src.spacing = np.diag(affine)[:3] data_src.origin = np.dot(affine, center)[:3] # Create an outline mlab.pipeline.outline(data_src) # Create a simple x-aligned image plane widget image_plane_widget = mlab.pipeline.image_plane_widget(data_src, name=volname) image_plane_widget.ipw.plane_orientation = 'x_axes' image_plane_widget.ipw.reslice_interpolate = 'nearest_neighbour' """ reportlab = """ # Credits # http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/ -# Import ReportLab from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch -# Import NetworkX -import networkx - -# Retrieving the data and set parameters -# -------------------------------------- +import matplotlib +matplotlib.use('Agg') +import matplotlib.pyplot as plt +import networkx as nx +import numpy as np +import datetime +import tempfile +import os.path PAGE_HEIGHT=defaultPageSize[1] styles = getSampleStyleSheet() -Title = "Connectome Report: " -URL = "http://www.connectomics.org/" -email = "[email protected]" - +Title = "Connectome Report for " Elements=[] HeaderStyle = styles["Heading1"] ParaStyle = styles["Normal"] PreStyle = styles["Code"] +today = datetime.date.today() +tmpdir = tempfile.gettempdir() -# load data -net=a.get_by_name("%s") +# Retrieving the data +# ------------------- + +# the network for the reporting +net = cfile.obj.get_by_name('connectome_freesurferaparc') net.load() -g=net.data -netw = g - +# the edge key +de_key = 'number_of_fibers' +# output file name +fname = os.path.join(tmpdir, 'out.pdf') + +date = today.strftime('Reported on %dth, %h %Y') +netw = net.data + def header(txt, style=HeaderStyle, klass=Paragraph, sep=0.3): s = Spacer(0.2*inch, sep*inch) para = klass(txt, style) sect = [s, para] result = KeepTogether(sect) return result - + def p(txt): return header(txt, style=ParaStyle, sep=0.1) - + def pre(txt): s = Spacer(0.1*inch, 0.1*inch) p = Preformatted(txt, PreStyle) precomps = [s,p] result = KeepTogether(precomps) return result - -def go(): - doc = SimpleDocTemplate('gfe.pdf') - doc.build(Elements) - -mytitle = header(Title + a.get_connectome_meta().get_title()) - -mysite = header(URL, sep=0.1, style=ParaStyle) -mymail = header(email, sep=0.1, style=ParaStyle) - -myabstract = p(Abstract) -head_info = [mytitle, mysite, mymail] - - -code_title = header("Basic code to produce output") -code_explain = p("This is a snippet of code. It's an example using the Preformatted flowable object, which - makes it easy to put code into your documents. Enjoy!") +def go(fname): + doc = SimpleDocTemplate(fname) + doc.build(Elements) -mytitlenet = header(net.get_name()) +mytitle = header(Title + '"' + cfile.obj.get_connectome_meta().get_title() + '"') +mydate = header(date, sep=0.1, style=ParaStyle) -import matplotlib -matplotlib.use('Agg') -import matplotlib.pyplot as plt -import networkx as nx +mytitlenet = header(net.get_name() + " (CNetwork)") for u,v,d in netw.edges_iter(data=True): - netw.edge[u][v]['weight'] = netw.edge[u][v]['de_adcmean'] + edgval = netw.edge[u][v][de_key] + if edgval > 0: + netw.edge[u][v]['weight'] = 1 + else: + netw.edge[u][v]['weight'] = 1 b=nx.to_numpy_matrix(netw) fig = plt.figure() -fig.suptitle("Connection matrix") -aa= plt.imshow(b, interpolation='nearest', cmap=plt.cm.jet, vmin = b.min(), vmax=b.max()) -fig.savefig('matrix.png') +fig.suptitle("Binary Connection matrix") +aa= plt.imshow(b, interpolation='nearest', cmap=plt.cm.Greys, vmin = b.min(), vmax=b.max()) +fig.savefig(os.path.join(tmpdir, 'matrix.png')) fig.clear() fig.suptitle("Degree distribution") plt.hist(netw.degree().values(),30) -fig.savefig('distri.png') +fig.savefig(os.path.join(tmpdir,'distri.png')) # measures - +if nx.is_connected(netw): + isit = "Yes" +else: + isit = "No" me1 = p("Number of Nodes: " + str(netw.number_of_nodes())) me2 = p("Number of Edges: " + str(netw.number_of_edges())) -me3 = p("Is network connected: " + str(nx.is_connected(netw))) +me3 = p("Is network connected: " + isit) me4 = p("Number of connected components: " + str(nx.number_connected_components(netw))) -me5 = p("Average unweighted shortest path length: " + str(nx.average_shortest_path_length(netw, weighted = False))) -me6 = p("Average Clustering Coefficient: " + str(nx.average_clustering(netw))) +me44 = p("Average node degree: %.2f" % np.mean(netw.degree().values())) +me5 = p("Average unweighted shortest path length: %.2f" % nx.average_shortest_path_length(netw, weighted = False)) +me6 = p("Average clustering coefficient: %.2f" % nx.average_clustering(netw)) -logo = "matrix.png" +logo = os.path.join(tmpdir, "matrix.png") im1 = Image(logo, 300,225) -logo = "distri.png" +logo = os.path.join(tmpdir, "distri.png") im2 = Image(logo, 250,188) -codesection = [mytitle, mysite, mymail, mytitlenet, im1, im2, me1, me2, me3, me4, me5, me6] +codesection = [mytitle, mydate, mytitlenet, me1, me2, me3, me4,me44, me5, me6, im1, im2] src = KeepTogether(codesection) Elements.append(src) -go() +go(fname) """
LTS5/connectomeviewer
b1950e43e2fb13760b5d131709aa2db2f2335b5e
Add missing *.so files
diff --git a/.gitignore b/.gitignore index 52d5509..6451635 100755 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,13 @@ *.bin *.log *.pyc -*.so *.c doc/_build/ doc/build/ doc/manual build/ dist/ -ConnectomeViewer.egg-info/ -libs-queue/ MANIFEST .project -.pydevproject .settings/ .idea/ diff --git a/cviewer/libs/pyconto/bct/bit32/_bct.so b/cviewer/libs/pyconto/bct/bit32/_bct.so new file mode 100755 index 0000000..a66c68c Binary files /dev/null and b/cviewer/libs/pyconto/bct/bit32/_bct.so differ diff --git a/cviewer/libs/pyconto/bct/bit32/old/_bct.so b/cviewer/libs/pyconto/bct/bit32/old/_bct.so new file mode 100755 index 0000000..7f15aa3 Binary files /dev/null and b/cviewer/libs/pyconto/bct/bit32/old/_bct.so differ diff --git a/cviewer/libs/pyconto/bct/bit64/_bct.so b/cviewer/libs/pyconto/bct/bit64/_bct.so new file mode 100755 index 0000000..97043f5 Binary files /dev/null and b/cviewer/libs/pyconto/bct/bit64/_bct.so differ diff --git a/cviewer/libs/pyconto/bct/mac/_bct.so b/cviewer/libs/pyconto/bct/mac/_bct.so new file mode 100644 index 0000000..fdebeae Binary files /dev/null and b/cviewer/libs/pyconto/bct/mac/_bct.so differ
LTS5/connectomeviewer
919504d30b578104dcb674431c0e1c7e04c1e5d1
Importing nibabel intent_codes from the correct location for nibabel>=1.1.0
diff --git a/cviewer/plugins/cff2/csurface_darray.py b/cviewer/plugins/cff2/csurface_darray.py index 7707391..60a0e08 100644 --- a/cviewer/plugins/cff2/csurface_darray.py +++ b/cviewer/plugins/cff2/csurface_darray.py @@ -1,58 +1,61 @@ """ The ConnectomeViewer wrapper for a cfflib object """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Standard library imports import os # Enthought library imports from enthought.traits.api import HasTraits, Str, Bool, CBool, Any, Dict, implements, \ List, Instance, DelegatesTo, Property from enthought.traits.ui.api import View, Item, auto_close_message, message # ConnectomeViewer imports import cfflib -from nibabel.gifti.util import intent_codes +try: + from nibabel.nifti1 import intent_codes +except ImportError: + print("Please install Nibabel >= 1.1.0") # Logging import import logging logger = logging.getLogger('root.'+__name__) class CSurfaceDarray(HasTraits): """ The implementation of the Connectome Surface data array """ def __init__(self, darray, **traits): super(CSurfaceDarray, self).__init__(**traits) self.data = darray if not self.data.meta is None: getdict = self.data.get_metadata() prim = '' if getdict.has_key('AnatomicalStructurePrimary'): prim = getdict['AnatomicalStructurePrimary'] sec = '' if getdict.has_key('AnatomicalStructureSecondary'): sec = getdict['AnatomicalStructureSecondary'] # name resolution if prim == '': if sec == '': dname = 'Data arrays (%s)' % str(intent_codes.label[self.data.intent]) else: dname = '%s (%s)' % (sec, str(intent_codes.label[self.data.intent])) else: if sec == '': dname = '%s (%s)' % (prim, str(intent_codes.label[self.data.intent])) else: dname = '%s / %s (%s)' % (prim, sec, str(intent_codes.label[self.data.intent])) else: dname = 'Data arrays (%s)' % str(intent_codes.label[self.data.intent]) self.dname = dname # attach it to parent? - \ No newline at end of file + diff --git a/cviewer/plugins/codeoracle/csurface_action.py b/cviewer/plugins/codeoracle/csurface_action.py index cb71528..cf8ccb6 100644 --- a/cviewer/plugins/codeoracle/csurface_action.py +++ b/cviewer/plugins/codeoracle/csurface_action.py @@ -1,64 +1,64 @@ from enthought.traits.api import Code, Button, Int, on_trait_change, Any, HasTraits,List, Str, Enum, Instance, Bool from enthought.traits.ui.api import (View, Item, Group, HGroup, CodeEditor, spring, Handler, EnumEditor) from cviewer.plugins.cff2.csurface_darray import CSurfaceDarray -from nibabel.gifti.util import intent_codes + class SurfaceParameter(HasTraits): engine = Enum("Mayavi", ["Mayavi"]) view = View( Item('engine', label = "Use Engine"), Item('pointset', label = "Pointset"), Item('faces', label = "Faces"), Item('labels', label="labels"), id='cviewer.plugins.codeoracle.surfaceparameter', buttons=['OK'], resizable=True, title = "Create surface ..." ) def __init__(self, cfile, **traits): super(SurfaceParameter, self).__init__(**traits) self.pointset_da = {} self.faces_da = {} self.labels_da = {} for cobj in cfile.connectome_surface: if cobj.loaded: # check darrays # if correct intent, add to list for i, cdobj in enumerate(cobj.darrays): if cdobj.data.intent == 1008: self.pointset_da[cobj.name + ' / ' + cdobj.dname + ' (%s)' % str(i)] = {'name' : cobj.obj.name, 'da_idx' : i} #pointset.append(cdobj) if cdobj.data.intent == 1009: self.faces_da[cobj.name + ' / ' + cdobj.dname + ' (%s)' % str(i)] = {'name' : cobj.obj.name, 'da_idx' : i} #faces.append(cdobj.dname) if cdobj.data.intent == 1002: self.labels_da[cobj.name + ' / ' + cdobj.dname + ' (%s)' % str(i)] = {'name' : cobj.obj.name, 'da_idx' : i} if len(self.pointset_da) == 0: self.pointset_da["None"] = {'name' : "None"} if len(self.faces_da) == 0: self.faces_da["None"] = {'name' : "None"} if len(self.labels_da) == 0: self.labels_da["None"] = {'name' : "None"} # assert labels and pointset dimension are the same self.add_trait('pointset', Enum(self.pointset_da.keys()) ) self.add_trait('faces', Enum(self.faces_da.keys()) ) self.add_trait('labels', Enum(self.labels_da.keys()) ) - \ No newline at end of file +
LTS5/connectomeviewer
5599a512cffb20945f3e75cc0de45fbd0035e63e
Raise exception when no edges to visualize
diff --git a/cviewer/plugins/codeoracle/cnetwork_action.py b/cviewer/plugins/codeoracle/cnetwork_action.py index 691b8ef..7253cab 100644 --- a/cviewer/plugins/codeoracle/cnetwork_action.py +++ b/cviewer/plugins/codeoracle/cnetwork_action.py @@ -1,160 +1,163 @@ from enthought.traits.api import Code, Button, Int, on_trait_change, Any, HasTraits,List, Str, Enum, Instance, Bool from enthought.traits.ui.api import (View, Item, Group, HGroup, CodeEditor, spring, Handler, EnumEditor) from cviewer.plugins.cff2.cnetwork import CNetwork class MatrixNetworkParameter(HasTraits): view = View( Item('graph', label = "Graph"), Item('node_label', label="Node Label"), id='cviewer.plugins.codeoracle.matrixnetworkparameter', buttons=['OK'], resizable=True, title = "Connection Matrix Generator Script" ) def _graph_changed(self, value): self.remove_trait("node_label") self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) def __init__(self, cfile, **traits): super(MatrixNetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.nodes_iter(data=True) n, dn = a.next() lab = [] for k in dn.keys(): if 'name' in k or 'label' in k: lab.append(k) if len(lab) == 0: lab = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) class MatrixEdgeNetworkParameter(HasTraits): view = View( Item('graph', label = "Graph"), Item('edge_label', label="Edge Label"), id='cviewer.plugins.codeoracle.matrixnetworkparameter', buttons=['OK'], resizable=True, title = "Connection Matrix Generator Script" ) def _graph_changed(self, value): self.remove_trait("edge_label") self.add_trait('edge_label', Enum(self.netw[firstk]['lab']) ) def __init__(self, cfile, **traits): super(MatrixEdgeNetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.edges_iter(data=True) u,v, dn = a.next() lab = [] for k in dn.keys(): if not k in lab: lab.append(k) if len(lab) == 0: lab = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('edge_label', Enum(self.netw[firstk]['lab']) ) class NetworkParameter(HasTraits): engine = Enum("Mayavi", ["Mayavi"]) view = View( Item('engine', label = "Engine"), Item('graph', label = "Graph"), Item('node_position', label = "Node Positions"), Item('edge_value', label="Edge Value"), Item('node_label', label="Node Label"), id='cviewer.plugins.codeoracle.networkparameter', buttons=['OK'], resizable=True, title = "3D Network Generator Script" ) def _graph_changed(self, value): self.remove_trait("node_position") self.remove_trait("edge_value") self.remove_trait("node_label") self.add_trait('node_position', Enum(self.netw[value]['pos']) ) self.add_trait('edge_value', Enum(self.netw[value]['ev']) ) self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) def __init__(self, cfile, **traits): super(NetworkParameter, self).__init__(**traits) self.netw = {} for cobj in cfile.connectome_network: if cobj.loaded: if isinstance(cobj, CNetwork): # add more info a=cobj.obj.data.nodes_iter(data=True) n, dn = a.next() npos = [] lab = [] for k in dn.keys(): if 'position' in k or 'pos' in k or 'location' in k: npos.append(k) if 'name' in k or 'label' in k: lab.append(k) if len(npos) == 0: npos = ["None"] if len(lab) == 0: lab = ["None"] a=cobj.obj.data.edges_iter(data=True) + if len(cobj.obj.data.edges()) == 0: + raise Exception("No edges exist in the connectome network") + e1, e2, de = a.next() ev = [] for k in de.keys(): if isinstance(de[k], float) or isinstance(de[k], int): ev.append(k) if len(ev) == 0: ev = ["None"] self.netw[cobj.name] = {'name' : cobj.obj.name, 'ev' : ev, 'pos' : npos, 'lab' : lab} if len(self.netw) == 0: self.netw["None"] = {'name' : "None", 'ev' : "None", 'pos' : "None", 'lab' : "None"} self.add_trait('graph', Enum(self.netw.keys()) ) firstk = self.netw.keys()[0] self.add_trait('node_position', Enum(self.netw[firstk]['pos']) ) self.add_trait('edge_value', Enum(self.netw[firstk]['ev']) ) self.add_trait('node_label', Enum(self.netw[firstk]['lab']) ) - \ No newline at end of file +
LTS5/connectomeviewer
76de7360484e158ff9a8bedf14344b812c06e0d3
Adding the Connectome Mapper as a widget
diff --git a/cviewer/app.py b/cviewer/app.py index 8f7f7a5..a346274 100755 --- a/cviewer/app.py +++ b/cviewer/app.py @@ -1,345 +1,355 @@ """ The ConnectomeViewer Envisage application with Plugins """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Modified version. Adapted from the MayaVi2 application # Standard library imports import sys import os.path import os # Enthought library imports from enthought.traits.api import (HasTraits, Instance, Int, on_trait_change) from enthought.etsconfig.api import ETSConfig from enthought.logger.api import LogFileHandler, FORMATTER # ConnectomeViewer imports from cviewer.cviewer_workbench_application import CViewerWorkbenchApplication from cviewer.plugins.ui.preference_manager import preference_manager from cviewer.info import version as ver # Logger imports import logging, logging.handlers logger = logging.getLogger('root') logger_envisage = logging.getLogger('enthought.envisage.plugin') logger_ipython = logging.getLogger('enthought.plugins.ipython_shell.view.ipython_shell_view') logger_pyface = logging.getLogger('enthought.pyface.ui.wx.workbench.editor_set_structure_handler') logger_pyfaceview = logging.getLogger('enthought.pyface.workbench.i_view') def setup_logger(logger, fname, stream=True, mode=logging.ERROR): """Setup a log file and the logger. Parameters ---------- fname : string File name the logger should use. stream : bool Add a stream handler. mode : logging type The logging mode of the stream handler. """ if not os.path.isabs(fname): path = os.path.join(ETSConfig.application_data, fname) else: path = fname create_file_handler = True # check if path exists dirname = os.path.dirname(path) if not(os.path.exists(dirname)): try: os.makedirs(dirname) except OSError: #logger.error('Can not create path to store the log file.') create_file_handler = False # check if path is writable if not os.access(dirname, os.W_OK): print "===========================================" print "The application data path is not writable: ", dirname print "Please remove it with:" print "sudo rm -rf " + dirname print "and re-run the ConnectomeViewer with:" print "connectomeviewer.py -v" print "===========================================" raise Exception("PermissionError") # check if files exists, if not open it if not(os.path.exists(path)): # XXX add try catch file = open(path, 'w') file.close() # setting the logging level logger.setLevel(mode) # create formatter formatter = logging.Formatter("%(levelname)s - %(name)s - %(message)s") # old: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" if stream: # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(mode) # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) if create_file_handler: filehandler = logging.handlers.RotatingFileHandler(path, maxBytes=1000000, backupCount=4) filehandler.setLevel(mode) filehandler.setFormatter(formatter) logger.addHandler(filehandler) logger_envisage.addHandler(filehandler) # does this fix the # no handlers could be found for logger "enthought.envisage.plugin" logger_ipython.addHandler(filehandler) logger_pyface.addHandler(filehandler) logger_pyfaceview.addHandler(filehandler) import datetime import sys import platform dt = datetime.datetime.now() outdate = dt.strftime("%A, %d. %B %Y %I:%M%p") logger.info("*"*5) if create_file_handler: logger.info("logfile: %s" % os.path.abspath(path)) logger.info("cviewer version: %s " % ver) # logger.info("cviewer executable: %s " % str(__main__)) logger.info("python executable: %s" % sys.executable) logger.info("python version: %s" % sys.version.replace('\n', '')) logger.info("uname: %s" % ' '.join(platform.uname())) logger.info("distribution: %s" % ' '.join(platform.linux_distribution())) logger.info("execution date and time: %s" % outdate) logger.info("*"*5) def get_non_gui_plugin_classes(): """Get list of basic mayavi plugin classes that do not add any views or actions.""" from enthought.envisage.core_plugin import CorePlugin from enthought.envisage.ui.workbench.workbench_plugin import WorkbenchPlugin from enthought.tvtk.plugins.scene.scene_plugin import ScenePlugin from enthought.mayavi.plugins.mayavi_plugin import MayaviPlugin plugins = [CorePlugin, WorkbenchPlugin, MayaviPlugin, ScenePlugin, ] return plugins def get_non_gui_plugins(): """Get list of basic mayavi plugins that do not add any views or actions.""" return [cls() for cls in get_non_gui_plugin_classes()] def get_plugin_classes(): """Get list of default plugin classes to use for ConnectomeViewer.""" # Force the selection of a toolkit: from enthought.traits.ui.api import toolkit toolkit() from enthought.etsconfig.api import ETSConfig try_use_ipython = preference_manager.cviewerui.useipython use_ipython = False if ETSConfig.toolkit == 'wx' and try_use_ipython: try: # If the right versions of IPython, EnvisagePlugins and # Pyface are not installed, this import will fail. from enthought.plugins.ipython_shell.view.ipython_shell_view \ import IPythonShellView use_ipython = True except: pass if use_ipython: from enthought.plugins.ipython_shell.ipython_shell_plugin import \ IPythonShellPlugin PythonShellPlugin = IPythonShellPlugin else: from enthought.plugins.python_shell.python_shell_plugin import PythonShellPlugin from enthought.tvtk.plugins.scene.ui.scene_ui_plugin import SceneUIPlugin from cviewer.plugins.text_editor.text_editor_plugin import TextEditorPlugin plugins = get_non_gui_plugin_classes() plugins.extend([ SceneUIPlugin, TextEditorPlugin, PythonShellPlugin, ]) return plugins def get_plugins(): """Get list of default plugins to use for Mayavi.""" return [cls() for cls in get_plugin_classes()] def get_cviewer_plugins(): """ Get list of ConnectomeViewer plugins """ plugins = [] logger.info('Plugins') logger.info('*******') # from cviewer.plugins.cff.cff_plugin import ConnectomeFilePlugin # # add ConnectomeFile plugin # plugins.insert(0, ConnectomeFilePlugin()) # logger.info('Added ConnectomeFilePlugin') from cviewer.plugins.cff2.cff_plugin import ConnectomeFile2Plugin # add ConnectomeFile plugin plugins.insert(0, ConnectomeFile2Plugin()) logger.info('Added ConnectomeFile2Plugin') #from cviewer.plugins.analysis.analysis_ui_plugin import AnalysisUIPlugin # add ConnectomeAnalysis UI plugin #plugins.insert(0, AnalysisUIPlugin()) #logger.info('Added AnalysisUIPlugin') from cviewer.plugins.ui.cviewer_ui_plugin import CViewerUIPlugin # add ConnectomeViewerUserInterface plugin plugins.insert(0, CViewerUIPlugin()) logger.info('Added CViewerUIPlugin') # add Bindings plugin from cviewer.plugins.bindings.bindings_plugin import BindingsPlugin plugins.append(BindingsPlugin()) logger.info('Added BindingsPlugin') # add sLORETA Converter plugin from cviewer.plugins.codeoracle.oracle_plugin import OraclePlugin plugins.append(OraclePlugin()) logger.info('Added Oracle Plugin') # add Oracle Converter plugin - from cviewer.plugins.sloreta.sloreta_plugin import SLoretaConverterPlugin - plugins.append(SLoretaConverterPlugin()) - logger.info('Added sLORETA Converter Plugin') +# from cviewer.plugins.sloreta.sloreta_plugin import SLoretaConverterPlugin +# plugins.append(SLoretaConverterPlugin()) +# logger.info('Added sLORETA Converter Plugin') # add NBS plugin from cviewer.plugins.nbs.nbs_plugin import NBSPlugin plugins.append(NBSPlugin()) logger.info('Added Network Based Statistics (NBS) Plugin') # add DiPy plugin try: dipy_works = True from cviewer.plugins.dipy.dipy_plugin import DipyPlugin except ImportError: dipy_works = False if dipy_works: plugins.append(DipyPlugin()) logger.info('Added Diffusion in Python (DiPy) Plugin') - + + # add cmp + try: + cmp_works = True + from cviewer.plugins.cmp.cmp_plugin import CMPPlugin + except ImportError: + cmp_works = False + if cmp_works: + plugins.append(CMPPlugin()) + logger.info('Added Connectome Mapper Plugin') + return plugins ########################################################################### # `CViewer` class. ########################################################################### class CViewer(HasTraits): """The Connectome Viewer application class. """ # The main envisage application. application = Instance('enthought.envisage.ui.workbench.api.WorkbenchApplication') # The MayaVi Script instance. script = Instance('enthought.mayavi.plugins.script.Script') # The logging mode. log_mode = Int(logging.ERROR, desc='the logging mode to use') def main(self, argv=None): """The main application is created and launched here. Parameters ---------- argv : list of strings The list of command line arguments. The default is `None` where no command line arguments are parsed. To support command line arguments you can pass `sys.argv[1:]`. log_mode : The logging mode to use. """ # parse any cmd line args. if argv is None: argv = [] self.parse_command_line(argv) # setup logging self.setup_logger() # add all default plugins plugins = get_plugins() # add ConnectomeViewer plugins plugins = get_cviewer_plugins() + plugins # create the application prefs = preference_manager.preferences # create the application object self.application = CViewerWorkbenchApplication(plugins=plugins, preferences=prefs) # start the application. self.application.run() logger.info('We hope you enjoyed using the ConnectomeViewer!') def setup_logger(self): """ Setting up the root logger """ from enthought.etsconfig.api import ETSConfig path = os.path.join(ETSConfig.application_data, 'ch.connectome.viewer', 'cviewer.log') path = os.path.abspath(path) setup_logger(logger, path, mode=self.log_mode) def parse_command_line(self, argv): """Parse command line options. Parameters ---------- - argv : `list` of `strings` The list of command line arguments. """ from optparse import OptionParser usage = "usage: %prog [options]" parser = OptionParser(usage) (options, args) = parser.parse_args(argv) def run(self): """This function is called after the GUI has started. """ pass def main(argv=None): """ Helper to start up the ConnectomeViewer application. """ m = CViewer() m.main(argv) return m diff --git a/cviewer/plugins/cmp/__init__.py b/cviewer/plugins/cmp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cviewer/plugins/cmp/cmp_plugin.py b/cviewer/plugins/cmp/cmp_plugin.py new file mode 100644 index 0000000..ea3d792 --- /dev/null +++ b/cviewer/plugins/cmp/cmp_plugin.py @@ -0,0 +1,58 @@ +""" Diffusion in Python (DiPy) Plugin for ConnectomeViewer + +""" +# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and +# University Hospital Center and University of Lausanne (UNIL-CHUV) +# +# Modified BSD License + +# Enthought library imports +from enthought.envisage.api import Plugin +from enthought.traits.api import List +from enthought.envisage.api import Service + +# Logging imports +import logging +logger = logging.getLogger('root.'+__name__) + +CMPVIEW = 'cviewer.plugins.cmp.cmpview' + +class CMPPlugin(Plugin): + """ The plugin integrates the Connectome Mapper as a View """ + + VIEWS = "enthought.envisage.ui.workbench.views" + + # The plugin's unique identifier. + id = 'connectome.mapper' + + # Contributions to the views extension point made by this plug-in. + views = List(contributes_to=VIEWS) + + # The plugin's name (suitable for displaying to the user). + name = 'Connectome Mapper Plugin' + + def _views_default(self): + """ Trait initialiser. + """ + return [self._cmp_factory] + + def _cmp_factory(self, window, **traits): + """ Factory method for the mapper """ + + from enthought.pyface.workbench.traits_ui_view import TraitsUIView + + try: + from cmp.gui import CMPGUI + mycmp = CMPGUI() + except: + return + + tui_engine_view = TraitsUIView(obj=mycmp, + id=CMPVIEW, + name='Connectome Mapper', + window=window, + position='right', + #relative_to=ENGINE_VIEW, + **traits + ) + return tui_engine_view \ No newline at end of file diff --git a/cviewer/plugins/setup.py b/cviewer/plugins/setup.py index 30c0ab5..93aa534 100644 --- a/cviewer/plugins/setup.py +++ b/cviewer/plugins/setup.py @@ -1,22 +1,23 @@ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('plugins', parent_package, top_path) config.add_subpackage('bindings') config.add_subpackage('cff2') config.add_subpackage('codeoracle') config.add_subpackage('sloreta') config.add_subpackage('dipy') config.add_subpackage('text_editor') config.add_subpackage('ui') config.add_subpackage('nbs') config.add_subpackage('sloreta') + config.add_subpackage('cmp') config.add_data_files('ui/preferences.ini') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(top_path='').todict()) diff --git a/cviewer/plugins/ui/cviewer_ui_plugin.py b/cviewer/plugins/ui/cviewer_ui_plugin.py index 269e099..926b547 100755 --- a/cviewer/plugins/ui/cviewer_ui_plugin.py +++ b/cviewer/plugins/ui/cviewer_ui_plugin.py @@ -1,245 +1,236 @@ """ The ConntecomeViewer UI Plugin """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Partly modified version; mayavi_ui_plugin.py # Author: Prabhu Ramachandran <prabhu [at] aero . iitb . ac . in> # Copyright (c) 2008, Enthought, Inc. # License: BSD Style. # Enthought library imports from enthought.envisage.api import Plugin from enthought.traits.api import List, on_trait_change from enthought.pyface.workbench.api import Perspective, PerspectiveItem from enthought.etsconfig.api import ETSConfig # View IDs ENGINE_VIEW = 'enthought.mayavi.core.ui.engine_view.EngineView' CURRENT_SELECTION_VIEW = 'enthought.mayavi.core.engine.Engine.current_selection' SHELL_VIEW = 'enthought.plugins.python_shell_view' LOGGER_VIEW = 'enthought.logger.plugin.view.logger_view.LoggerView' ID = 'connectome.cviewer.ui' CFFVIEW = 'cviewer.plugins.cff2.ui.cff_view.CFFView' # This module's package. PKG = '.'.join(__name__.split('.')[:-1]) from welcome.perspective import WelcomePerspective # Logging imports import logging logger = logging.getLogger('root.'+__name__) ############################################################################### # ViewerPerspective ############################################################################### class ViewerPerspective(Perspective): """ The default perspective for the ConnectomeViewer """ # the unique ID id = "cviewer.perspective.viewer_perspective" # The perspective's name. name = 'ViewerPerspective' # Should this perspective be enabled or not? enabled = True # Should the editor area be shown in this perspective? show_editor_area = True # The contents of the perspective. contents = List() def _contents_default(self): # The contents of the perspective. Add the views here with position contents = [ PerspectiveItem(id=CFFVIEW, position='left', width=0.6), PerspectiveItem(id=ENGINE_VIEW, position='bottom', relative_to=CFFVIEW), PerspectiveItem(id=SHELL_VIEW, position='bottom', height=0.2), # XXX: deactivate mayavi views per default as not to confuse end-users too much #PerspectiveItem(id=CURRENT_SELECTION_VIEW, position='bottom', # relative_to=ENGINE_VIEW), ] return contents ############################################################################### # `CViewerUIPlugin` class. ############################################################################### class CViewerUIPlugin(Plugin): """ A Connectome Viewer user interface plugins. This plugin contributes the actions, menues, preference pages etc. """ # extension points this plugin contributes to PERSPECTIVES = 'enthought.envisage.ui.workbench.perspectives' PREFERENCES = 'enthought.envisage.preferences' PREFERENCES_PAGES = 'enthought.envisage.ui.workbench.preferences_pages' #BANNER = 'enthought.plugins.ipython_shell.banner' ACTION_SETS = 'enthought.envisage.ui.workbench.action_sets' #COMMANDS = 'enthought.plugins.python_shell.commands' VIEWS = "enthought.envisage.ui.workbench.views" # The plugin's unique identifier. id = ID # The plugin's name (suitable for displaying to the user). name = 'ConnectomeViewer UI' # Contributions to the views extension point made by this plug-in. views = List(contributes_to=VIEWS) # Perspectives. perspectives = List(contributes_to=PERSPECTIVES) # actions action_sets = List(contributes_to=ACTION_SETS) # Preferences preferences = List(contributes_to=PREFERENCES) # Preference pages preferences_pages = List(contributes_to=PREFERENCES_PAGES) # Ipython banner #banner = List(contributes_to=BANNER) # more imports needed #commands = List(contributes_to=COMMANDS) ##################################################################### # Private methods. - # TODO: currently deactivated imports for better performance - #def _commands_default(self): - # """ Initializes some imports for the ipython shell """ - # return [] - #return['import cviewer.plugins.cff.gifti as gifti'] def _views_default(self): """ Trait initialiser. """ return [self._engine_view_factory, self._current_selection_view_factory,] def _perspectives_default(self): """ Trait initializer. """ return [ViewerPerspective] - #def _banner_default(self): - # """Trait initializer """ - # return ["Welcome! After loading Connectome File (.cff), double-click the network to activate and render it. See Help->Key Bindings for more info.", ] - def _action_sets_default(self): """ Trait initializer. """ from cviewer_ui_action_set import CViewerUIActionSet return [CViewerUIActionSet] def _preferences_default(self): """ Trait initializer. """ return ['pkgfile://%s/preferences.ini' % PKG] def _preferences_pages_default(self): """ Trait initializer. """ from cviewer_ui_preferences_page import CViewerUIPreferencesPage return [CViewerUIPreferencesPage] ###################################################################### # Private methods. (imported from MayaviUI plugin) def _engine_view_factory(self, window, **traits): """ Factory method for engine views. """ from enthought.pyface.workbench.traits_ui_view import \ TraitsUIView from enthought.mayavi.core.ui.engine_view import \ EngineView engine_view = EngineView(engine=self._get_engine(window)) tui_engine_view = TraitsUIView(obj=engine_view, id=ENGINE_VIEW, name='MayaVi Visualization Tree', window=window, position='left', **traits ) return tui_engine_view def _current_selection_view_factory(self, window, **traits): """ Factory method for the current selection of the engine. """ from enthought.pyface.workbench.traits_ui_view import \ TraitsUIView engine = self._get_engine(window) tui_engine_view = TraitsUIView(obj=engine, view='current_selection_view', id=CURRENT_SELECTION_VIEW, name='Visualization Object Editor', window=window, position='bottom', relative_to=ENGINE_VIEW, **traits ) return tui_engine_view def _get_engine(self, window): """Return the Mayavi engine of the particular window.""" from enthought.mayavi.core.engine import Engine return window.get_service(Engine) def _get_script(self, window): """Return the `enthought.mayavi.plugins.script.Script` instance of the window.""" from enthought.mayavi.plugins.script import Script return window.get_service(Script) ###################################################################### # Trait handlers. @on_trait_change('application.gui:started') def _on_application_gui_started(self, obj, trait_name, old, new): """This is called when the application's GUI is started. The method binds the `Script` and `Engine` instance on the interpreter. """ # This is called when the application trait is set but we don't # want to do anything at that point. if trait_name != 'started' or not new: return # Get the script service. app = self.application window = app.workbench.active_window script = self._get_script(window) # Get a hold of the Python shell view. id = SHELL_VIEW py = window.get_view_by_id(id) if py is None: logger.warn('*'*10) logger.warn("Can't find the Python shell view to bind variables") return # Bind the script and engine instances to names on the # interpreter. try: py.bind('mayavi', script) py.bind('engine', script.engine) from enthought.naming.ui.api import explore py.bind('explore', explore) except AttributeError, msg: # This can happen when the shell is not visible. # FIXME: fix this when the shell plugin is improved. logger.warn(msg) logger.warn("Can't find the Python shell to bind variables")
LTS5/connectomeviewer
c0ac6c2e8ea8e90ae6d4ca80fd598d53e68e9b9b
Patch docs not to show source
diff --git a/doc/conf.py b/doc/conf.py index 9bd8b06..23767c9 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,214 +1,214 @@ # -*- coding: utf-8 -*- # # sampledoc documentation build configuration file, created by # sphinx-quickstart on Tue Jun 3 12:40:24 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're removed automatically). # # All configuration values have a default value; values that are commented out # serve to show the default value. import sys, os # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. sys.path.append(os.path.abspath('sphinxext')) # Import support for ipython console session syntax highlighting (lives # in the sphinxext directory defined above) import ipython_console_highlighting # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'ipython_console_highlighting', 'inheritance_diagram', 'numpydoc', 'autosummary'] # Matplotlib sphinx extensions # ---------------------------- # Currently we depend on some matplotlib extentions that are only in # the trunk, so we've added copies of these files to fall back on, # since most people install releases. Once theses extensions have # been released for a while we should remove this hack. I'm assuming # any modifications to these extensions will be done upstream in # matplotlib! The matplotlib trunk will have more bug fixes and # feature updates so we'll try to use that one first. try: import matplotlib.sphinxext extensions.append('matplotlib.sphinxext.mathmpl') extensions.append('matplotlib.sphinxext.only_directives') extensions.append('matplotlib.sphinxext.plot_directive') except ImportError: extensions.append('mathmpl') extensions.append('only_directives') extensions.append('plot_directive') # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General substitutions. project = 'Connectome Viewer' copyright = '2010, EPFL & UNIL-CHUV. Author: Stephan Gerhard' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. # # The short X.Y version. version = '2.0.0 RC1' # The full version, including alpha/beta/rc tags. release = '2.0.0 RC1' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. unused_docs = [] # List of directories, relative to source directories, that shouldn't # be searched for source files. exclude_trees = ['www'] # what to put into API doc (just class doc, just init, or both) autoclass_content = 'class' # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # Options for HTML output # ----------------------- # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. #html_style = 'nipy.css' # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". html_title = 'ConnectomeViewer Documentation' # The name of an image file (within the static path) to place at the top of # the sidebar. #html_logo = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Content template for the index page. html_index = 'www/index.html' # Custom sidebar templates, maps document names to template names. html_sidebars = {'index': 'indexsidebar.html'} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If true, the reST sources are included in the HTML build as _sources/<name>. -html_copy_source = True +html_copy_source = False # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' html_theme = 'sphinxdoc' # Output file base name for HTML help builder. htmlhelp_basename = project # Options for LaTeX output # ------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class # [howto/manual]). latex_documents = [ ('contents', 'cviewer.tex', 'ConnectomeViewer Documentation', ur'Multi-Modal, Multi-Level pythonic Network Visualization and Analysis','manual'), ## ('devel/index', 'nipy_devel.tex', ## 'Neuroimaging in Python Developer Documentation', ## ur'The Neuroimaging in Python documentation team.','manual'), ## ('api/index', 'nipy_ref.tex', ## 'Neuroimaging in Python Reference Guide', ## ur'The Neuroimaging in Python documentation team.','manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. latex_use_parts = True # Additional stuff for the LaTeX preamble. latex_preamble = """ \usepackage{amsmath} \usepackage{amssymb} % Uncomment these two if needed %\usepackage{amsfonts} %\usepackage{txfonts} """ # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. latex_use_modindex = True
LTS5/connectomeviewer
ddce07ed764353237b4f10173ff0e315f3367ec9
Adding cfflib to install instructions
diff --git a/doc/users/installation.rst b/doc/users/installation.rst index 6174880..7ab4382 100755 --- a/doc/users/installation.rst +++ b/doc/users/installation.rst @@ -1,58 +1,62 @@ .. _installation: ========================== Download and Installation ========================== .. warning:: This content is soon deprecated and replaced by an easier installation procedure using Neuro Debian. Step-by-Step Guide for Installation on Ubuntu/Debian ---------------------------------------------------- The Python Version 2.6 is needed minimally. Add the NeuroDebian repository to your system. The steps are explained here:: firefox http://neuro.debian.net/ There are many dependencies to install (the exact package names might change slightly if using Ubuntu version smaller than 10.10):: sudo apt-get update sudo apt-get install git-core python-setuptools libvtk5.4 python-vtk python-numpy python-wxversion python2.6-dev g++ swig python-configobj glutg3 glutg3-dev libxtst-dev ipython python-lxml sudo apt-get install python-matplotlib python-qscintilla2 gcc scons python-xlib pyqt4-dev-tools python-scipy python-pyrex python-all-dev python-dicom sudo apt-get install libxt-dev libglu1-mesa-dev python-pip wget python-wxgtk2.8 python-h5py python-envisagecore python-envisageplugins python-traitsbackendwx python-traitsbackendqt python-traitsgui python-enthoughtbase python-chaco python-lxml python-h5py mayavi2 python-tables python-tables-doc python-apptools python-pip python-wxtools python-sphinx Upgrade NetworkX:: sudo pip install --upgrade networkx +Install cfflib:: + + sudo pip install cfflib + Install Nibabel (from the NeuroDebian repository):: sudo apt-get install python-nibabel python-nibabel-doc python-dicom Download the `Connectome Viewer source code <http://www.cmtk.org/users/download>`_, extract and install it:: tar xzf LTS5-....tar.gz cd LTS5-connectomeviewer-..../ sudo python setup.py install You should now be able to start with:: connectomeviewer -v .. On first startup, a directory is created in your home folder (*$HOME/.enthought/ch.connectome.viewer*) to store the logfile and window settings. If the first startup was as root, you do not have write permission in this folder, leading to a *Permission Error*. Simply remove this folder (*sudo rm -rf $HOME/.enthought/ch.connectome.viewer/*) and start ConnectomeViewer again as user. .. Step-by-Step Guide for Installation on Windows .. ---------------------------------------------- .. * Install the recent EPD_ (License: Academic, Option: Install for all users). It is free for academic purposes, see button at the bottom of the page. .. * To access HDF5 files, we need H5Py, you `install it from here <http://code.google.com/p/h5py/downloads/list>`_ .. * Install ConnectomeViewer executable `(from the download page) <http://www.connectomeviewer.org/users/download>`_ .. * Either select the ConnectomeViewer from the Startmenu (Connectome->ConnectomeViewer) or open a Command Prompt and type:: .. connectomeviewer.py -v .. * You can `download example datasets <http://connectomeviewer.org/viewer/datasets>`_. Make sure that they end with *.cff* (however they are regular ZIP archives). .. If you encounter any problems, please send an email to `info AT connectomics.org <mailto:infoATconnectomics.org>`_! .. include:: ../links_names.txt Installation on Other Platforms ------------------------------- .. note:: Currently, the support for a Windows installer has been dropped. But you can install `VirtualBox <http://www.virtualbox.org/wiki/Downloads>`_ and a recent `Ubuntu <http://www.ubuntu.com/desktop/get-ubuntu/download>`_ and then carry out the steps above.
LTS5/connectomeviewer
38340935d21541f94ae00ca49f560e887dcb9b54
Release candiate 2.0.0-RC1. Updated docu
diff --git a/COPYRIGHT b/COPYRIGHT index 02f90dc..8a27dd7 100755 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,34 +1,34 @@ Copyright (C) 2009-2011, Ecole Polytechnique Fédérale de Lausanne (EPFL) and Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Ecole Polytechnique Fédérale de Lausanne (EPFL) and Hospital Center and University of Lausanne (UNIL-CHUV) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL "Ecole Polytechnique Fédérale de Lausanne (EPFL) and Hospital Center and University of Lausanne (UNIL-CHUV)" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -This software is for research purposes only and shall not be used for -any clinical use. This software has not been reviewed or approved by -the Food and Drug Administration or equivalent authority, and is for -non-clinical, IRB-approved Research Use Only. In no event shall data -or images generated through the use of the Software be used in the -provision of patient care. +THIS SOFTWARE IS FOR RESEARCH PURPOSES ONLY AND SHALL NOT BE USED FOR +ANY CLINICAL USE. THIS SOFTWARE HAS NOT BEEN REVIEWED OR APPROVED BY +THE FOOD AND DRUG ADMINISTRATION OR EQUIVALENT AUTHORITY, AND IS FOR +NON-CLINICAL, IRB-APPROVED RESEARCH USE ONLY. IN NO EVENT SHALL DATA +OR IMAGES GENERATED THROUGH THE USE OF THE SOFTWARE BE USED IN THE +PROVISION OR PATIENT CARE. \ No newline at end of file diff --git a/cviewer/info.py b/cviewer/info.py index 3ff1435..6a9b73e 100644 --- a/cviewer/info.py +++ b/cviewer/info.py @@ -1,83 +1,83 @@ ''' Release data for ConnectomeViewer This script should do no imports. It only defines variables. ''' -version = '2.0' +version = '2.0.0-RC1' is_release = False long_description = \ """ ConnectomeViewer - A Framework for the Visualization and Analysis of Multi-Modal Multi-Scale Connectome Data in Python The aim of ConnectomeViewer is to produce a platform-independent Python framework for the analysis and visualization of Connectome data using an open development model. The ConnectomeViewer is a extensible, scriptable, pythonic software tool for visualization and analysis in neuroimaging research on many spatial scales. Employing the Connectome File Format, diverse data such as networks, surfaces, volumes, tracks and metadata are handled and integrated. Specifically, we aim to: 1. Provide an open source, mixed language scientific programming framework for rapid development and quantitative analysis 2. Provide a visualization platform to readily visualize multi-modal data for interactive data exploration 3. Allow for enhanced brain connectivity analysis and plotting 4. Provide the Connectome File Format to store a wide range of data types: metadata, networks, surfaces, volumes, fiber tracks, time series 5. Create and maintain a wide base of developers to contribute plugins to this framework. 6. To integrate this framework with software packages in neuroimaging and provide an easily installable bundle. """ # these have to be done per install_requires envisagecore_min_version = '3.1.2' traitsbackendwx_min_version = '3.2.1' envisageplugins_min_version = '3.1.2' enthoughtbase_min_version = '3.0.4' traitsgui_min_version = '3.1.1' chaco_min_version = '3.2.1' lxml_min_version = '2.2.6' pymysql_min_version = '0.2' # these can be done safely traits_min_version = '3.2.0' networkx_min_version = '1.4' mayavi_min_version = '3.3.2' h5py_min_version = '1.2.0' scipy_min_version = '0.5' # for ubuntu 10.04 ### envisagecore_min_version = '3.1.1' # python-envisagecore envisageplugins_min_version = '3.1.1' # python-envisageplugins traitsbackendwx_min_version = '3.2.0' # python-traitsbackendwx traitsbackendqt_min_version = '3.2.0' # python-traitsbackendqt traitsgui_min_version = '3.1.0' # python-traitsgui traits_min_version = '3.2.0' # python-traits python_enthought_traits_ui = '3.1.0' # python-enthought-traits-ui enthoughtbase_min_version = '3.0.3' # python-enthoughtbase chaco_min_version = '3.2.0' # python-chaco lxml_min_version = '2.2.4' # python-lxml scipy_min_version = '0.5' # python-scipy (0.7.0) numpy_min_version = '1.3.0' # python-numpy h5py_min_version = '1.2.1' # python-h5py mayavi_min_version = '3.3.0' # mayavi2 # python-apptools (3.3.0), python-enthought-traits (3.1.0), python-numpy (1.3.0) # outdated or not available pymysql_min_version = '0.2' # not available networkx_min_version = '1.4' # python-network (0.99) diff --git a/cviewer/plugins/codeoracle/oracle_action_set.py b/cviewer/plugins/codeoracle/oracle_action_set.py index bb0f8fb..e66b37f 100644 --- a/cviewer/plugins/codeoracle/oracle_action_set.py +++ b/cviewer/plugins/codeoracle/oracle_action_set.py @@ -1,92 +1,92 @@ """ Action set for the Oracl plugin """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Enthought library imports from enthought.envisage.ui.action.api import Action, Group, Menu, ToolBar from enthought.envisage.ui.workbench.api import WorkbenchActionSet xnat_pushpull = Action( id = "OracleXNATPushPull", class_name = "cviewer.plugins.codeoracle.actions.XNATPushPull", name = "XNAT Push and Pull", - path = "MenuBar/Code Oracle/Other" + path = "MenuBar/Code Oracle/Other/XNAT" ) show_surface = Action( id = "OracleCSurface", class_name = "cviewer.plugins.codeoracle.actions.ShowSurfaces", name = "Show Surface", - path = "MenuBar/Code Oracle/CSurface" + path = "MenuBar/Code Oracle/Connectome/CSurface/Visualization" ) show_volumecre = Action( id = "OracleCVolumeCre", class_name = "cviewer.plugins.codeoracle.actions.ShowVolumes", name = "Volume Creation", - path = "MenuBar/Code Oracle/CVolume" + path = "MenuBar/Code Oracle/Connectome/CVolume/Visualization" ) show_network = Action( id = "OracleCNetwork3D", class_name = "cviewer.plugins.codeoracle.actions.ShowNetworks", name = "3D Network", - path = "MenuBar/Code Oracle/CNetwork" + path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) connection_matrix = Action( id = "OracleCNetworkMat", class_name = "cviewer.plugins.codeoracle.actions.ConnectionMatrix", name = "Connection Matrix", - path = "MenuBar/Code Oracle/CNetwork" + path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) simple_connection_matrix = Action( id = "OracleCNetworkSimpleMat", class_name = "cviewer.plugins.codeoracle.actions.SimpleConnectionMatrix", name = "Simple Connection Matrix", - path = "MenuBar/Code Oracle/CNetwork" + path = "MenuBar/Code Oracle/Connectome/CNetwork/Visualization" ) compute_nbs = Action( id = "OracleNBS", class_name = "cviewer.plugins.codeoracle.actions.ComputeNBS", name = "Network-based statistic (NBS)", path = "MenuBar/Code Oracle/Statistics" ) show_tracks = Action( id = "OracleShowTracks", class_name = "cviewer.plugins.codeoracle.actions.ShowTracks", name = "Tracks between regions", - path = "MenuBar/Code Oracle/CTrack" + path = "MenuBar/Code Oracle/Connectome/CTrack/Visualization" ) nipype_bet = Action( id = "OracleNipypeBet", class_name = "cviewer.plugins.codeoracle.actions.NipypeBet", name = "Brain extraction using BET", path = "MenuBar/Code Oracle/Other/Nipype" ) class OracleActionSet(WorkbenchActionSet): """ The actionset for the Oracle plugin """ id = "cviewer.plugins.codeoracle.action_set" actions = [ show_surface, show_network, compute_nbs, show_volumecre, connection_matrix, simple_connection_matrix, show_tracks, xnat_pushpull, nipype_bet ] diff --git a/doc/about.rst b/doc/about.rst index 808a8c3..1f3b214 100755 --- a/doc/about.rst +++ b/doc/about.rst @@ -1,56 +1,48 @@ .. _about_cviewer: ======================== About ConnectomeViewer ======================== -------- Vision -------- The field of Connectomics research benefits from recent advances in structural neuroimaging technologies on all spatial scales. The need for software tools to visualize and analyse the emerging data is urgent. Python is emerging as `standard programming language in neuroscience/neuroinformatics <http://frontiersin.org/neuroinformatics/specialtopics/8/>`_. Thus it makes sense to build a reusable application using Python for Connectomics research, allowing the use of many `scientific tools <http://www.scipy.org/>`_. The ConnectomeViewer application was developed to meet the needs of basic and clinical neuroscientists, as well as complex network scientists, providing an integrative, extensible platform to visualize and analyze Connectomics data. With the Connectome File Format, interlinking different datatypes such as -hierarchical networks, surface data, and volumetric data is easy and might provide +networks, surface data, and volumetric data is easy and might provide new ways of analyzing and interacting with data. -Furthermore, ConnectomeViewer readily integrates with - - * `ConnectomeWiki`_: a semantic knowledge base representing connectomics data at - a mesoscale level across various species, allowing easy access to relevant literature - and databases. - * ConnectomeDatabase: a repository to store and disseminate Connectome files. - (development stalled) - .. include:: links_names.txt ----------------- A short history ----------------- Beginning 2009, Stephan Gerhard, master student at the `Institute of Neuroinformatics <http://www.ini.uzh.ch/>`_, was looking for an interesting subject for his thesis. Fascinated by an image on `VisualComplexity.com <http://www.visualcomplexity.com/vc/project.cfm?id=646>`_ of recent advances in structural in-vivo neuroimaging in humans led him to find out about the Human Connectome project in a paper by Olaf Sporns and Rolf Kötter. (:ref:`publications`) Bringing computer science and neuroinformatics know-how into this surely long-lasting endeavour seemed like a good way to go. After contacting Dr. `Olaf Sporns <http://en.wikipedia.org/wiki/Olaf_Sporns>`_, he pointed him to a collaborating signal processing group at EPFL in Lausanne. Prof. Jean-Philippe Thiran, the head of the `LTS5 group <http://lts5www.epfl.ch/>`_, allowed him to start his master thesis supervised by Dr. Patric Hagmann, a Diffusion Spectrum Imaging specialist. In February 2010, the master thesis (:ref:`publications`) was finished. The development of the ConnectomeViewer will be continued at EPFL and UNIL-CHUV by Stephan Gerhard et al. diff --git a/doc/conf.py b/doc/conf.py index 593a57e..9bd8b06 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,214 +1,214 @@ # -*- coding: utf-8 -*- # # sampledoc documentation build configuration file, created by # sphinx-quickstart on Tue Jun 3 12:40:24 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're removed automatically). # # All configuration values have a default value; values that are commented out # serve to show the default value. import sys, os # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. sys.path.append(os.path.abspath('sphinxext')) # Import support for ipython console session syntax highlighting (lives # in the sphinxext directory defined above) import ipython_console_highlighting # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'ipython_console_highlighting', 'inheritance_diagram', 'numpydoc', 'autosummary'] # Matplotlib sphinx extensions # ---------------------------- # Currently we depend on some matplotlib extentions that are only in # the trunk, so we've added copies of these files to fall back on, # since most people install releases. Once theses extensions have # been released for a while we should remove this hack. I'm assuming # any modifications to these extensions will be done upstream in # matplotlib! The matplotlib trunk will have more bug fixes and # feature updates so we'll try to use that one first. try: import matplotlib.sphinxext extensions.append('matplotlib.sphinxext.mathmpl') extensions.append('matplotlib.sphinxext.only_directives') extensions.append('matplotlib.sphinxext.plot_directive') except ImportError: extensions.append('mathmpl') extensions.append('only_directives') extensions.append('plot_directive') # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General substitutions. -project = 'ConnectomeViewer' -copyright = '2010, EPFL & UNIL-CHUV' +project = 'Connectome Viewer' +copyright = '2010, EPFL & UNIL-CHUV. Author: Stephan Gerhard' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. # # The short X.Y version. -version = '0.1.9 BETA' +version = '2.0.0 RC1' # The full version, including alpha/beta/rc tags. -release = '0.1.9 BETA' +release = '2.0.0 RC1' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. unused_docs = [] # List of directories, relative to source directories, that shouldn't # be searched for source files. exclude_trees = ['www'] # what to put into API doc (just class doc, just init, or both) autoclass_content = 'class' # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # Options for HTML output # ----------------------- # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. #html_style = 'nipy.css' # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". html_title = 'ConnectomeViewer Documentation' # The name of an image file (within the static path) to place at the top of # the sidebar. #html_logo = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Content template for the index page. html_index = 'www/index.html' # Custom sidebar templates, maps document names to template names. html_sidebars = {'index': 'indexsidebar.html'} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If true, the reST sources are included in the HTML build as _sources/<name>. html_copy_source = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' html_theme = 'sphinxdoc' # Output file base name for HTML help builder. htmlhelp_basename = project # Options for LaTeX output # ------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class # [howto/manual]). latex_documents = [ ('contents', 'cviewer.tex', 'ConnectomeViewer Documentation', ur'Multi-Modal, Multi-Level pythonic Network Visualization and Analysis','manual'), ## ('devel/index', 'nipy_devel.tex', ## 'Neuroimaging in Python Developer Documentation', ## ur'The Neuroimaging in Python documentation team.','manual'), ## ('api/index', 'nipy_ref.tex', ## 'Neuroimaging in Python Reference Guide', ## ur'The Neuroimaging in Python documentation team.','manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. latex_use_parts = True # Additional stuff for the LaTeX preamble. latex_preamble = """ \usepackage{amsmath} \usepackage{amssymb} % Uncomment these two if needed %\usepackage{amsfonts} %\usepackage{txfonts} """ # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. latex_use_modindex = True diff --git a/doc/devel/index.rst b/doc/devel/index.rst index 99b8664..24eb742 100644 --- a/doc/devel/index.rst +++ b/doc/devel/index.rst @@ -1,14 +1,14 @@ .. _development: -ConnectomeViewer development -============================ +Connectome Viewer Development +============================= This section of the documentation was adapted from the `dipy documentation <http://nipy.sourceforge.net/dipy/index.html>`_ Contents: .. toctree:: :maxdepth: 2 intro gitwash/index diff --git a/doc/index.rst b/doc/index.rst index 2ef4583..220dec6 100755 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,24 +1,22 @@ ================================ ConnectomeViewer Documentation ================================ .. htmlonly:: :Release: |version| :Date: |today| Contents: .. toctree:: :maxdepth: 1 about users/index plugins - links publications license - releasenotes devel/index diff --git a/doc/license.rst b/doc/license.rst index 5081a63..6566997 100755 --- a/doc/license.rst +++ b/doc/license.rst @@ -1,32 +1,55 @@ .. _cviewer-license: -==================================== -ConnectomeViewer License Information -==================================== +===================================== +Connectome Viewer License Information +===================================== .. _cviewer-software-license: -ConnectomeViewer Core Software License +Connectome Viewer Modified BSD License -------------------------------------- -ConnectomeViewer is free but copyright software, distributed under the terms of the -`GNU General Public Licence <http://www.connectome.ch/viewer/license>`_ as published -by the Free Software Foundation (Version 3), given in the file LICENSE.txt. - -Further details on "copyleft" can be found at http://www.gnu.org/copyleft/. In particular, -ConnectomeViewer is supplied as is. No formal support or maintenance is provided or implied. - -This ConnectomeViewer has not been reviewed or approved by the Food and Drug Administration -or equivalent authority. In no event shall data or images generated through the use of the -ConnectomeViewer be used in the provision of patient care. - +Copyright (C) 2009-2011, Ecole Polytechnique Fédérale de Lausanne (EPFL) and +Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Ecole Polytechnique Fédérale de Lausanne (EPFL) + and Hospital Center and University of Lausanne (UNIL-CHUV) nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL "Ecole Polytechnique Fédérale de Lausanne (EPFL) and +Hospital Center and University of Lausanne (UNIL-CHUV)" BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +THIS SOFTWARE IS FOR RESEARCH PURPOSES ONLY AND SHALL NOT BE USED FOR +ANY CLINICAL USE. THIS SOFTWARE HAS NOT BEEN REVIEWED OR APPROVED BY +THE FOOD AND DRUG ADMINISTRATION OR EQUIVALENT AUTHORITY, AND IS FOR +NON-CLINICAL, IRB-APPROVED RESEARCH USE ONLY. IN NO EVENT SHALL DATA +OR IMAGES GENERATED THROUGH THE USE OF THE SOFTWARE BE USED IN THE +PROVISION OR PATIENT CARE. Documentation License --------------------- -Except where otherwise noted, all ConnectomeViewer documentation is licensed under a +Except where otherwise noted, all Connectome Viewer documentation is licensed under a `Creative Commons Attribution 3.0 License <http://creativecommons.org/licenses/by/3.0/>`_. -All code fragments in the documentation are licensed under the ConnectomeViewer license. +All code fragments in the documentation are licensed under the Connectome Viewer license. Thanks to the `NIPY <http://neuroimaging.scipy.org/site/index.html>`_ project for usage of their structure of the documentation. \ No newline at end of file diff --git a/doc/plugins.rst b/doc/plugins.rst index 699d849..066ae0c 100755 --- a/doc/plugins.rst +++ b/doc/plugins.rst @@ -1,62 +1,45 @@ ======= Plugins ======= -ConnectomeViewer is built using `Enthought Envisage <http://code.enthought.com/projects/envisage/>`_, +Connectome Viewer is built using `Enthought Envisage <http://code.enthought.com/projects/envisage/>`_, a very powerful application architecture, which allows for seamless integration of plugins and services. -If you would like to develop a plugin for ConnectomeViewer, there are `external tutorials <https://svn.enthought.com/enthought/wiki/EnvisageDevGuide>`_ +If you would like to develop a plugin for Connectome Viewer, there are `external tutorials <https://svn.enthought.com/enthought/wiki/EnvisageDevGuide>`_ or you can look at the source code in the plugin folder. Feel free to `contact us <mailto:info AT connectomics DOT org>`_ if you have any questions or would like to add a plugin to the list. - -sLORETA Plugin -````````````````````````````````` -**Summary**: sLORETA is a low resolution brain electromagnetic tomography software that -can be applied to EEG/MEG time series. This plugins allows one to convert functional -connectivity output from sLORETA to connectome files. It has also a converter from voxel-based -data (*.slor files*) to Nifti. - -**Status**: Integrated in Current Release - -**Tutorial**: :ref:`sloretacon` - -**Author**: Stephan Gerhard in collaboration with `Roberto Pascual-Marqui <http://www.researcherid.com/rid/A-2012-2008>`_ - -**URL**: `http://www.uzh.ch/keyinst/loreta.htm <http://www.uzh.ch/keyinst/loreta.htm>`_ - - Network Based Statistic Plugin ````````````````````````````````` **Summary**: Computes the network-based statistic (NBS) as described in the reference. **Status**: Integrated in Current Release **Tutorial**: :ref:`nbs` **Reference**: `Zalesky A, Fornito A, Bullmore ET (2010) Network-based statistic: Identifying differences in brain networks. NeuroImage. 10.1016/j.neuroimage.2010.06.041 <http://people.eng.unimelb.edu.au/azalesky/paper_nbs.pdf>`_ **Author**: Original code written by Andrew Zalesky, rewritten for Python by Stephan Gerhard. Bindings Plugin ````````````````````````````````` **Summary**: This exposes the currently loaded connectome file to the Python Shell by adding the reference *cfile* to its name space. **Status**: Integrated in Current Release **Author**: Stephan Gerhard TextEditor Plugin ````````````````````````````````` **Summary**: This includes a straightforward text editor with Python syntax-highlighting to easily write scripts. You can run the scripts by pressing Ctrl-R. See File menu to open and save files. **Status**: Integrated in Current Release **Author**: Derived from the Enthought Envisage Text Editor Plugin. diff --git a/doc/publications.rst b/doc/publications.rst index 7418f57..c704627 100755 --- a/doc/publications.rst +++ b/doc/publications.rst @@ -1,51 +1,51 @@ .. _publications: ============ Publications ============ -How to cite the ConnectomeViewer? -````````````````````````````````` +How to cite the Connectome Viewer and Connectome File Format? +````````````````````````````````````````````````````````````` * Stephan Gerhard, Leila Cammoun, Jean-Philippe Thiran, Patric Hagmann. ConnectomeViewer.org. Ecole Polytechnique Fédérale de Lausanne and University Hospital Center and University of Lausanne. 2010. Peer-reviewed Publications ``````````````````````````` * Hagmann P, Cammoun L, Gigandet X, Meuli R, Honey CJ, et al. 2008 `Mapping the Structural Core of Human Cerebral Cortex. <http://www.plosbiology.org/article/info:doi/10.1371/journal.pbio.0060159>`_ PLoS Biol 6(7): e159. Other relevant Literature `````````````````````````` Mesoscale :::::::::: * Gerhard S (2010). Connectomics - Tools and Applications. ConnectomeViewer and ConnectomeWiki. Master thesis. Institute of Neuroinformatics, Zurich, Switzerland. * Gerhard S (2010). Connectomics - Tools and Applications. Master thesis presentation. Institute of Neuroinformatics, Zurich, Switzerland. * Hagmann P, et al. (2008). `Mapping the Structural Core of Human Cerebral Cortex <http://dx.doi.org/10.1371/journal.pbio.0060159>`_ PLoS Biology Vol. 6, No. 7, e159 * Sporns O, Tononi G, Kötter R (2005). `The Human Connectome: A Structural Description of the Human Brain. <http://dx.doi.org/10.1371/journal.pcbi.0010042>`_ PLoS Comput Biol 1(4): e42. * `Three-Dimensional Microsurgical and Tractographic Anatomy of the White Matter of the Human Brain <http://schweb1.lrdc.pitt.edu/pbc/2009b/media/Fernandez-Miranda-2008.pdf>`_ Juan C. Fernández-Miranda, M.D.; Albert L. Rhoton, Jr., M.D.; Juan Álvarez-Linera, M.D.; Yukinari Kakizawa, M.D., Ph.D.; Chanyoung Choi, M.D.; Evandro P. de Oliveira, M.D.; Neurosurgery 62[SHC Suppl 3]:SHC-989–SHC-1027, 2008 * Bohland et al. `A proposal for a coordinated effort for the determination of brainwide neuroanatomical connectivity in model organisms at a mesoscopic scale <http://hebb.mit.edu/courses/connectomics/Bohland%20neuroanatomical%20connectivity%20mesoscopic%2009.pdf>`_. PLoS Comput. Biol. 5:e1000334 Microscale ::::::::::: Apart from Connectomics research being done at mesoscale level, there are plenty of efforts to map wiring diagrams on the microscale levels, i.e. the cellular level. * `Introduction to Connectomics <http://hebb.mit.edu/courses/connectomics/>`_ by Sebastian Seung et al. * `CATMAID Project <http://fly.mpi-cbg.de/~saalfeld/catmaid/>`_ Posters ::::::: * OHBM 2010 - ConnectomeViewer - Multi-Modal Multi-Level Network Visualization and Analysis in Python diff --git a/doc/releasenotes.rst b/doc/releasenotes.rst index c26f8ca..c389e60 100644 --- a/doc/releasenotes.rst +++ b/doc/releasenotes.rst @@ -1,82 +1,75 @@ ============================== -ConnectomeViewer Release Notes +Connectome Viewer Release Notes ============================== +.. warning:: This document is deprecated. Please see the GitHub commit log for updates. + Version 0.2.0 (DATE) + * Support for the Connectome File Format Version 2.0 * Compatibility with the Connectome Mapper * Functionality is now encapuslated in CodeOracle scripts Version 0.1.9 - BETA (August 11th 2010) * Changed to numpy.distutils for packaging * Update installation scripts for Ubuntu and Fedora * Added Network Based Statistics Plugin. Thanks goes to Andrew Zalesky. * Update documentation and added tutorials -** Dipy tutorial: From Diffusion to tracks -** NBS: Computing network based statistics -** Update Matlab Interfacing tutorial -** Added Red Button Tutorial -** Added BlenderExporter tutorial +* Dipy tutorial: From Diffusion to tracks +* NBS: Computing network based statistics +* Update Matlab Interfacing tutorial +* Added Red Button Tutorial +* Added BlenderExporter tutorial * Addition of libraries folder for external packages (cviewer.libs) -** PyEEG, Tomoviz, DiPy. PyConto. +* PyEEG, Tomoviz, DiPy. PyConto. * Added for external packages corresponding documentation (externals/) - * Restructured folders (examples, externals) +* Restructured folders (examples, externals) * Bugfixes Version 0.1.8 - BETA (July 16th 2010) * Replaced Gifti support by a pure Python solution (to be integrated into Nibabel) * Improvements on the installation scripts and dependency management * Dropped installation support for Windows * Minor bugfixes Version 0.1.7 - BETA (May 25th 2010) * Updated installation script for Ubuntu and Fedora * Addition of WelcomePerspective * Better checking for dependency * Bugfixes for Windows Version 0.1.6 - BETA * Added more tutorials to the documentation. * Added node label interactivity to the 3D View. Toggle label upon pressing 'g' -* Inclusion of the developmental Diffusion in Python (DiPy) project to -the ConnectomeViewer namespace (track visualization, segmentation, measures, IO) +* Inclusion of the developmental Diffusion in Python (DiPy) project to the ConnectomeViewer namespace (track visualization, segmentation, measures, IO) * Inclusion of updated IO routines of image data from the NiPy project * Addition of a Matrix Viewer to readily inspect connectivity matrices -* Edge Visualization Parameter dialog box added that allows easy change of -edge attribute and thresholding (absolute, proportional, counting) +* Edge Visualization Parameter dialog box added that allows easy change of edge attribute and thresholding (absolute, proportional, counting) * Text Editor uses default Script Path to open files -* sLORETA Converter Plugin to convert EEG data (lagged coherences, statistics etc.) -analysed with sLORETA into the Connectome File Format (not yet) +* sLORETA Converter Plugin to convert EEG data (lagged coherences, statistics etc.) analysed with sLORETA into the Connectome File Format (not yet) * The ConnectomeDatabase plugin is working again, now using PyMySQL, a pure python MySQL client * Bugfix and Updates in PreferenceManager. Added Use IPython field. * Bugfix for Windows XP, interpolating scalar values automatically Version 0.1.4 - BETA * Integrated a Volume Slicer by Gael Varoquaux * Scheduler to Run Scripts which remembers the Script Path Version 0.1.3 - BETA -* Supporting the Connectome File Format (CFF). It includes data in standardized formats: -GraphML (networks), Gifti (surfaces), Nifti (volumes), .trk (tracks) and XML (metadata) -* 3D View: Visualization of Networks and Surfaces in 3D. Picking functionality to select nodes and edges. -Link to the ConnectomeWiki knowledge-base. See Help->Key Bindings for more details. -* Mayavi2 Plugin: Visualization Tree and Visualization Object Editor to create VTK-Based pipelines -for visualization +* Supporting the Connectome File Format (CFF). It includes data in standardized formats: GraphML (networks), Gifti (surfaces), Nifti (volumes), .trk (tracks) and XML (metadata) +* 3D View: Visualization of Networks and Surfaces in 3D. Picking functionality to select nodes and edges. Link to the ConnectomeWiki knowledge-base. See Help->Key Bindings for more details. +* Mayavi2 Plugin: Visualization Tree and Visualization Object Editor to create VTK-Based pipelines for visualization * Python Shell Plugin for interactive scripting * Text Editor Plugin for writing and executing scripts -* Storing metadata in networks. Consult the connectome.xsd file -<http://www.connectomics.org/connectome.xsd> +* Storing metadata in networks. Consult the connectome.xsd file <http://www.connectomics.org/connectome.xsd> * ConnectomeDatabase Plugin for connection to a SQL database containing connectome files. -* Bindings Plugin: Binds the currently loaded Connectome File in the console to cfile, -allowing access to all the data -* Analysis Perspective: Selection of Network or selected Subnetwork and carry out Network -Analysis using the NetworkX library. -* Interface to TrackVis <http://www.trackvis.org> for visualization of individual tracts. -Region of Interest are automatically generated for selected nodes. +* Bindings Plugin: Binds the currently loaded Connectome File in the console to cfile, allowing access to all the data +* Analysis Perspective: Selection of Network or selected Subnetwork and carry out Network Analysis using the NetworkX library. +* Interface to TrackVis <http://www.trackvis.org> for visualization of individual tracts. Region of Interest are automatically generated for selected nodes. * Launchpad.net for development: Feature Requests, Bug Tracker, Source Code Repository diff --git a/doc/users/connectomefileformat.rst b/doc/users/connectomefileformat.rst index 4322ecc..9505cac 100755 --- a/doc/users/connectomefileformat.rst +++ b/doc/users/connectomefileformat.rst @@ -1,135 +1,14 @@ .. _cfformat: ======================== Connectome File Format ======================== -.. warning:: This content is deprecated. The Connectome File Format Version 2.0 is the new release, together - with the `Connectome File Format Library <http://www.connectomics.org/cfflib/>`_ +The Connectome File Format is used by the Connectome Viewer to organize multi-modal datasets for a single +subject or a study. The Connectome File Format Version 2.0 is released together with the Connectome File Format +Library (cfflib), enabling creation, manipulation and storage of its contained data. -.. hint:: - The core specification is currently rewritten and will be published soon. +To get started, you can look into the documentation for the `cfflib <http://cmtk.org/cfflib>`_ +or explore the `connectome file data repository cffdata <http://github.com/LTS5/cffdata>`_. -The ConnectomeViewer application defines its own data format, the Connectome File Format, -adhering to `open standards <http://www.opensource.org/osr-intro>`_. - -None of the existing formats alone are apt to meet the requirements for a truly -integrated endeavour into structural neuroimaging research on multiple levels. - -Goal: On this page, you will learn about the basics of this file format, why it -is useful, and how you generate your own connectome files. - -Basic Structure ---------------- - -The Connectome File Format has file name ending *.cff*. But in fact, it is -a `ZIP file <http://en.wikipedia.org/wiki/ZIP_(file_format)>`_. -You can rename the ending to *.zip* and extract the file therein. - -You can find an `example file <http://www.connectome.ch/datasets/homo_sapiens_02.cff>`_. - -As an example, a file might have the following structure:: - - meta.xml - Gifti/ - testsubject.gii - testsubject_labels.gii - Network/ - network_res83.graphml - network_res150.graphml - Nifti/ - ROI_scale33.nii - ROI_scale60.nii - Tracks/ - fibers_transformed.trk - - -We will discuss first the components and then show, how the interrelate. - - -Volume data (Nifti) -``````````````````` -|volume| - -The de-facto standard in the neuroimaging community dealing with voxel data. -There exists a very good library to use and manipulate the data with Python, -`PyNifti <http://niftilib.sourceforge.net/pynifti/>`_. - -Connectomics research on a fine scale usually deals with image stacks. From them, -cells and neurites are segmented. This are essentially the same data processing -steps as on a coarser level. It is therefore straightforward to store image -stacks as a 3D scalar field array. - -Raw and segmented volumetric data can be stored in a Connectome File. - -.. |volume| image:: ../_static/cff/volume.png - - -Surface data (Gifti) -```````````````````` -.. figure:: ../_static/cff/surface.resized.png - :align: left - -After segmentation of structures from volumetric datasets, and after some -post-processing steps, one obtains surfaces meshes of these particular structures. - -This surfaces are essentially vertices (points in 3D space) and triangles connecting -these. Since there is a jungle of formats here, the neuroimaging community decided -to define the `Gifti data format <http://www.nitrc.org/projects/gifti/>`_ which is apt -to their needs. ConnectomeViewer supports Gifti files natively to store and render -surfaces, and also to label them. - - -Networks (GraphML) -`````````````````` -.. figure:: ../_static/cff/graph.resized.png - -There are a lot of formats to express networks, which are essentially graphs. -Reasons for choosing `GraphML file format <http://graphml.graphdrawing.org/>`_ to describe networks: - -* A well-supported data format in various applications -* Straightforward support by the `NetworkX <http://networkx.lanl.gov/>`_ Python network library -* Expressiveness for - - * arbitrary data on nodes and edges - * hypergraphs - * hierarchical graphs - -Hierarchical and hypergraphs are not yet implemented in the current ConnectomeViewer release, -but it is planned to do so. - - -Track data (TrackVis) -````````````````````` -.. figure:: ../_static/cff/fibers.resized.png - :align: left - -Reconstructed fiber tracks from Diffusion MRI are stored in the file format defined -by the `TrackVis application <http://www.trackvis.org/docs/?subsect=fileformat>`_. - -If appropriately linked to the networks and volumetric segmentations within -the Connectome File, and easy interface is provided to visualize tracks in TrackVis -using selected nodes as regions of interest. - -Matlab scripts to manipulate TrackVis data is available from the -`Brain Connectivity Challenge <http://pbc.lrdc.pitt.edu/?q=2009b-resource>`_. - -Metadata (XML) -`````````````` -Using a custom `Connectome Schema Definition <http://connectome.ch/connectome.xsd>`_, -XML is apt to store metadata about the Connectome File and link the different data types together. - -Furthermore, it is possible to extend a connectome file by any data you might -want to store for your purposes: - -* Which instruments collected data? -* What algorithms have been used to process them? -* Subject data: collection of DNA samples, demographic information and behavioral data - - -Detailed Example ------------------ - -To prepare a Connectome File for correct loading in the ConnectomeViewer, adhering to -the conventions is key. You can unzip an `example connectome file <http://www.connectome.ch/datasets/homo_sapiens_02.cff>`_ -and explore it for yourself. +The library and format heavily depends on neuroimaging data format reader/writers implemented in `Nibabel <http://nipy.sourceforge.net/nibabel/>`_. \ No newline at end of file diff --git a/doc/users/installation.rst b/doc/users/installation.rst index cda7c1b..6174880 100755 --- a/doc/users/installation.rst +++ b/doc/users/installation.rst @@ -1,77 +1,58 @@ .. _installation: ========================== Download and Installation ========================== .. warning:: This content is soon deprecated and replaced by an easier installation procedure using Neuro Debian. -.. note:: Download the `source code <http://www.connectomeviewer.org/users/download>`_ used for the installation. Please register following `this link. <http://www.connectomeviewer.org/users/register>`_ - The ConnectomeViewer is currently BETA and released to the public. 32bit and 64bit architectures are supported. +Step-by-Step Guide for Installation on Ubuntu/Debian +---------------------------------------------------- +The Python Version 2.6 is needed minimally. +Add the NeuroDebian repository to your system. The steps are explained here:: -Step-by-Step Guide for Installation on Linux (Ubuntu, Fedora) -------------------------------------------------------------- + firefox http://neuro.debian.net/ -The Python Version 2.6 is needed. The installation procedure including installation of required packages, -downloading of sources, and compilation is automated by a sh-script. -Take first a look at the respective scripts in order to understand what they do. +There are many dependencies to install (the exact package names might change slightly if using Ubuntu version smaller than 10.10):: -* Download the `installation script <https://github.com/LTS5/connectomeviewer/tree/master/scripts>`_ (Ubuntu / Fedora 11 or higher supported) + sudo apt-get update + sudo apt-get install git-core python-setuptools libvtk5.4 python-vtk python-numpy python-wxversion python2.6-dev g++ swig python-configobj glutg3 glutg3-dev libxtst-dev ipython python-lxml + sudo apt-get install python-matplotlib python-qscintilla2 gcc scons python-xlib pyqt4-dev-tools python-scipy python-pyrex python-all-dev python-dicom + sudo apt-get install libxt-dev libglu1-mesa-dev python-pip wget python-wxgtk2.8 python-h5py python-envisagecore python-envisageplugins python-traitsbackendwx python-traitsbackendqt python-traitsgui python-enthoughtbase python-chaco python-lxml python-h5py mayavi2 python-tables python-tables-doc python-apptools python-pip python-wxtools python-sphinx -* You need to make the installation file executable:: +Upgrade NetworkX:: - chmod +x install_cviewer_ubuntu.sh - -* Start the installation and compilation (choose the appropriate script) :: + sudo pip install --upgrade networkx - sh ./install_cviewer_ubuntu10_10.sh +Install Nibabel (from the NeuroDebian repository):: -* Start the ConnectomeViewer in verbose mode:: + sudo apt-get install python-nibabel python-nibabel-doc python-dicom - connectomeviewer.py -v +Download the `Connectome Viewer source code <http://www.cmtk.org/users/download>`_, extract and install it:: -* If there are errors during the script execution, generate a log file and send it together with the startup logfile via email to `info[at]connectomics.org <mailto:info[at]connectomics.org>`_:: + tar xzf LTS5-....tar.gz + cd LTS5-connectomeviewer-..../ + sudo python setup.py install - sh ./install_cviewer_ubuntu.sh > logfile.txt +You should now be able to start with:: -.. On first startup, a directory is created in your home folder (*$HOME/.enthought/ch.connectome.viewer*) to store the logfile and window settings. If the first startup was as root, you do not have write permission in this folder, leading to a *Permission Error*. Simply remove this folder (*sudo rm -rf $HOME/.enthought/ch.connectome.viewer/*) and start ConnectomeViewer again as user. + connectomeviewer -v +.. On first startup, a directory is created in your home folder (*$HOME/.enthought/ch.connectome.viewer*) to store the logfile and window settings. If the first startup was as root, you do not have write permission in this folder, leading to a *Permission Error*. Simply remove this folder (*sudo rm -rf $HOME/.enthought/ch.connectome.viewer/*) and start ConnectomeViewer again as user. .. Step-by-Step Guide for Installation on Windows .. ---------------------------------------------- .. * Install the recent EPD_ (License: Academic, Option: Install for all users). It is free for academic purposes, see button at the bottom of the page. .. * To access HDF5 files, we need H5Py, you `install it from here <http://code.google.com/p/h5py/downloads/list>`_ .. * Install ConnectomeViewer executable `(from the download page) <http://www.connectomeviewer.org/users/download>`_ .. * Either select the ConnectomeViewer from the Startmenu (Connectome->ConnectomeViewer) or open a Command Prompt and type:: .. connectomeviewer.py -v .. * You can `download example datasets <http://connectomeviewer.org/viewer/datasets>`_. Make sure that they end with *.cff* (however they are regular ZIP archives). .. If you encounter any problems, please send an email to `info AT connectomics.org <mailto:infoATconnectomics.org>`_! .. include:: ../links_names.txt -Step-by-Step Guide for Installation on Other Platforms ------------------------------------------------------- +Installation on Other Platforms +------------------------------- .. note:: Currently, the support for a Windows installer has been dropped. But you can install `VirtualBox <http://www.virtualbox.org/wiki/Downloads>`_ and a recent `Ubuntu <http://www.ubuntu.com/desktop/get-ubuntu/download>`_ and then carry out the steps above. - -If you managed to make the ConnectomeViewer work on your platform, -`please inform us <mailto:infoATconnectomics.org>`_ and we make the instructions available here. - -Step-by-Step Guide for Installation on Linux by Hand ----------------------------------------------------- - -Dependencies - -+------------+------------+ -| Package | Minimal Version | -+============+============+ -| NetworkX | | -+------------+------------+ -| Cython | | -+------------+------------+ -| ETS | https://svn.enthought.com/enthought/wiki/Build/ETS_3.0.0b1/Py2.5/Generic_Any_Any -+------------+------------+ -| Scipy | | -+------------+------------+ -| Numpy | | -+------------+------------+ diff --git a/doc/users/tutorial.rst b/doc/users/tutorial.rst index 381c2fa..e0a5ebc 100755 --- a/doc/users/tutorial.rst +++ b/doc/users/tutorial.rst @@ -1,41 +1,16 @@ .. _tutorial-index: =========== Tutorials =========== -.. warning:: This content is deprecated with Connectome Viewer Version 2.0. These tutorials will be exposed through the CodeOracle plugin. +.. warning:: This content is deprecated with Connectome Viewer Version 2.0. Scripts that serve as tutorials will be + exposed through the CodeOracle plugin. -The best way to learn how to use the ConnectomeViewer is by example. There are -already some examples in the *example/* folder shipped with the software. Additionally, -the tutorials will help you to get started. - -Basics ------- -* :doc:`tutorials/tut_basicinter` -* :doc:`tutorials/tut_redbut` - -Data Import/Export ------------------- -* :doc:`tutorials/tut_addnet` -* :doc:`tutorials/tut_matlabnet` -* :doc:`tutorials/tut_blendexport` - -Network Statistics ------------------- -* :doc:`tutorials/tut_nbs` - -Graph Layouting ---------------- -* :doc:`tutorials/tut_graphlayout` - -EEG/MEG Source Localisation ---------------------------- -* :doc:`tutorials/tut_sloretacon` - -Diffusion MRI -------------- -* :doc:`tutorials/tut_dipy` -* :doc:`tutorials/tut_dcm2trk` - +The best way to learn how to use the Connectome Viewer is by example. The Code Oracle (Menu Bar) lets you +automatically create Python scripts for tasks you want to perform. Load a connectome file, double-click the +files you want to work with to load them into memory. Then, you can select tasks from the Code Oracle menu. +After setting parameters in a GUI or directly in the script, you can run the script (save it first) by pressing Ctrl-R, +and perform the requested task. +We are open to Code Oracle script contributions that might be useful for the neuroimaging connectome research community. diff --git a/scripts/install_cviewer_fedora.sh b/scripts/install_cviewer_fedora.sh deleted file mode 100644 index 82ee599..0000000 --- a/scripts/install_cviewer_fedora.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -echo "Welcome to the Installation Script for ConnectomeViewer BETA" -echo "============================================================" -echo "Do you want to download the example datasets ? [Y]es / [N]o " -read exdata -case "$exdata" in -# Note variable is quoted. - - "Y" | "y" | "yes" | "Yes" ) - echo "=========================================" - echo "Download Connectome File Example datasets" - echo "=========================================" - echo "Type the full path to store ConnectomeViewer datasets:" - read fullp - mkdir -p $fullp - cd $fullp - wget http://www.connectomeviewer.org/datasets/homo_sapiens_01.cff - wget http://www.connectomeviewer.org/datasets/homo_sapiens_02.cff - wget http://www.connectomeviewer.org/datasets/homo_sapiens_03.cff - wget http://www.connectomeviewer.org/datasets/macaca_mulatta_01.cff - cd .. - ;; - - * ) - # Default option. - # Empty input (hitting RETURN) fits here, too. - echo - echo "Not downloading Connectome File example datasets." - ;; - -esac - -echo "====================================================================" -echo "Add required Fedora packages, including header files for compilation" -echo "====================================================================" -sudo yum install python-pip numpy scipy python-devel ipython vtk vtk-devel swig python-configobj libXtst libXtst-devel freeglut freeglut-devel python-matplotlib python-lxml Cython qscintilla-python python-sphinx wxPython wxPython-devel subversion gcc gcc-c++ libXt libXt-devel libX11-devel hdf5 hdf5-devel python-setuptools-devel python-h5py python-AppTools python-EnvisageCore python-EnvisagePlugins python-Traits python-TraitsBackendQt python-TraitsGUI - -#echo "========================================================" -echo "Install/Update required packages for the ConnectomeViewer" -echo "=========================================================" - -echo "============" -echo "... NetworkX" -echo "============" -easy_install -U networkx - -echo "==========" -echo "... Cython" -echo "==========" -easy_install -U Cython - -echo "=========================================" -echo "Download and install the ConnectomeViewer" -echo "=========================================" - -wget --no-check-certificate http://github.com/downloads/LTS5/connectomeviewer/ConnectomeViewer-0.1.9.tar.gz -tar xzf ConnectomeViewer-0.1.9.tar.gz -cd ConnectomeViewer-0.1.9/ -python setup.py install -cd .. -rm -rf ConnectomeViewer-0.1.9/ - -echo "===================================================" -echo "The installation script is finished. It may well be that errors have occured." -echo "If you got a Permission error. Try to rerun the script with 'sudo ./install_cviewer_fedora.sh'" -ECHO "" -echo "Test your ConnectomeViewer installation by typing in the terminal: -echo "----------- -echo "connectomeviewer.py -v -echo "----------- -echo "" -echo "If there are problems, rerun the installation script with:" -echo "----------- -echo "sh ./install_cviewer_fedora.sh > logfile.txt" -echo "----------- -echo "Send the logfile.txt together with ConnectomeViewer startup logfile (automaticall generated) to [email protected]." -echo "=============================================================" diff --git a/scripts/install_cviewer_ubuntu.sh b/scripts/install_cviewer_ubuntu.sh deleted file mode 100644 index dd005c3..0000000 --- a/scripts/install_cviewer_ubuntu.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh - -echo "Welcome to the Installation Script for ConnectomeViewer BETA" -echo "============================================================" -echo "Do you want to download the example datasets ? [Y]es / [N]o " -read exdata -case "$exdata" in -# Note variable is quoted. - - "Y" | "y" | "yes" | "Yes" ) - echo "=========================================" - echo "Download Connectome File Example datasets" - echo "=========================================" - echo "Type the full path to store ConnectomeViewer datasets:" - read fullp - mkdir -p $fullp - cd $fullp - wget http://www.connectomeviewer.org/datasets/homo_sapiens_01.cff - wget http://www.connectomeviewer.org/datasets/homo_sapiens_02.cff - wget http://www.connectomeviewer.org/datasets/homo_sapiens_03.cff - wget http://www.connectomeviewer.org/datasets/macaca_mulatta_01.cff - cd .. - ;; - * ) - # Default option. - # Empty input (hitting RETURN) fits here, too. - echo - echo "Not downloading Connectome File example datasets." - ;; - -esac - -echo "====================================================================" -echo "Add required Ubuntu packages, including header files for compilation" -echo "====================================================================" -sudo apt-get install git-core python-setuptools libvtk5.2 python-vtk python-numpy python-wxversion python2.6-dev python-sphinx g++ swig python-configobj glutg3 glutg3-dev libxtst-dev ipython python-lxml python-matplotlib python-qscintilla2 gcc scons python-xlib pyqt4-dev-tools python-scipy python-pyrex python-all-dev libxt-dev libglu1-mesa-dev python-pip wget python-wxgtk2.8 python-h5py python-envisagecore python-envisageplugins python-traitsbackendwx python-traitsbackendqt python-traitsgui python-traits python-enthought-traits-ui python-enthoughtbase python-chaco python-lxml python-h5py mayavi2 python-tables python-tables-doc python-apptools python-enthought-traits python-pip python-wxtools python-dicom - - -echo "=========================================================" -echo "Install/Update required packages for the ConnectomeViewer" -echo "=========================================================" - -echo "============" -echo "... NetworkX" -echo "============" -# pip install networkx -sudo easy_install -U networkx - -echo "==========" -echo "... Cython" -echo "==========" -# pip install Cython -sudo easy_install -U Cython - -echo "=========================================" -echo "Download and install the ConnectomeViewer" -echo "=========================================" -echo "You can browse the ConnectomeViewer folder for tutorial examples, external packages documentation etc." -# sudo pip install -e git://github.com/LTS5/connectomeviewer.git@master#egg=ConnectomeViewer - -wget --no-check-certificate http://github.com/downloads/LTS5/connectomeviewer/ConnectomeViewer-0.1.9.tar.gz -tar xzf ConnectomeViewer-0.1.9.tar.gz -cd ConnectomeViewer-0.1.9/ -sudo python setup.py install -cd .. -# Keep the folder to see examples etc. -# rm -rf ConnectomeViewer-0.1.9/ -rm -f ConnectomeViewer-0.1.9.tar.gz - -echo "===================================================" -echo "The installation script is finished. It may well be that errors have occured." -echo "If you got a Permission error. Try to rerun the script with 'sudo ./install_cviewer_ubuntu.sh'" -echo "" -echo "Test your ConnectomeViewer installation by typing in the terminal:" -echo "-----------" -echo "connectomeviewer.py -v" -echo "-----------" -echo "" -echo "You can also execute it from IPython:" -echo "-----------" -echo "from cviewer.run import main" -echo "main()" -echo "-----------" -echo "" -echo "If there are problems, rerun the installation script with:" -echo "----------- -echo "sh ./install_cviewer_ubuntu.sh > logfile.txt" -echo "----------- -echo "Send the logfile.txt together with ConnectomeViewer startup logfile (automatically generated) to [email protected]." -echo "=============================================================" - -# ==================================================================== -# Add required Ubuntu packages, including header files for compilation -# ==================================================================== -# Paketlisten werden gelesen... Fertig -# Abhängigkeitsbaum wird aufgebaut -# Status-Informationen einlesen... Fertig -# gcc ist schon die neueste Version. -# wget ist schon die neueste Version. -# Die folgenden zusätzlichen Pakete werden installiert: -# blt freeglut3 freeglut3-dev g++-4.4 global libamd2.2.0 libaudio2 libavcodec52 libavformat52 libavutil49 libblas3gf libdigest-sha1-perl -# libdrm-dev liberror-perl libgfortran3 libgl1-mesa-dev libgl1-mesa-glx libgl2ps0 libglu1-mesa libgsm1 libhdf5-serial-1.8.4 libibverbs1 -# # libice-dev liblapack3gf libmng1 libmysqlclient16 libnuma1 libopenmpi1.3 libphonon4 libpthread-stubs0 libpthread-stubs0-dev -# libqscintilla2-5 libqt4-assistant libqt4-dbus libqt4-designer libqt4-help libqt4-network libqt4-script libqt4-scripttools libqt4-sql -# libqt4-sql-mysql libqt4-svg libqt4-test libqt4-webkit libqt4-xml libqt4-xmlpatterns libqtcore4 libqtgui4 libschroedinger-1.0-0 libsm-dev -# libstdc++6-4.4-dev libswscale0 libumfpack5.4.0 libwxbase2.8-0 libwxgtk2.8-0 libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxext-dev -# libxi-dev mesa-common-dev mysql-common patch python-all python-dateutil python-dev python-docutils python-enable python-foolscap -# python-jinja2 python-matplotlib-data python-pygments python-pyparsing python-qt4 python-roman python-sip python-tk python-tz tcl8.5 tk8.5 -# ttf-lyx x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-record-dev x11proto-xext-dev xtrans-dev -# Vorgeschlagene Pakete: -# blt-demo g++-multilib g++-4.4-multilib gcc-4.4-doc libstdc++6-4.4-dbg git-doc git-arch git-cvs git-svn git-email git-daemon-run git-gui -# gitk gitweb doxygen apache httpd id-utils python-profiler nas libqt4-dev qt4-qtconfig libstdc++6-4.4-doc openmpi-bin lam-runtime -# libvtk5-dev vtk-examples vtk-doc libgnomeprintui2.2-0 diffutils-doc texlive-latex-recommended texlive-latex-base texlive-lang-french -# python-jinja2-doc python-lxml-dbg dvipng python-excelerator python-matplotlib-doc texlive-extra-utils texlive-latex-extra python-qt3 -# python-numpy-doc python-numpy-dbg python-nose python-chardet python-qt4-dbg jsmath python-netcdf tix python-tk-dbg wx2.8-doc -# wx2.8-examples python-wxtools ruby tcsh csh octave3.0 mksh pdksh swig-examples swig-doc tclreadline -# Die folgenden NEUEN Pakete werden installiert: -# blt freeglut3 freeglut3-dev g++ g++-4.4 git-core global glutg3 glutg3-dev ipython libamd2.2.0 libaudio2 libavcodec52 libavformat52 -# libavutil49 libblas3gf libdigest-sha1-perl libdrm-dev liberror-perl libgfortran3 libgl1-mesa-dev libgl2ps0 libglu1-mesa-dev libgsm1 -# # # libhdf5-serial-1.8.4 libibverbs1 libice-dev liblapack3gf libmng1 libmysqlclient16 libnuma1 libopenmpi1.3 libphonon4 libpthread-stubs0 -# libpthread-stubs0-dev libqscintilla2-5 libqt4-assistant libqt4-dbus libqt4-designer libqt4-help libqt4-network libqt4-script -# libqt4-scripttools libqt4-sql libqt4-sql-mysql libqt4-svg libqt4-test libqt4-webkit libqt4-xml libqt4-xmlpatterns libqtcore4 libqtgui4 -# # libschroedinger-1.0-0 libsm-dev libstdc++6-4.4-dev libswscale0 libumfpack5.4.0 libvtk5.2 libwxbase2.8-0 libwxgtk2.8-0 libx11-dev -# libxau-dev libxcb1-dev libxdmcp-dev libxext-dev libxi-dev libxt-dev libxtst-dev mayavi2 mesa-common-dev mysql-common patch -# pyqt4-dev-tools python-all python-all-dev python-apptools python-chaco python-configobj python-dateutil python-dev python-docutils -# python-enable python-enthought-traits python-enthought-traits-ui python-enthoughtbase python-envisagecore python-envisageplugins -# python-foolscap python-h5py python-jinja2 python-lxml python-matplotlib python-matplotlib-data python-numpy python-pip python-pygments -# python-pyparsing python-pyrex python-qscintilla2 python-qt4 python-roman python-scipy python-setuptools python-sip python-sphinx -# python-tables python-tables-doc python-tk python-traits python-traitsbackendqt python-traitsbackendwx python-traitsgui python-tz -# python-vtk python-wxgtk2.8 python-wxversion python-xlib python2.6-dev scons swig tcl8.5 tk8.5 ttf-lyx x11proto-core-dev -# x11proto-input-dev x11proto-kb-dev x11proto-record-dev x11proto-xext-dev xtrans-dev -# Die folgenden Pakete werden aktualisiert: -# libgl1-mesa-glx libglu1-mesa -# # 2 aktualisiert, 129 neu installiert, 0 zu entfernen und 237 nicht aktualisiert. -# Es müssen 163MB an Archiven heruntergeladen werden. -# Nach dieser Operation werden 469MB Plattenplatz zusätzlich benutzt. -# Möchten Sie fortfahren [J/n]? - - diff --git a/scripts/install_cviewer_ubuntu10_10.sh b/scripts/install_cviewer_ubuntu10_10.sh deleted file mode 100644 index d8b42b7..0000000 --- a/scripts/install_cviewer_ubuntu10_10.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh - -echo "Welcome to the Installation Script for ConnectomeViewer BETA" -echo "============================================================" -echo "Do you want to download the example datasets ? [Y]es / [N]o " -read exdata -case "$exdata" in -# Note variable is quoted. - - "Y" | "y" | "yes" | "Yes" ) - echo "=========================================" - echo "Download Connectome File Example datasets" - echo "=========================================" - echo "Type the full path to store ConnectomeViewer datasets:" - read fullp - mkdir -p $fullp - cd $fullp - wget http://www.connectomeviewer.org/datasets/homo_sapiens_01.cff - wget http://www.connectomeviewer.org/datasets/homo_sapiens_02.cff - wget http://www.connectomeviewer.org/datasets/homo_sapiens_03.cff - wget http://www.connectomeviewer.org/datasets/macaca_mulatta_01.cff - cd .. - ;; - * ) - # Default option. - # Empty input (hitting RETURN) fits here, too. - echo - echo "Not downloading Connectome File example datasets." - ;; - -esac - - -echo "====================================================================" -echo "Add required Ubuntu packages, including header files for compilation" -echo "====================================================================" -sudo apt-get update -sudo apt-get install git-core python-setuptools libvtk5.4 python-vtk python-numpy python-wxversion python2.6-dev g++ swig python-configobj glutg3 glutg3-dev libxtst-dev ipython python-lxml -sudo apt-get install python-matplotlib python-qscintilla2 gcc scons python-xlib pyqt4-dev-tools python-scipy python-pyrex python-all-dev python-dicom -sudo apt-get install libxt-dev libglu1-mesa-dev python-pip wget python-wxgtk2.8 python-h5py python-envisagecore python-envisageplugins python-traitsbackendwx python-traitsbackendqt python-traitsgui python-enthoughtbase python-chaco python-lxml python-h5py mayavi2 python-tables python-tables-doc python-apptools python-pip python-wxtools python-sphinx - -echo "=========================================================" -echo "Install/Update required packages for the ConnectomeViewer" -echo "=========================================================" - -echo "============" -echo "... NetworkX" -echo "============" -sudo pip install --upgrade networkx - -echo "==========" -echo "... Cython" -echo "==========" -sudo pip install --upgrade Cython - -echo "===========" -echo "... Nibabel" -echo "===========" -sudo pip install --upgrade nibabel - -echo "=========================================" -echo "Download and install the ConnectomeViewer" -echo "=========================================" - -# sudo pip install -e git://github.com/LTS5/connectomeviewer.git@master#egg=ConnectomeViewer - -wget --no-check-certificate http://github.com/downloads/LTS5/connectomeviewer/ConnectomeViewer-0.1.9.tar.gz -tar xzf ConnectomeViewer-0.1.9.tar.gz -cd ConnectomeViewer-0.1.9/ -sudo python setup.py install -cd .. -sudo rm -rf ConnectomeViewer-0.1.9/ - -echo "===================================================" -echo "The installation script is finished. It may well be that errors have occured." -echo "If you got a Permission error. Try to rerun the script with 'sudo ./install_cviewer_ubuntu.sh'" -ECHO "" -echo "Test your ConnectomeViewer installation by typing in the terminal: -echo "----------- -echo "connectomeviewer.py -v -echo "----------- -echo "" -echo "If there are problems, rerun the installation script with:" -echo "----------- -echo "sh ./install_cviewer_ubuntu10_10.sh > logfile.txt" -echo "----------- -echo "Send the logfile.txt together with ConnectomeViewer startup logfile (automatically generated) to [email protected]." -echo "=============================================================" - diff --git a/setup.py b/setup.py index 402b33e..bf6688c 100644 --- a/setup.py +++ b/setup.py @@ -1,95 +1,95 @@ #!/usr/bin/env python import sys from glob import glob from distutils import log from distutils.cmd import Command import numpy as np # monkey-patch numpy distutils to use Cython instead of Pyrex -from build_helpers import generate_a_pyrex_source, package_check, make_cython_ext, INFO_VARS +from build_helpers import package_check, INFO_VARS #from numpy.distutils.command.build_src import build_src #build_src.generate_a_pyrex_source = generate_a_pyrex_source def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options(ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True) config.add_subpackage('cviewer') return config ################################################################################ # Dependency check ################################################################################ def _mayavi_version(pkg_name): from enthought.mayavi import version return version.version def _traits_version(pkg_name): from enthought.traits import version return version.__version__ package_check('scipy', INFO_VARS['scipy_min_version']) package_check('networkx', INFO_VARS['networkx_min_version']) package_check('numpy', INFO_VARS['numpy_min_version']) package_check('enthought.mayavi', INFO_VARS['mayavi_min_version'],version_getter=_mayavi_version) package_check('enthought.traits', INFO_VARS['traits_min_version'],version_getter=_traits_version) ################################################################################ ################################################################################ # For some commands, use setuptools if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', 'egg_info', 'easy_install', )).intersection(sys.argv)) > 0: from setup_egg import extra_setuptools_args # extra_setuptools_args can be defined from the line above, but it can # also be defined here because setup.py has been exec'ed from # setup_egg.py. if not 'extra_setuptools_args' in globals(): extra_setuptools_args = dict() def main(**extra_args): from numpy.distutils.core import setup setup( - name = 'ConnectomeViewer', + name = 'Connectome Viewer', version = INFO_VARS['version'], author = "Stephan Gerhard", author_email = "[email protected]", classifiers = [c.strip() for c in """\ Development Status :: 4 - Beta Intended Audience :: Developers Intended Audience :: Science/Research Operating System :: OS Independent Operating System :: POSIX Operating System :: POSIX :: Linux Operating System :: Unix Programming Language :: Python Topic :: Scientific/Engineering Topic :: Software Development """.splitlines() if len(c.split()) > 0], description = "Multi-Modal MR Connectomics Framework for Analysis and Visualization", license = "Modified BSD License", long_description = INFO_VARS['long_description'], maintainer = 'Stephan Gerhard', maintainer_email = '[email protected]', platforms = ["Linux", "Unix"], url = 'http://www.connectomeviewer.org/', scripts = glob('scripts/*'), # ext_modules = [per_ext, tvol_ext, rec_ext], configuration = configuration, **extra_args ) if __name__ == "__main__": main()
LTS5/connectomeviewer
3d912ab517ada563f58efd10fe64660ba48035af
Adding hint to XNAT code oracle
diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index ffd5842..7a4521c 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,570 +1,575 @@ nipypebet = """ # Prerequisite: # 1. You need to have Nipype installed on your system. You can check this by entering # import nipype # In the IPython console. If it gives an error, you might want to install it from NeuroDebian. # See http://neuro.debian.net/ - Documentation is on http://nipy.sourceforge.net/nipype/ # 2. For this simple brain extraction script, you need to have FSL installed. # Goal: # This script shows how to extract the brain using BET through the Nipype interface. # It is derived from http://nipy.sourceforge.net/nipype/users/dartmouth_workshop_2010.html # As an input, you need a T1-weighted image that as an input to the Nipype node. rawimage = cfile.obj.get_by_name('MYRAWT1IMAGE') # Let's check if the metadata agrees with what is expected (it should say "T1-weighted") print rawimage.dtype # We do not necessarily need to load the connectome object - if the connectome file is extracted # locally. We just need to retrieve the absolute file path rawimage_pwd = rawimage.get_abs_path() # We need the Nipype FSL interface import nipype.interfaces.fsl as fsl # We set the FSL default output type to compressed Nifti-1 fsl.FSLCommand.set_default_output_type('NIFTI_GZ') # We want to store the processed file in the temporary folder for now. fname_out = '/tmp/only_brain.nii.gz' # Now, we run the Nipype BET node, providing the correct input result = fsl.BET(in_file=rawimage_pwd, out_file = fname_out ).run() # We can print the result print result.outputs # To add the processed data file to the currently loaded connectome file, ... #cvol = cf.CVolume(name="BETed brain", src=fname_out, fileformat='Nifti1GZ', dtype='T1-weighted') #cfile.obj.add_connectome_volume(cvol) # Make sure that you save the connectome file if you want to keep the processed file. """ pushpull = """ # Prerequisite: # 1. For this script to run, you need to have PyXNAT installed # on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ # 2. You need to have access to an XNAT server and a project # You can create a login and project here: # http://central.xnat.org/ # http://sandbox.xnat.org/ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server +# Hint: +# If you plan to retrieve or upload big datasets, it is recommended to run this +# script in an external Python shell, as long script executions block the IPython +# shell within the Connectome Viewer. + # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection a.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT a.push( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. #a.pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data labelname = "%s" surface_file_labels = cfile.obj.get_by_name(labelname) # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if labelname == "None": labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Import Numpy import numpy as np # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Final Tractography (freesurferaparc)").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Final fiber labels (freesurferaparc)").data fromid = 8 toid = 10 # Defining some helper functions # ------------------------------ def sidx(arr, fromval, toval): " Returns the indices that are equal to a given value " return np.where( (arr[:,0] == fromval) & (arr[:,1] == toval) )[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromid, toid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.algorithms.statistics.nbs as nbs # Retrieving the data and set parameters # -------------------------------------- # Define your groups # Retrieve the corresponding CNetwork objects firstgroup = cfile.obj.get_by_name(%s) first_edge_value = '%s' secondgroup = cfile.obj.get_by_name(%s) second_edge_value = '%s' THRESH=%s K=%s TAIL='%s' SHOW_MATRIX = False # =========== # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a thread PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s', nbsgraph, dtype='NBSResult') cfile.update_children() """ volrendering = """ from enthought.mayavi import mlab import numpy as np data=np.random.random( (10,10,10)) min = data.min() max = data.max() source=mlab.pipeline.scalar_field(data) vol = mlab.pipeline.volume(source, vmin=min+0.65*(max-min), vmax=min+0.9*(max-min)) """ volslice = """ # Import Mayavi mlab interface from enthought.mayavi import mlab # Import NumPy import numpy as np # Retrieving the data and set parameters # -------------------------------------- # the CVolume name volname="%s" # Retrieve volume data (as Nibabel Image) voldat = cfile.obj.get_by_name(volname).data # Retrieve the image data data = voldat.get_data() # Retrieve the affine affine = voldat.get_affine() center = np.r_[0, 0, 0, 1] # Perform task # ------------ # create A ScalarField with spacing and origin from the affine data_src = mlab.pipeline.scalar_field(data) data_src.spacing = np.diag(affine)[:3] data_src.origin = np.dot(affine, center)[:3] # Create an outline mlab.pipeline.outline(data_src) # Create a simple x-aligned image plane widget image_plane_widget = mlab.pipeline.image_plane_widget(data_src, name=volname) image_plane_widget.ipw.plane_orientation = 'x_axes' image_plane_widget.ipw.reslice_interpolate = 'nearest_neighbour' """ reportlab = """ # Credits # http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/ # Import ReportLab from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch # Import NetworkX import networkx # Retrieving the data and set parameters # -------------------------------------- PAGE_HEIGHT=defaultPageSize[1] styles = getSampleStyleSheet() Title = "Connectome Report: " URL = "http://www.connectomics.org/" email = "[email protected]" Elements=[] HeaderStyle = styles["Heading1"] ParaStyle = styles["Normal"] PreStyle = styles["Code"] # load data net=a.get_by_name("%s") net.load() g=net.data netw = g def header(txt, style=HeaderStyle, klass=Paragraph, sep=0.3): s = Spacer(0.2*inch, sep*inch) para = klass(txt, style) sect = [s, para] result = KeepTogether(sect) return result
LTS5/connectomeviewer
94520584dc67513cae2e84c9467881602fb1841b
Fix bug when display surfaces
diff --git a/cviewer/plugins/codeoracle/actions.py b/cviewer/plugins/codeoracle/actions.py index 3450652..7ac7068 100644 --- a/cviewer/plugins/codeoracle/actions.py +++ b/cviewer/plugins/codeoracle/actions.py @@ -1,273 +1,273 @@ import logging from enthought.io.api import File from enthought.pyface.api import FileDialog, OK from enthought.pyface.action.api import Action from enthought.traits.api import Any from cviewer.plugins.text_editor.editor.text_editor import TextEditor from cviewer.plugins.ui.preference_manager import preference_manager # Logging imports import logging logger = logging.getLogger('root.'+__name__) class NipypeBet(Action): tooltip = "Brain extraction using BET" description = "Brain extraction using BET" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import nipypebet import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nipypebet) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowTracks(Action): tooltip = "Show tracks between two regions" description = "Show tracks between two regions" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import ctrackedge import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(ctrackedge) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class XNATPushPull(Action): tooltip = "Push and pull files from and to XNAT Server" description = "Push and pull files from and to XNAT Server" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import pushpull import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(pushpull) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ComputeNBS(Action): tooltip = "Compute NBS" description = "Compute NBS" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_nbs_action import NBSNetworkParameter, NBSMoreParameter from scripts import nbsscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NBSNetworkParameter(cfile) no.edit_traits(kind='livemodal') if (len(no.selected1) == 0 or len(no.selected2) == 0): return mo = NBSMoreParameter(cfile, no.selected1[0], no.selected2[0]) mo.edit_traits(kind='livemodal') import datetime as dt a=dt.datetime.now() ostr = '%s%s%s' % (a.hour, a.minute, a.second) if not (len(no.selected1) == 0 or len(no.selected2) == 0): # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nbsscript % (str(no.selected1), mo.first_edge_value, str(no.selected2), mo.second_edge_value, mo.THRES, mo.K, mo.TAIL, ostr)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowNetworks(Action): tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import NetworkParameter from scripts import netscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(netscript % (no.netw[no.graph]['name'], no.node_position, no.edge_value, no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ConnectionMatrix(Action): tooltip = "Show connection matrix" description = "Show connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixNetworkParameter from scripts import conmatrix cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrix % (no.netw[no.graph]['name'], no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class SimpleConnectionMatrix(Action): tooltip = "Show simple connection matrix" description = "Show simple connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixEdgeNetworkParameter from scripts import conmatrixpyplot cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixEdgeNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrixpyplot % (no.netw[no.graph]['name'], no.edge_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowSurfaces(Action): """ Open a new file in the text editor """ tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from csurface_action import SurfaceParameter from scripts import surfscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = SurfaceParameter(cfile) so.edit_traits(kind='livemodal') if not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') if so.labels_da[so.labels].has_key('da_idx'): labels = so.labels_da[so.labels]['da_idx'] else: - labels = "" + labels = 0 f.write(surfscript % (so.pointset_da[so.pointset]['name'], so.pointset_da[so.pointset]['da_idx'], so.faces_da[so.faces]['name'], so.faces_da[so.faces]['da_idx'], so.labels_da[so.labels]['name'], labels)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowVolumes(Action): """ Open a new file in the text editor """ tooltip = "Create a volume" description = "Create a volume" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cvolume_action import VolumeParameter from scripts import volslice cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = VolumeParameter(cfile) so.edit_traits(kind='livemodal') if True: #not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(volslice % so.volumes[so.myvolume]['name']) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index d88f861..ffd5842 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,625 +1,626 @@ nipypebet = """ # Prerequisite: # 1. You need to have Nipype installed on your system. You can check this by entering # import nipype # In the IPython console. If it gives an error, you might want to install it from NeuroDebian. # See http://neuro.debian.net/ - Documentation is on http://nipy.sourceforge.net/nipype/ # 2. For this simple brain extraction script, you need to have FSL installed. # Goal: # This script shows how to extract the brain using BET through the Nipype interface. # It is derived from http://nipy.sourceforge.net/nipype/users/dartmouth_workshop_2010.html # As an input, you need a T1-weighted image that as an input to the Nipype node. rawimage = cfile.obj.get_by_name('MYRAWT1IMAGE') # Let's check if the metadata agrees with what is expected (it should say "T1-weighted") print rawimage.dtype # We do not necessarily need to load the connectome object - if the connectome file is extracted # locally. We just need to retrieve the absolute file path rawimage_pwd = rawimage.get_abs_path() # We need the Nipype FSL interface import nipype.interfaces.fsl as fsl # We set the FSL default output type to compressed Nifti-1 fsl.FSLCommand.set_default_output_type('NIFTI_GZ') # We want to store the processed file in the temporary folder for now. fname_out = '/tmp/only_brain.nii.gz' # Now, we run the Nipype BET node, providing the correct input result = fsl.BET(in_file=rawimage_pwd, out_file = fname_out ).run() # We can print the result print result.outputs # To add the processed data file to the currently loaded connectome file, ... #cvol = cf.CVolume(name="BETed brain", src=fname_out, fileformat='Nifti1GZ', dtype='T1-weighted') #cfile.obj.add_connectome_volume(cvol) # Make sure that you save the connectome file if you want to keep the processed file. """ pushpull = """ # Prerequisite: # 1. For this script to run, you need to have PyXNAT installed # on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ # 2. You need to have access to an XNAT server and a project # You can create a login and project here: # http://central.xnat.org/ # http://sandbox.xnat.org/ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection a.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT a.push( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. #a.pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data -surface_file_labels = cfile.obj.get_by_name("%s") +labelname = "%s" +surface_file_labels = cfile.obj.get_by_name(labelname) # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels -if surface_file_labels is None: +if labelname == "None": labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Import Numpy import numpy as np # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Final Tractography (freesurferaparc)").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Final fiber labels (freesurferaparc)").data fromid = 8 toid = 10 # Defining some helper functions # ------------------------------ def sidx(arr, fromval, toval): " Returns the indices that are equal to a given value " return np.where( (arr[:,0] == fromval) & (arr[:,1] == toval) )[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromid, toid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.algorithms.statistics.nbs as nbs # Retrieving the data and set parameters # -------------------------------------- # Define your groups # Retrieve the corresponding CNetwork objects firstgroup = cfile.obj.get_by_name(%s) first_edge_value = '%s' secondgroup = cfile.obj.get_by_name(%s) second_edge_value = '%s' THRESH=%s K=%s TAIL='%s' SHOW_MATRIX = False # =========== # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a thread PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s', nbsgraph, dtype='NBSResult') cfile.update_children() """ volrendering = """ from enthought.mayavi import mlab import numpy as np data=np.random.random( (10,10,10)) min = data.min() max = data.max() source=mlab.pipeline.scalar_field(data) vol = mlab.pipeline.volume(source, vmin=min+0.65*(max-min), vmax=min+0.9*(max-min)) """ volslice = """ # Import Mayavi mlab interface from enthought.mayavi import mlab # Import NumPy import numpy as np # Retrieving the data and set parameters # -------------------------------------- # the CVolume name volname="%s" # Retrieve volume data (as Nibabel Image) voldat = cfile.obj.get_by_name(volname).data # Retrieve the image data data = voldat.get_data() # Retrieve the affine affine = voldat.get_affine() center = np.r_[0, 0, 0, 1] # Perform task # ------------ # create A ScalarField with spacing and origin from the affine data_src = mlab.pipeline.scalar_field(data) data_src.spacing = np.diag(affine)[:3] data_src.origin = np.dot(affine, center)[:3] # Create an outline mlab.pipeline.outline(data_src) # Create a simple x-aligned image plane widget image_plane_widget = mlab.pipeline.image_plane_widget(data_src, name=volname) image_plane_widget.ipw.plane_orientation = 'x_axes' image_plane_widget.ipw.reslice_interpolate = 'nearest_neighbour' """ reportlab = """ # Credits # http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/ # Import ReportLab from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch # Import NetworkX import networkx # Retrieving the data and set parameters # -------------------------------------- PAGE_HEIGHT=defaultPageSize[1] styles = getSampleStyleSheet() Title = "Connectome Report: " URL = "http://www.connectomics.org/" email = "[email protected]" Elements=[] HeaderStyle = styles["Heading1"] ParaStyle = styles["Normal"] PreStyle = styles["Code"] # load data net=a.get_by_name("%s") net.load() g=net.data netw = g def header(txt, style=HeaderStyle, klass=Paragraph, sep=0.3): s = Spacer(0.2*inch, sep*inch) para = klass(txt, style) sect = [s, para] result = KeepTogether(sect) return result def p(txt): return header(txt, style=ParaStyle, sep=0.1) def pre(txt): s = Spacer(0.1*inch, 0.1*inch) p = Preformatted(txt, PreStyle) precomps = [s,p] result = KeepTogether(precomps) return result def go(): doc = SimpleDocTemplate('gfe.pdf') doc.build(Elements) mytitle = header(Title + a.get_connectome_meta().get_title()) mysite = header(URL, sep=0.1, style=ParaStyle) mymail = header(email, sep=0.1, style=ParaStyle) myabstract = p(Abstract) head_info = [mytitle, mysite, mymail] code_title = header("Basic code to produce output") code_explain = p("This is a snippet of code. It's an example using the Preformatted flowable object, which makes it easy to put code into your documents. Enjoy!") mytitlenet = header(net.get_name()) import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import networkx as nx for u,v,d in netw.edges_iter(data=True): netw.edge[u][v]['weight'] = netw.edge[u][v]['de_adcmean'] b=nx.to_numpy_matrix(netw) fig = plt.figure() fig.suptitle("Connection matrix") aa= plt.imshow(b, interpolation='nearest', cmap=plt.cm.jet, vmin = b.min(), vmax=b.max()) fig.savefig('matrix.png') fig.clear() fig.suptitle("Degree distribution") plt.hist(netw.degree().values(),30) fig.savefig('distri.png') # measures me1 = p("Number of Nodes: " + str(netw.number_of_nodes())) me2 = p("Number of Edges: " + str(netw.number_of_edges())) me3 = p("Is network connected: " + str(nx.is_connected(netw))) me4 = p("Number of connected components: " + str(nx.number_connected_components(netw)))
LTS5/connectomeviewer
d7ef02d5b2087ca7e6bfbddd0b79342aae274f94
Fixes in the Code Oracle
diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index d9af8bf..d88f861 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,636 +1,638 @@ nipypebet = """ # Prerequisite: # 1. You need to have Nipype installed on your system. You can check this by entering # import nipype # In the IPython console. If it gives an error, you might want to install it from NeuroDebian. # See http://neuro.debian.net/ - Documentation is on http://nipy.sourceforge.net/nipype/ # 2. For this simple brain extraction script, you need to have FSL installed. # Goal: # This script shows how to extract the brain using BET through the Nipype interface. # It is derived from http://nipy.sourceforge.net/nipype/users/dartmouth_workshop_2010.html # As an input, you need a T1-weighted image that as an input to the Nipype node. rawimage = cfile.obj.get_by_name('MYRAWT1IMAGE') # Let's check if the metadata agrees with what is expected (it should say "T1-weighted") print rawimage.dtype # We do not necessarily need to load the connectome object - if the connectome file is extracted # locally. We just need to retrieve the absolute file path rawimage_pwd = rawimage.get_abs_path() # We need the Nipype FSL interface import nipype.interfaces.fsl as fsl # We set the FSL default output type to compressed Nifti-1 fsl.FSLCommand.set_default_output_type('NIFTI_GZ') # We want to store the processed file in the temporary folder for now. fname_out = '/tmp/only_brain.nii.gz' # Now, we run the Nipype BET node, providing the correct input result = fsl.BET(in_file=rawimage_pwd, out_file = fname_out ).run() # We can print the result print result.outputs # To add the processed data file to the currently loaded connectome file, ... #cvol = cf.CVolume(name="BETed brain", src=fname_out, fileformat='Nifti1GZ', dtype='T1-weighted') #cfile.obj.add_connectome_volume(cvol) # Make sure that you save the connectome file if you want to keep the processed file. """ pushpull = """ # Prerequisite: # 1. For this script to run, you need to have PyXNAT installed # on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ # 2. You need to have access to an XNAT server and a project # You can create a login and project here: # http://central.xnat.org/ # http://sandbox.xnat.org/ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection a.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT a.push( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. #a.pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data surface_file_labels = cfile.obj.get_by_name("%s") # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if surface_file_labels is None: labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm +# Import Numpy +import numpy as np # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- -a = cfile.obj.get_by_name("Filtered Tractography").get_fibers_as_numpy() -fiberlabels = cfile.obj.get_by_name("Fiber labels (freesurferaparc)").data - -fromtofloatid = 8.10 +a = cfile.obj.get_by_name("Final Tractography (freesurferaparc)").get_fibers_as_numpy() +fiberlabels = cfile.obj.get_by_name("Final fiber labels (freesurferaparc)").data +fromid = 8 +toid = 10 # Defining some helper functions # ------------------------------ -def sidx(arr, value): +def sidx(arr, fromval, toval): " Returns the indices that are equal to a given value " - return np.where( arr == value)[0] + return np.where( (arr[:,0] == fromval) & (arr[:,1] == toval) )[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ -idx = sidx(fiberlabels, fromtofloatid) +idx = sidx(fiberlabels, fromid, toid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.algorithms.statistics.nbs as nbs # Retrieving the data and set parameters # -------------------------------------- # Define your groups # Retrieve the corresponding CNetwork objects firstgroup = cfile.obj.get_by_name(%s) first_edge_value = '%s' secondgroup = cfile.obj.get_by_name(%s) second_edge_value = '%s' THRESH=%s K=%s TAIL='%s' SHOW_MATRIX = False # =========== # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a thread PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s', nbsgraph, dtype='NBSResult') cfile.update_children() """ volrendering = """ from enthought.mayavi import mlab import numpy as np data=np.random.random( (10,10,10)) min = data.min() max = data.max() source=mlab.pipeline.scalar_field(data) vol = mlab.pipeline.volume(source, vmin=min+0.65*(max-min), vmax=min+0.9*(max-min)) """ volslice = """ # Import Mayavi mlab interface from enthought.mayavi import mlab # Import NumPy import numpy as np # Retrieving the data and set parameters # -------------------------------------- # the CVolume name volname="%s" # Retrieve volume data (as Nibabel Image) voldat = cfile.obj.get_by_name(volname).data # Retrieve the image data data = voldat.get_data() # Retrieve the affine affine = voldat.get_affine() center = np.r_[0, 0, 0, 1] # Perform task # ------------ # create A ScalarField with spacing and origin from the affine data_src = mlab.pipeline.scalar_field(data) data_src.spacing = np.diag(affine)[:3] data_src.origin = np.dot(affine, center)[:3] # Create an outline mlab.pipeline.outline(data_src) # Create a simple x-aligned image plane widget image_plane_widget = mlab.pipeline.image_plane_widget(data_src, name=volname) image_plane_widget.ipw.plane_orientation = 'x_axes' image_plane_widget.ipw.reslice_interpolate = 'nearest_neighbour' """ reportlab = """ # Credits # http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/ # Import ReportLab from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch # Import NetworkX import networkx # Retrieving the data and set parameters # -------------------------------------- PAGE_HEIGHT=defaultPageSize[1] styles = getSampleStyleSheet() Title = "Connectome Report: " URL = "http://www.connectomics.org/" email = "[email protected]" Elements=[] HeaderStyle = styles["Heading1"] ParaStyle = styles["Normal"] PreStyle = styles["Code"] # load data net=a.get_by_name("%s") net.load() g=net.data netw = g def header(txt, style=HeaderStyle, klass=Paragraph, sep=0.3): s = Spacer(0.2*inch, sep*inch) para = klass(txt, style) sect = [s, para] result = KeepTogether(sect) return result def p(txt): return header(txt, style=ParaStyle, sep=0.1) def pre(txt): s = Spacer(0.1*inch, 0.1*inch) p = Preformatted(txt, PreStyle) precomps = [s,p] result = KeepTogether(precomps) return result def go(): doc = SimpleDocTemplate('gfe.pdf') doc.build(Elements) mytitle = header(Title + a.get_connectome_meta().get_title()) mysite = header(URL, sep=0.1, style=ParaStyle) mymail = header(email, sep=0.1, style=ParaStyle) myabstract = p(Abstract) head_info = [mytitle, mysite, mymail] code_title = header("Basic code to produce output") code_explain = p("This is a snippet of code. It's an example using the Preformatted flowable object, which makes it easy to put code into your documents. Enjoy!") mytitlenet = header(net.get_name()) import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import networkx as nx for u,v,d in netw.edges_iter(data=True): netw.edge[u][v]['weight'] = netw.edge[u][v]['de_adcmean'] b=nx.to_numpy_matrix(netw) fig = plt.figure() fig.suptitle("Connection matrix") aa= plt.imshow(b, interpolation='nearest', cmap=plt.cm.jet, vmin = b.min(), vmax=b.max()) fig.savefig('matrix.png') fig.clear() fig.suptitle("Degree distribution") plt.hist(netw.degree().values(),30) fig.savefig('distri.png') # measures me1 = p("Number of Nodes: " + str(netw.number_of_nodes())) me2 = p("Number of Edges: " + str(netw.number_of_edges())) me3 = p("Is network connected: " + str(nx.is_connected(netw))) me4 = p("Number of connected components: " + str(nx.number_connected_components(netw))) me5 = p("Average unweighted shortest path length: " + str(nx.average_shortest_path_length(netw, weighted = False))) me6 = p("Average Clustering Coefficient: " + str(nx.average_clustering(netw))) logo = "matrix.png" im1 = Image(logo, 300,225) logo = "distri.png" im2 = Image(logo, 250,188) codesection = [mytitle, mysite, mymail, mytitlenet, im1, im2, me1, me2, me3, me4, me5, me6] src = KeepTogether(codesection) Elements.append(src) go() """ \ No newline at end of file
LTS5/connectomeviewer
005c35cc9502d19a6456150dba869f5380df6630
Adding nipype bet script
diff --git a/cviewer/plugins/codeoracle/actions.py b/cviewer/plugins/codeoracle/actions.py index 823d08e..3450652 100644 --- a/cviewer/plugins/codeoracle/actions.py +++ b/cviewer/plugins/codeoracle/actions.py @@ -1,251 +1,273 @@ import logging from enthought.io.api import File from enthought.pyface.api import FileDialog, OK from enthought.pyface.action.api import Action from enthought.traits.api import Any from cviewer.plugins.text_editor.editor.text_editor import TextEditor from cviewer.plugins.ui.preference_manager import preference_manager # Logging imports import logging logger = logging.getLogger('root.'+__name__) + + +class NipypeBet(Action): + tooltip = "Brain extraction using BET" + description = "Brain extraction using BET" + + # The WorkbenchWindow the action is attached to. + window = Any() + + def perform(self, event=None): + + from scripts import nipypebet + + import tempfile + myf = tempfile.mktemp(suffix='.py', prefix='my') + f=open(myf, 'w') + f.write(nipypebet) + f.close() + + self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) + + class ShowTracks(Action): tooltip = "Show tracks between two regions" description = "Show tracks between two regions" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import ctrackedge import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(ctrackedge) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class XNATPushPull(Action): tooltip = "Push and pull files from and to XNAT Server" description = "Push and pull files from and to XNAT Server" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import pushpull import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(pushpull) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ComputeNBS(Action): tooltip = "Compute NBS" description = "Compute NBS" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_nbs_action import NBSNetworkParameter, NBSMoreParameter from scripts import nbsscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NBSNetworkParameter(cfile) no.edit_traits(kind='livemodal') if (len(no.selected1) == 0 or len(no.selected2) == 0): return mo = NBSMoreParameter(cfile, no.selected1[0], no.selected2[0]) mo.edit_traits(kind='livemodal') import datetime as dt a=dt.datetime.now() ostr = '%s%s%s' % (a.hour, a.minute, a.second) if not (len(no.selected1) == 0 or len(no.selected2) == 0): # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nbsscript % (str(no.selected1), mo.first_edge_value, str(no.selected2), mo.second_edge_value, mo.THRES, mo.K, mo.TAIL, ostr)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowNetworks(Action): tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import NetworkParameter from scripts import netscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(netscript % (no.netw[no.graph]['name'], no.node_position, no.edge_value, no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ConnectionMatrix(Action): tooltip = "Show connection matrix" description = "Show connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixNetworkParameter from scripts import conmatrix cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrix % (no.netw[no.graph]['name'], no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class SimpleConnectionMatrix(Action): tooltip = "Show simple connection matrix" description = "Show simple connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixEdgeNetworkParameter from scripts import conmatrixpyplot cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixEdgeNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrixpyplot % (no.netw[no.graph]['name'], no.edge_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowSurfaces(Action): """ Open a new file in the text editor """ tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from csurface_action import SurfaceParameter from scripts import surfscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = SurfaceParameter(cfile) so.edit_traits(kind='livemodal') if not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') if so.labels_da[so.labels].has_key('da_idx'): labels = so.labels_da[so.labels]['da_idx'] else: labels = "" f.write(surfscript % (so.pointset_da[so.pointset]['name'], so.pointset_da[so.pointset]['da_idx'], so.faces_da[so.faces]['name'], so.faces_da[so.faces]['da_idx'], so.labels_da[so.labels]['name'], labels)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowVolumes(Action): """ Open a new file in the text editor """ tooltip = "Create a volume" description = "Create a volume" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cvolume_action import VolumeParameter from scripts import volslice cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = VolumeParameter(cfile) so.edit_traits(kind='livemodal') if True: #not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(volslice % so.volumes[so.myvolume]['name']) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) diff --git a/cviewer/plugins/codeoracle/oracle_action_set.py b/cviewer/plugins/codeoracle/oracle_action_set.py index 147e7bf..bb0f8fb 100644 --- a/cviewer/plugins/codeoracle/oracle_action_set.py +++ b/cviewer/plugins/codeoracle/oracle_action_set.py @@ -1,84 +1,92 @@ """ Action set for the Oracl plugin """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Enthought library imports from enthought.envisage.ui.action.api import Action, Group, Menu, ToolBar from enthought.envisage.ui.workbench.api import WorkbenchActionSet xnat_pushpull = Action( id = "OracleXNATPushPull", class_name = "cviewer.plugins.codeoracle.actions.XNATPushPull", name = "XNAT Push and Pull", path = "MenuBar/Code Oracle/Other" ) show_surface = Action( id = "OracleCSurface", class_name = "cviewer.plugins.codeoracle.actions.ShowSurfaces", name = "Show Surface", path = "MenuBar/Code Oracle/CSurface" ) show_volumecre = Action( id = "OracleCVolumeCre", class_name = "cviewer.plugins.codeoracle.actions.ShowVolumes", name = "Volume Creation", path = "MenuBar/Code Oracle/CVolume" ) show_network = Action( id = "OracleCNetwork3D", class_name = "cviewer.plugins.codeoracle.actions.ShowNetworks", name = "3D Network", path = "MenuBar/Code Oracle/CNetwork" ) connection_matrix = Action( id = "OracleCNetworkMat", class_name = "cviewer.plugins.codeoracle.actions.ConnectionMatrix", name = "Connection Matrix", path = "MenuBar/Code Oracle/CNetwork" ) simple_connection_matrix = Action( id = "OracleCNetworkSimpleMat", class_name = "cviewer.plugins.codeoracle.actions.SimpleConnectionMatrix", name = "Simple Connection Matrix", path = "MenuBar/Code Oracle/CNetwork" ) compute_nbs = Action( id = "OracleNBS", class_name = "cviewer.plugins.codeoracle.actions.ComputeNBS", name = "Network-based statistic (NBS)", path = "MenuBar/Code Oracle/Statistics" ) show_tracks = Action( id = "OracleShowTracks", class_name = "cviewer.plugins.codeoracle.actions.ShowTracks", name = "Tracks between regions", path = "MenuBar/Code Oracle/CTrack" ) +nipype_bet = Action( + id = "OracleNipypeBet", + class_name = "cviewer.plugins.codeoracle.actions.NipypeBet", + name = "Brain extraction using BET", + path = "MenuBar/Code Oracle/Other/Nipype" +) + class OracleActionSet(WorkbenchActionSet): """ The actionset for the Oracle plugin """ id = "cviewer.plugins.codeoracle.action_set" actions = [ show_surface, show_network, compute_nbs, show_volumecre, connection_matrix, simple_connection_matrix, show_tracks, - xnat_pushpull + xnat_pushpull, + nipype_bet ] diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index 14b3c73..d9af8bf 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,512 +1,557 @@ + +nipypebet = """ +# Prerequisite: +# 1. You need to have Nipype installed on your system. You can check this by entering +# import nipype +# In the IPython console. If it gives an error, you might want to install it from NeuroDebian. +# See http://neuro.debian.net/ - Documentation is on http://nipy.sourceforge.net/nipype/ +# 2. For this simple brain extraction script, you need to have FSL installed. + +# Goal: +# This script shows how to extract the brain using BET through the Nipype interface. +# It is derived from http://nipy.sourceforge.net/nipype/users/dartmouth_workshop_2010.html + +# As an input, you need a T1-weighted image that as an input to the Nipype node. +rawimage = cfile.obj.get_by_name('MYRAWT1IMAGE') + +# Let's check if the metadata agrees with what is expected (it should say "T1-weighted") +print rawimage.dtype + +# We do not necessarily need to load the connectome object - if the connectome file is extracted +# locally. We just need to retrieve the absolute file path +rawimage_pwd = rawimage.get_abs_path() + +# We need the Nipype FSL interface +import nipype.interfaces.fsl as fsl + +# We set the FSL default output type to compressed Nifti-1 +fsl.FSLCommand.set_default_output_type('NIFTI_GZ') + +# We want to store the processed file in the temporary folder for now. +fname_out = '/tmp/only_brain.nii.gz' + +# Now, we run the Nipype BET node, providing the correct input +result = fsl.BET(in_file=rawimage_pwd, out_file = fname_out ).run() + +# We can print the result +print result.outputs + +# To add the processed data file to the currently loaded connectome file, ... +#cvol = cf.CVolume(name="BETed brain", src=fname_out, fileformat='Nifti1GZ', dtype='T1-weighted') +#cfile.obj.add_connectome_volume(cvol) +# Make sure that you save the connectome file if you want to keep the processed file. + +""" + pushpull = """ # Prerequisite: # 1. For this script to run, you need to have PyXNAT installed # on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ # 2. You need to have access to an XNAT server and a project # You can create a login and project here: # http://central.xnat.org/ # http://sandbox.xnat.org/ # Goal: # 1. We want to push a connectome file to an XNAT server # 2. We want to pull a connectome file from an XNAT server # We assume that a connectome file is currently loaded. For testing purposes, # it is beneficial if the files are not too big. # Retrieve the currently loaded connectome object to push to the XNAT Server a = cfile.obj # You need to setup the XNAT connection a.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) # You need to have write access on the XNAT Server given. You will need the projectid to push # data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite # is set to True, remote files are overwritten by the local files. # Then, you can push the connectome file to XNAT a.push( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) # NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. # The push operation may take some time. # Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. # You need the same identifiers to retrieve the data again. In addition, you need to provide a storage # path for the retrieved files. #a.pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') # In case you want to load the pulled connectome object, you can load it using cfflib #import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) """ surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data surface_file_labels = cfile.obj.get_by_name("%s") # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if surface_file_labels is None: labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Filtered Tractography").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Fiber labels (freesurferaparc)").data fromtofloatid = 8.10 # Defining some helper functions # ------------------------------ def sidx(arr, value): " Returns the indices that are equal to a given value " return np.where( arr == value)[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromtofloatid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.algorithms.statistics.nbs as nbs # Retrieving the data and set parameters # -------------------------------------- # Define your groups # Retrieve the corresponding CNetwork objects firstgroup = cfile.obj.get_by_name(%s) first_edge_value = '%s' secondgroup = cfile.obj.get_by_name(%s) second_edge_value = '%s' THRESH=%s K=%s TAIL='%s' SHOW_MATRIX = False # =========== # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a thread PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s', nbsgraph, dtype='NBSResult') cfile.update_children() """ volrendering = """ from enthought.mayavi import mlab import numpy as np data=np.random.random( (10,10,10)) min = data.min() max = data.max() source=mlab.pipeline.scalar_field(data) vol = mlab.pipeline.volume(source, vmin=min+0.65*(max-min), vmax=min+0.9*(max-min)) """ volslice = """ # Import Mayavi mlab interface from enthought.mayavi import mlab # Import NumPy import numpy as np # Retrieving the data and set parameters # -------------------------------------- # the CVolume name volname="%s" # Retrieve volume data (as Nibabel Image) voldat = cfile.obj.get_by_name(volname).data # Retrieve the image data data = voldat.get_data() # Retrieve the affine affine = voldat.get_affine() center = np.r_[0, 0, 0, 1] # Perform task # ------------ # create A ScalarField with spacing and origin from the affine data_src = mlab.pipeline.scalar_field(data) data_src.spacing = np.diag(affine)[:3] data_src.origin = np.dot(affine, center)[:3] # Create an outline mlab.pipeline.outline(data_src) # Create a simple x-aligned image plane widget image_plane_widget = mlab.pipeline.image_plane_widget(data_src, name=volname) image_plane_widget.ipw.plane_orientation = 'x_axes' image_plane_widget.ipw.reslice_interpolate = 'nearest_neighbour' """ reportlab = """ # Credits # http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/ # Import ReportLab from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch # Import NetworkX import networkx # Retrieving the data and set parameters # -------------------------------------- PAGE_HEIGHT=defaultPageSize[1] styles = getSampleStyleSheet() Title = "Connectome Report: " URL = "http://www.connectomics.org/" email = "[email protected]" Elements=[] HeaderStyle = styles["Heading1"] ParaStyle = styles["Normal"] PreStyle = styles["Code"] # load data net=a.get_by_name("%s")
LTS5/connectomeviewer
6d23112d4cc3e4f29e27347d16a2cb630740d081
Added XNAT Push Pull Code Oracle
diff --git a/cviewer/plugins/codeoracle/actions.py b/cviewer/plugins/codeoracle/actions.py index a7391b6..823d08e 100644 --- a/cviewer/plugins/codeoracle/actions.py +++ b/cviewer/plugins/codeoracle/actions.py @@ -1,235 +1,251 @@ import logging from enthought.io.api import File from enthought.pyface.api import FileDialog, OK from enthought.pyface.action.api import Action from enthought.traits.api import Any from cviewer.plugins.text_editor.editor.text_editor import TextEditor from cviewer.plugins.ui.preference_manager import preference_manager # Logging imports import logging logger = logging.getLogger('root.'+__name__) class ShowTracks(Action): tooltip = "Show tracks between two regions" description = "Show tracks between two regions" - # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from scripts import ctrackedge - cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') - + import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(ctrackedge) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) - + +class XNATPushPull(Action): + tooltip = "Push and pull files from and to XNAT Server" + description = "Push and pull files from and to XNAT Server" + + # The WorkbenchWindow the action is attached to. + window = Any() + + def perform(self, event=None): + + from scripts import pushpull + + import tempfile + myf = tempfile.mktemp(suffix='.py', prefix='my') + f=open(myf, 'w') + f.write(pushpull) + f.close() + + self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ComputeNBS(Action): tooltip = "Compute NBS" description = "Compute NBS" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_nbs_action import NBSNetworkParameter, NBSMoreParameter from scripts import nbsscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NBSNetworkParameter(cfile) no.edit_traits(kind='livemodal') if (len(no.selected1) == 0 or len(no.selected2) == 0): return mo = NBSMoreParameter(cfile, no.selected1[0], no.selected2[0]) mo.edit_traits(kind='livemodal') import datetime as dt a=dt.datetime.now() ostr = '%s%s%s' % (a.hour, a.minute, a.second) if not (len(no.selected1) == 0 or len(no.selected2) == 0): # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(nbsscript % (str(no.selected1), mo.first_edge_value, str(no.selected2), mo.second_edge_value, mo.THRES, mo.K, mo.TAIL, ostr)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowNetworks(Action): tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import NetworkParameter from scripts import netscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = NetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(netscript % (no.netw[no.graph]['name'], no.node_position, no.edge_value, no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ConnectionMatrix(Action): tooltip = "Show connection matrix" description = "Show connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixNetworkParameter from scripts import conmatrix cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrix % (no.netw[no.graph]['name'], no.node_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class SimpleConnectionMatrix(Action): tooltip = "Show simple connection matrix" description = "Show simple connection matrix" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cnetwork_action import MatrixEdgeNetworkParameter from scripts import conmatrixpyplot cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') no = MatrixEdgeNetworkParameter(cfile) no.edit_traits(kind='livemodal') if not no.netw[no.graph]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(conmatrixpyplot % (no.netw[no.graph]['name'], no.edge_label)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowSurfaces(Action): """ Open a new file in the text editor """ tooltip = "Create a surface" description = "Create a surface" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from csurface_action import SurfaceParameter from scripts import surfscript cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = SurfaceParameter(cfile) so.edit_traits(kind='livemodal') if not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') if so.labels_da[so.labels].has_key('da_idx'): labels = so.labels_da[so.labels]['da_idx'] else: labels = "" f.write(surfscript % (so.pointset_da[so.pointset]['name'], so.pointset_da[so.pointset]['da_idx'], so.faces_da[so.faces]['name'], so.faces_da[so.faces]['da_idx'], so.labels_da[so.labels]['name'], labels)) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) class ShowVolumes(Action): """ Open a new file in the text editor """ tooltip = "Create a volume" description = "Create a volume" # The WorkbenchWindow the action is attached to. window = Any() def perform(self, event=None): from cvolume_action import VolumeParameter from scripts import volslice cfile = self.window.application.get_service('cviewer.plugins.cff2.cfile.CFile') so = VolumeParameter(cfile) so.edit_traits(kind='livemodal') if True: #not so.pointset_da[so.pointset]['name'] == "None": # if cancel, not create surface # create a temporary file import tempfile myf = tempfile.mktemp(suffix='.py', prefix='my') f=open(myf, 'w') f.write(volslice % so.volumes[so.myvolume]['name']) f.close() self.window.workbench.edit(File(myf), kind=TextEditor,use_existing=False) diff --git a/cviewer/plugins/codeoracle/oracle_action_set.py b/cviewer/plugins/codeoracle/oracle_action_set.py index 8071f35..147e7bf 100644 --- a/cviewer/plugins/codeoracle/oracle_action_set.py +++ b/cviewer/plugins/codeoracle/oracle_action_set.py @@ -1,76 +1,84 @@ """ Action set for the Oracl plugin """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Enthought library imports from enthought.envisage.ui.action.api import Action, Group, Menu, ToolBar from enthought.envisage.ui.workbench.api import WorkbenchActionSet +xnat_pushpull = Action( + id = "OracleXNATPushPull", + class_name = "cviewer.plugins.codeoracle.actions.XNATPushPull", + name = "XNAT Push and Pull", + path = "MenuBar/Code Oracle/Other" +) + show_surface = Action( id = "OracleCSurface", class_name = "cviewer.plugins.codeoracle.actions.ShowSurfaces", name = "Show Surface", path = "MenuBar/Code Oracle/CSurface" ) show_volumecre = Action( id = "OracleCVolumeCre", class_name = "cviewer.plugins.codeoracle.actions.ShowVolumes", name = "Volume Creation", path = "MenuBar/Code Oracle/CVolume" ) show_network = Action( id = "OracleCNetwork3D", class_name = "cviewer.plugins.codeoracle.actions.ShowNetworks", name = "3D Network", path = "MenuBar/Code Oracle/CNetwork" ) connection_matrix = Action( id = "OracleCNetworkMat", class_name = "cviewer.plugins.codeoracle.actions.ConnectionMatrix", name = "Connection Matrix", path = "MenuBar/Code Oracle/CNetwork" ) simple_connection_matrix = Action( id = "OracleCNetworkSimpleMat", class_name = "cviewer.plugins.codeoracle.actions.SimpleConnectionMatrix", name = "Simple Connection Matrix", path = "MenuBar/Code Oracle/CNetwork" ) compute_nbs = Action( id = "OracleNBS", class_name = "cviewer.plugins.codeoracle.actions.ComputeNBS", name = "Network-based statistic (NBS)", path = "MenuBar/Code Oracle/Statistics" ) show_tracks = Action( - id = "OracleNBS", + id = "OracleShowTracks", class_name = "cviewer.plugins.codeoracle.actions.ShowTracks", name = "Tracks between regions", path = "MenuBar/Code Oracle/CTrack" ) class OracleActionSet(WorkbenchActionSet): """ The actionset for the Oracle plugin """ id = "cviewer.plugins.codeoracle.action_set" actions = [ show_surface, show_network, compute_nbs, show_volumecre, connection_matrix, simple_connection_matrix, - show_tracks + show_tracks, + xnat_pushpull ] diff --git a/cviewer/plugins/codeoracle/scripts.py b/cviewer/plugins/codeoracle/scripts.py index f3790b1..14b3c73 100644 --- a/cviewer/plugins/codeoracle/scripts.py +++ b/cviewer/plugins/codeoracle/scripts.py @@ -1,512 +1,556 @@ +pushpull = """ +# Prerequisite: +# 1. For this script to run, you need to have PyXNAT installed +# on your PYTHONPATH system. You can get it from http://packages.python.org/pyxnat/ +# 2. You need to have access to an XNAT server and a project +# You can create a login and project here: +# http://central.xnat.org/ +# http://sandbox.xnat.org/ + +# Goal: +# 1. We want to push a connectome file to an XNAT server +# 2. We want to pull a connectome file from an XNAT server + +# We assume that a connectome file is currently loaded. For testing purposes, +# it is beneficial if the files are not too big. + +# Retrieve the currently loaded connectome object to push to the XNAT Server +a = cfile.obj + +# You need to setup the XNAT connection +a.set_xnat_connection({'server': 'http://sandbox.xnat.org', 'user':'YOURUSERNAME', 'password':'YOURPASSWORD'}) + +# You need to have write access on the XNAT Server given. You will need the projectid to push +# data to the server. In addition, you need to provide a subjectid and an experimentid. If overwrite +# is set to True, remote files are overwritten by the local files. + +# Then, you can push the connectome file to XNAT +a.push( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", overwrite = False) + +# NB: On the remote server, unique identifier for the subject and experiment id are generated, using the project id. +# The push operation may take some time. + +# Similarly as you pushed a connectome file to XNAT, you can pull it again from the server. +# You need the same identifiers to retrieve the data again. In addition, you need to provide a storage +# path for the retrieved files. + +#a.pull( projectid = "YOURPROJECTID", subjectid = "SUBJECTID", experimentid = "EXPID", '/YOUR/FILE/STORAGE/PATH') + +# In case you want to load the pulled connectome object, you can load it using cfflib + +#import cfflib as cf; mynewcon = cf.load( '/YOUR/FILE/STORAGE/PATH/meta.cml' ) + +""" + surfscript = """ # Importing Mayavi mlab interface from enthought.mayavi import mlab # Retrieving the data # ------------------- # surface data from connectome file surface_file_vertices = cfile.obj.get_by_name("%s") vertices = surface_file_vertices.data.darrays[%s].data surface_file_faces = cfile.obj.get_by_name("%s") faces = surface_file_faces.data.darrays[%s].data surface_file_labels = cfile.obj.get_by_name("%s") # Sanity check # ------------ # ensure that (triangluar) faces have dimension (N,3) if len(faces.shape) == 1: faces = faces.reshape( (len(faces) / 3, 3) ) # check for labels if surface_file_labels is None: labels = None else: labels = surface_file_labels.data.darrays[%s].data # Ensure correct dimension (1-D) for labels labels = labels.ravel() # Ensure that each vertices has a corresponding label assert vertices.shape[0] == len(labels) # Perform task # ------------ # Create triangular surface mesh x, y, z = vertices[:,0], vertices[:,1], vertices[:,2] mlab.triangular_mesh(x, y, z, faces, scalars = labels) """ conmatrix = """ # Importing NetworkX import networkx as nx # Import the Connectome Matrix Viewer from cviewer.visualization.matrix.con_matrix_viewer import ConnectionMatrixViewer # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # set the node key to use the labels nodelabelkey = "%s" # Defining some helper functions # ------------------------------ def relabel_to_int(graph): " Relabel string node ids to integer " def intmap(x): return int(x) return nx.relabel_nodes(graph,intmap) def get_nodelabels(graph, nodekey = 'dn_label'): " Retrieve a list of node labels " g = relabel_to_int(graph) a = [] return [v[nodekey] for n,v in g.nodes_iter(data=True)] def get_edge_values(graph): " Retrieve valid edge keys " if len(graph.edges()) == 0: return edi = graph.edges_iter(data=True) u,v,ed = edi.next() ret = [] for k,v in ed.items(): if isinstance(v, float) or isinstance(v, int): ret.append(k) return ret def get_matdict(graph): matdict = {} g = relabel_to_int(graph) # grab keys from the first edge, discarding id dl = get_edge_values(g) # create numpy matrix for each key using recarray matrec = nx.to_numpy_recarray(g, dtype=zip(dl, [float]*len(dl)) ) for k in dl: matdict[k] = matrec[k] return matdict def invoke_matrix_viewer(graph, nodelabelkey = 'dn_label'): " Invoke the Connectome Matrix Viewer " cmatrix_viewer = ConnectionMatrixViewer(get_nodelabels(graph, nodekey = nodelabelkey), get_matdict(graph)) cmatrix_viewer.edit_traits() # Perform task # ------------ invoke_matrix_viewer(g, nodelabelkey) """ conmatrixpyplot = """ # Importing NetworkX import networkx as nx # Import Pylab from pylab import imshow, show, cm # Retrieving the data # ------------------- # retrieve the graph g = cfile.obj.get_by_name("%s").data # define the edge key to plot edgekey = "%s" # binarize matrix binarize = False # Defining some helper functions # ------------------------------ def show_matrix(a, edge, binarize = False): for u,v,d in a.edges_iter(data=True): a.edge[u][v]['weight'] = a.edge[u][v][edge] bb=nx.to_numpy_matrix(a) if binarize: c=np.zeros(bb.shape) c[bb>0] = 1 b = c else: b = bb imshow(b, interpolation='nearest', cmap=cm.jet, vmin = b.min(), vmax=b.max()) show() # Perform task # ------------ show_matrix(g, edgekey, binarize) """ ctrackedge = """ # Importing Numpy import numpy as np # Import Dipy Visualization import dipy.viz.fvtk as fvtk # Retrieving the data and set parameters # -------------------------------------- a = cfile.obj.get_by_name("Filtered Tractography").get_fibers_as_numpy() fiberlabels = cfile.obj.get_by_name("Fiber labels (freesurferaparc)").data fromtofloatid = 8.10 # Defining some helper functions # ------------------------------ def sidx(arr, value): " Returns the indices that are equal to a given value " return np.where( arr == value)[0] def randcolarr(arr): " Returns a random color for each row in arr " return np.random.rand(1,3).repeat(len(arr),axis=0) def showfibfvtk(fibarr, colarr, percentage = 100): fibarr2 = fibarr[::percentage] colarr2 = colarr[::percentage] fibarr2list = fibarr2.tolist() r=fvtk.ren() #fvtk.add(r,fvtk.axes()) r.SetBackground(1, 1, 1) [fvtk.add(r,fvtk.line(ele, colarr2[i,:])) for i, ele in enumerate(fibarr2list)]; fvtk.show(r, title = "Fibers", size = (500,500)) # Perform task # ------------ idx = sidx(fiberlabels, fromtofloatid) showfibfvtk(a[idx], randcolarr(a[idx]), 100) """ netscript = """ # Importing NumPy import numpy as np # Importing Mayavi mlab and tvtk packages from enthought.mayavi import mlab from enthought.tvtk.api import tvtk # Retrieving the data and set parameters # -------------------------------------- # load graph data g = cfile.obj.get_by_name("%s").data position_key = "%s" edge_key = "%s" node_label_key = "%s" # Node ids you want to create labels for create_label = [] # Assume node id's are integers nr_nodes = len(g.nodes()) position_array = np.zeros( (nr_nodes, 3) ) for i,nodeid in enumerate(g.nodes()): pos = g.node[nodeid][position_key] # apply a conversion procedure if the position # is a tuple store as string # we need a numpy array in the end pos = tuple(float(s) for s in pos[1:-1].split(',')) pos = np.array(pos) position_array[i,:] = pos x, y, z = position_array[:,0], position_array[:,1], position_array[:,2] # Retrieve the edges and create a Numpy array edges = np.array(g.edges()) nr_edges = len(edges) # Retrieve edge values ev = np.zeros( (nr_edges, 1) ) for i,d in enumerate(g.edges_iter(data=True)): ev[i] = d[2][edge_key] # ensure that we are setting the correct edge assert d[0] == edges[i,0] and d[1] == edges[i,1] # Need to subtract one because the array index starts at zero edges = edges - 1 # Create vectors which will become edges start_positions = position_array[edges[:, 0], :].T end_positions = position_array[edges[:, 1], :].T vectors = end_positions - start_positions # Perform task # ------------ # create a new figure mlab.figure() nodesource = mlab.pipeline.scalar_scatter(x, y, z, name = 'Node Source') nodes = mlab.pipeline.glyph(nodesource, scale_factor=3.0, scale_mode='none',\ name = 'Nodes', mode='cube') nodes.glyph.color_mode = 'color_by_scalar' vectorsrc = mlab.pipeline.vector_scatter(start_positions[0], start_positions[1], start_positions[2], vectors[0], vectors[1], vectors[2], name = 'Connectivity Source') # add scalar array da = tvtk.DoubleArray(name=edge_key) da.from_array(ev) vectorsrc.mlab_source.dataset.point_data.add_array(da) vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() vectorsrc.mlab_source.dataset.point_data.scalars.name = edge_key # need to update the boundaries vectorsrc.outputs[0].update() # Add a thresholding filter to threshold the edges thres = mlab.pipeline.threshold(vectorsrc, name="Thresholding") myvectors = mlab.pipeline.vectors(thres,colormap='OrRd', #mode='cylinder', name='Connections', #scale_factor=1, #resolution=20, # make the opacity of the actor depend on the scalar. #transparent=True, scale_mode = 'vector') myvectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' # vectors.glyph.glyph_source.glyph_source.radius = 0.01 myvectors.glyph.color_mode = 'color_by_scalar' myvectors.glyph.glyph.clamping = False # create labels for la in create_label: row_index = la - 1 label = g.node[la][node_label_key] mlab.text3d(position_array[row_index,0], position_array[row_index,1], position_array[row_index,2], ' ' + label, name = 'Node ' + label) """ nbsscript = """ # Import Numpy import numpy as np # Import pylab for plotting from pylab import imshow, show, title # Import NetworkX import networkx as nx # Import Network based statistic import cviewer.libs.pyconto.algorithms.statistics.nbs as nbs # Retrieving the data and set parameters # -------------------------------------- # Define your groups # Retrieve the corresponding CNetwork objects firstgroup = cfile.obj.get_by_name(%s) first_edge_value = '%s' secondgroup = cfile.obj.get_by_name(%s) second_edge_value = '%s' THRESH=%s K=%s TAIL='%s' SHOW_MATRIX = False # =========== # Make sure that all networks are loaded in memory for net in firstgroup: net.load() for net in secondgroup: net.load() # Convert your network data for each group into numpy arrays nr1_networks = len(firstgroup) nr1_nrnodes = len(firstgroup[0].data.nodes()) nr2_networks = len(secondgroup) nr2_nrnodes = len(secondgroup[0].data.nodes()) X = np.zeros( (nr1_nrnodes, nr1_nrnodes, nr1_networks) ) Y = np.zeros( (nr2_nrnodes, nr2_nrnodes, nr2_networks) ) # Fill in the data from the networks for i, sub in enumerate(firstgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[first_edge_value] # Retrieve the matrix X[:,:,i] = nx.to_numpy_matrix(graph) for i, sub in enumerate(secondgroup): graph=sub.data # Setting the edge requested edge value as weight value for u,v,d in graph.edges(data=True): graph[u][v]['weight']=d[second_edge_value] # Retrieve the matrix Y[:,:,i] = nx.to_numpy_matrix(graph) # Perform task # ------------ # Compute NBS, this might take a long time # and might better be done in a thread PVAL, ADJ, NULL = nbs.compute_nbs(X,Y,THRESH,K,TAIL) # We can now look at the connectivity matrix identified with matplotlib if SHOW_MATRIX: imshow(ADJ, interpolation='nearest') title('Edges identified by the NBS') show() # we create a networkx graph again from the adjacency matrix nbsgraph = nx.from_numpy_matrix(ADJ) # relabel nodes because the should not start at zero for our convention nbsgraph=nx.relabel_nodes(nbsgraph, lambda x: x + 1) # populate node dictionaries with attributes from first network of the first group # it must include some location information to display it for nid, ndata in firstgroup[0].data.nodes_iter(data=True): nbsgraph.node[nid] = ndata # You can now add now the results to the connectome file # Make sure that the name is not existing yet in the connectome file cfile.obj.add_connectome_network_from_nxgraph('NBS result at %s', nbsgraph, dtype='NBSResult') cfile.update_children() """ volrendering = """ from enthought.mayavi import mlab import numpy as np data=np.random.random( (10,10,10)) min = data.min() max = data.max() source=mlab.pipeline.scalar_field(data) vol = mlab.pipeline.volume(source, vmin=min+0.65*(max-min), vmax=min+0.9*(max-min)) """ volslice = """ # Import Mayavi mlab interface from enthought.mayavi import mlab # Import NumPy import numpy as np # Retrieving the data and set parameters # -------------------------------------- # the CVolume name volname="%s" # Retrieve volume data (as Nibabel Image) voldat = cfile.obj.get_by_name(volname).data # Retrieve the image data data = voldat.get_data() # Retrieve the affine affine = voldat.get_affine() center = np.r_[0, 0, 0, 1] # Perform task # ------------ # create A ScalarField with spacing and origin from the affine data_src = mlab.pipeline.scalar_field(data) data_src.spacing = np.diag(affine)[:3] data_src.origin = np.dot(affine, center)[:3] # Create an outline mlab.pipeline.outline(data_src) # Create a simple x-aligned image plane widget image_plane_widget = mlab.pipeline.image_plane_widget(data_src, name=volname) image_plane_widget.ipw.plane_orientation = 'x_axes' image_plane_widget.ipw.reslice_interpolate = 'nearest_neighbour' """ reportlab = """ # Credits # http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/ # Import ReportLab from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch # Import NetworkX import networkx # Retrieving the data and set parameters # -------------------------------------- PAGE_HEIGHT=defaultPageSize[1] styles = getSampleStyleSheet() Title = "Connectome Report: " URL = "http://www.connectomics.org/" email = "[email protected]" Elements=[] HeaderStyle = styles["Heading1"] ParaStyle = styles["Normal"] PreStyle = styles["Code"] # load data net=a.get_by_name("%s") net.load() g=net.data netw = g def header(txt, style=HeaderStyle, klass=Paragraph, sep=0.3): s = Spacer(0.2*inch, sep*inch) para = klass(txt, style) sect = [s, para] result = KeepTogether(sect) return result def p(txt): return header(txt, style=ParaStyle, sep=0.1) def pre(txt): s = Spacer(0.1*inch, 0.1*inch) p = Preformatted(txt, PreStyle) precomps = [s,p] result = KeepTogether(precomps) return result def go(): doc = SimpleDocTemplate('gfe.pdf') doc.build(Elements) mytitle = header(Title + a.get_connectome_meta().get_title()) mysite = header(URL, sep=0.1, style=ParaStyle) mymail = header(email, sep=0.1, style=ParaStyle) myabstract = p(Abstract) head_info = [mytitle, mysite, mymail] code_title = header("Basic code to produce output") code_explain = p("This is a snippet of code. It's an example using the Preformatted flowable object, which makes it easy to put code into your documents. Enjoy!") mytitlenet = header(net.get_name()) import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt
LTS5/connectomeviewer
20256768c09b26b1363f6b56cc9c24deff8503b3
Fixes to get installation working
diff --git a/cviewer/libs/setup.py b/cviewer/libs/setup.py index 11e96fe..53f1288 100644 --- a/cviewer/libs/setup.py +++ b/cviewer/libs/setup.py @@ -1,33 +1,33 @@ import ConfigParser import os ################################################################################ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import system_info config = Configuration('libs', parent_package, top_path) config.add_subpackage('pyeeg') - config.add_subpackage('tomoviz') + # config.add_subpackage('tomoviz') - config.add_subpackage('dipy') + # config.add_subpackage('dipy') # List all data directories to be loaded here # add setup.py with specifics # config.add_data_dir('dipy') # add pyconto as datadir, because it needs to include all the __init__ # config.add_subpackage('pyconto/algorithms/statistics/nbs') config.add_data_dir('pyconto') # config.add_data_dir('joblib') # config.add_data_dir('parallelpython') # config.add_data_dir('openmeeg') # config.add_data_dir('pyxnat') return config if __name__ == '__main__': from numpy.distutils.core import setup - setup(**configuration(top_path='').todict()) \ No newline at end of file + setup(**configuration(top_path='').todict()) diff --git a/cviewer/plugins/cff2/cnetwork.py b/cviewer/plugins/cff2/cnetwork.py index 8514c4d..32c1747 100644 --- a/cviewer/plugins/cff2/cnetwork.py +++ b/cviewer/plugins/cff2/cnetwork.py @@ -1,57 +1,45 @@ """ The ConnectomeViewer wrapper for a cfflib object """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Standard library imports import os # Enthought library imports from enthought.traits.api import HasTraits, Str, Bool, CBool, Any, Dict, implements, \ List, Instance, DelegatesTo, Property from enthought.traits.ui.api import View, Item, auto_close_message, message # ConnectomeViewer imports -from cviewer.visualization.render_manager import RenderManager -from cviewer.sources.datasource_manager import DatasourceManager from cviewer.plugins.ui.preference_manager import preference_manager -from cviewer.plugins.cff.ui.edge_parameters_view import EdgeParameters import cfflib # Logging import import logging logger = logging.getLogger('root.'+__name__) from cbase import CBase class CNetwork(CBase): """ The implementation of the Connectome Networks """ - - # the render manager of this network - rendermanager = Instance(RenderManager) - - # DatasourceManager Instance of this network - datasourcemanager = Instance(DatasourceManager) - + # the cfflib CNetwork object obj = Instance(cfflib.CNetwork) graph = Property(Any, depends_on = [ 'obj' ]) - - # edge parameters for visualization - _edge_para = Instance(EdgeParameters) def _get_graph(self): if not self.loaded: self.load() return self.obj.data def __init__(self, **traits): super(CNetwork, self).__init__(**traits) - \ No newline at end of file + diff --git a/cviewer/plugins/cff2/csurface.py b/cviewer/plugins/cff2/csurface.py index 1d40215..8a86ad0 100644 --- a/cviewer/plugins/cff2/csurface.py +++ b/cviewer/plugins/cff2/csurface.py @@ -1,55 +1,51 @@ """ The ConnectomeViewer wrapper for a cfflib object """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Standard library imports import os # Enthought library imports from enthought.traits.api import HasTraits, Str, Bool, CBool, Any, Dict, implements, \ List, Instance, DelegatesTo, Property from enthought.traits.ui.api import View, Item, auto_close_message, message # ConnectomeViewer imports - -from cviewer.visualization.render_manager import RenderManager -from cviewer.sources.datasource_manager import DatasourceManager from cviewer.plugins.ui.preference_manager import preference_manager -from cviewer.plugins.cff.ui.edge_parameters_view import EdgeParameters import cfflib from cviewer.plugins.cff2.csurface_darray import CSurfaceDarray # Logging import import logging logger = logging.getLogger('root.'+__name__) from cbase import CBase class CSurface(CBase): """ The implementation of the Connectome Surface """ obj = Instance(cfflib.CSurface) darrays = List children = Property(depends_on = ['darrays']) def load(self): super(CSurface, self).load() # update darrays self.darrays = [CSurfaceDarray(ele) for ele in self.obj.data.darrays] def close(self): super(CSurface, self).close() self.darrays = [] def _get_children(self): return self.darrays def __init__(self, **traits): super(CSurface, self).__init__(**traits) self.darrays = [] diff --git a/cviewer/plugins/cff2/setup.py b/cviewer/plugins/cff2/setup.py new file mode 100644 index 0000000..86d1aa4 --- /dev/null +++ b/cviewer/plugins/cff2/setup.py @@ -0,0 +1,14 @@ +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + + config = Configuration('cff2', parent_package, top_path) + + config.add_subpackage('actions') + config.add_subpackage('trackvis') + config.add_subpackage('ui') + + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(**configuration(top_path='').todict()) diff --git a/cviewer/plugins/setup.py b/cviewer/plugins/setup.py index ff8a5d6..30c0ab5 100644 --- a/cviewer/plugins/setup.py +++ b/cviewer/plugins/setup.py @@ -1,19 +1,22 @@ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('plugins', parent_package, top_path) config.add_subpackage('bindings') config.add_subpackage('cff2') + config.add_subpackage('codeoracle') config.add_subpackage('sloreta') + config.add_subpackage('dipy') config.add_subpackage('text_editor') config.add_subpackage('ui') config.add_subpackage('nbs') - + config.add_subpackage('sloreta') + config.add_data_files('ui/preferences.ini') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(top_path='').todict()) diff --git a/cviewer/visualization/render_manager.py b/cviewer/visualization/render_manager.py deleted file mode 100755 index 9756d8b..0000000 --- a/cviewer/visualization/render_manager.py +++ /dev/null @@ -1,877 +0,0 @@ -"""RenderManager class dealing with rendering of the networks - -""" -# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and -# University Hospital Center and University of Lausanne (UNIL-CHUV) -# -# Modified BSD License - -# Standard library imports -import numpy as np -import sys - -# Enthought library imports -from enthought.traits.api import HasTraits, Instance, Any, List -from enthought.traits.ui.api import View, Item, Group - -# ConnectomeViewer imports -from cviewer.plugins.cff.ui.node_view import Node -from cviewer.visualization.node_picker import NodePicker -from cviewer.plugins.cff.interfaces.i_network import INetwork -from cviewer.plugins.ui.preference_manager import preference_manager - -# Logging imports -import logging -logger = logging.getLogger('root.'+__name__) - - -class RenderManager(HasTraits): - """ Handles the multiple views (scenes) on the network and surface - data, handles picking as well. """ - - from enthought.mayavi.core.scene import Scene - from enthought.mayavi.api import Engine - - # the scene for the 3D view of the network - scene3d = Instance(Scene) - - # VTK Graph Pipeline in 2D - scene2d = Instance(Scene) - - # the mayavi engine - engine = Instance(Engine) - - # the network this render manager manages - network = Instance(INetwork) - - # nodepicker - nodepicker = Instance(NodePicker) - - # cmatrix viewer - cmatrix_viewer = Any - - # references to the data - # ----- - # the node glyphs - nodes = Any - # the selected node glyphs (actor) - nodes_selected = Any - # the node source - nodesrc = Any - # a dictionary with references to created text3d labels - # keyed by the node index - node_labels = Any - - # connectivity source - vectorsrc = Any - # connectivity actor - vectors = Any - - # surface source - surfsrc = Any - # surface triangular mesh actor - surf = Any - - # threshold - thres = Any - # attribute selector - attract = Any - - node_info_view = View(Group( - Group(Item(name='nodepicker', style='custom'), - show_border=True, show_labels=False), - Group(Item(name='show_gui'), - Item(name='auto_raise'), show_border=True), - ), - resizable=True, - buttons=['OK']) - - - def __init__(self, network, **traits): - super(RenderManager, self).__init__(**traits) - - from enthought.mayavi import mlab - - logger.info('Initalize RenderManager...') - - # set the datasource manager - self.datasourcemanager = network.datasourcemanager - - # getting mlab engine - self.engine = mlab.get_engine() - - # store reference to managed network - self.network = network - - # create the scene instances - self._create_scenes() - - # use nice trackball camera interactor - # self.scene3d.scene.interactor.interactor_style = tvtk.InteractorStyleTrackballCamera() - # otherwise just use tvtk.InteractorStyleSwitch() - - # create my node picker inclusive the NodePickHandler - self.nodepicker = NodePicker(renwin=self.scene3d.scene) - - # add custom picker for the scene3d - self.scene3d.scene.picker = self.nodepicker - - # adding observers to capture key events - self.scene3d.scene.interactor.add_observer('KeyPressEvent', self.nodepicker.key_pressed) - - # add the callback function after a pick event - self.scene3d.scene.picker.pointpicker.add_observer('EndPickEvent', self._nodepicked_callback) - - # initialize node_labels - self.node_labels = {} - - logger.info('RenderManager created.') - - - ############### - # Scene2D Handling - ############### - - def _create2DScene(self): - """ Create the Mayavi Scene2D and adds it to the current engine """ - - figure = self.engine.new_scene(name="2D View: "+self.network.networkname) - figure.scene.background = (0, 0, 0) - return figure - - def visualize_scene2d(self): - """ Creates the VTK Graph Pipeline to render the Graph """ - - from enthought.tvtk.api import tvtk - - # precondition for the graph visualization - if self.scene2d is None: - self.scene2d = self._create2DScene() - - # alias for currently used scene - fig = self.scene2d - - # get source object - srcobj = self.datasourcemanager.get_sourceobject() - - # XXX_start: the following section for graph data structure generation - # might be encapsulated in another function - - edges, weights = self.datasourcemanager.get_current_edges_and_weights() - - # create table - T = tvtk.Table() - - col1 = tvtk.IntArray() - col1.name = "From" - for ele in edges: - col1.insert_next_value(ele[0]) - T.add_column(col1) - - col2 = tvtk.IntArray() - col2.name = "To" - for ele in edges: - col2.insert_next_value(ele[1]) - T.add_column(col2) - - col3 = tvtk.FloatArray() - col3.name = "Weight" - for ele in weights: - col3.insert_next_value(ele) - T.add_column(col3) - - # XXX_end - - # build the pipeline (using TVTK) - - graph = tvtk.TableToGraph() - graph.add_input_connection(T.producer_port) - #graph.AddLinkVertex("From", "Name", False) - #graph.AddLinkVertex("To", "Name", False) - graph.add_link_edge("From", "To") - #graph.SetVertexTableConnection(vertex_table.GetOutputPort()) - - view = tvtk.GraphLayoutView() - view.add_representation_from_input_connection(graph.output_port) - #view.vertex_label_array_name = "label" - #view.vertex_label_visibility = True - #view.vertex_color_array_name = "Age" - view.color_vertices = False - view.color_edges = True - #view.set_layout_strategy_to_simple2d() - view.set_layout_strategy_to_force_directed() - # random, pass_trhough, fast2d, simple2d, community2d, circular, clustering2d - - # Add my new layout strategy - # myFoo = vtkCircularLayoutStrategy() - # view.SetLayoutStrategy(myFoo) - - theme = tvtk.ViewTheme().create_mellow_theme() - theme.cell_color = (0.2,0.2,0.6) - theme.line_width = 5 - theme.point_size = 10 - view.apply_view_theme(theme) - view.vertex_label_font_size = 20 - - # the rendering part is a bit different than - #window = vtkRenderWindow() - #window.SetSize(600, 600) - #view.SetupRenderWindow(window) - #view.GetRenderer().ResetCamera() - #window.GetInteractor().Start() - # for mayavi. maybe this can be simplified - # XXX: where is the scene interactor set? - - # get renderer - ren = view.renderer - ren.reset_camera() - props = ren.view_props - props0 = props.get_item_as_object(0) - map0 = props0.mapper - graph0 = map0.get_input_data_object(0,0) - - # export to polydata - pd = tvtk.GraphToPolyData() - pd.set_input(graph0) - pd.update() - # same as pd.get_output() or pd.output - polydata = pd.get_output_data_object(0) - - a = tvtk.Actor(mapper=map0) - - # finally, add the actor to the scene2d - fig.scene.add_actor(a) - # and we are lucky, aren't we? - - def update_scene2d(self): - """ Grabs the graph infromation from the DataSourceManager and - updates the Scene2D rendering Pipeline """ - - # XXX: is it at all possible to update the underlying datastructure - # and then update the pipeline with the approach taken here? - - pass - - def _nodepicked_callback(self, picker_obj, evt): - """ The callback function to determine what to do with a picked node """ - from enthought.tvtk.api import tvtk - - picker_obj = tvtk.to_tvtk(picker_obj) - picked = picker_obj.actors - - # if picked actor are the glyphs - if self.nodes.actor.actor._vtk_obj in [o._vtk_obj for o in picked]: - - pos = picker_obj.picked_positions[0] - - dist_small = sys.maxint # the biggest integer - - for i, points in enumerate(self.nodes.mlab_source.points): - # if picked positions ON a node - dist = np.linalg.norm((np.array(pos)- points)) - # save the smallest distance node - if dist <= dist_small: - j = i - dist_small = dist - - # get the id of the picked node - picknodeid = 'n' + str(j+1) - - if self.nodepicker.show_info: - - # generate a nice view for the information - nodedata = self.network.graph.node[picknodeid] - - nodedata['dn_internal_id'] = picknodeid - - deg = self.network.graph.degree(picknodeid) - from types import IntType, StringType - if type(deg) == IntType or type(deg) == StringType: - nodedata['degree'] = deg - - # does this node has a self-loop? - if self.network.graph.has_edge(picknodeid, picknodeid): - nodedata['has_selfloop'] = True - else: - nodedata['has_selfloop'] = True - - mynode = Node(nodedata=nodedata) - mynode.configure_traits() - - - elif self.nodepicker.toggle_selection: - # toggles the selection of a node - if self.datasourcemanager._srcobj.selected_nodes[j] == 1: - # unpick - self._select_nodes(selection_node_array = np.array([j]), \ - first_is_selected = True, change_vector = False) - else: - # pick - self._select_nodes(selection_node_array = np.array([j]), activate = True, \ - first_is_selected = True, change_vector = False) - - elif self.nodepicker.select_node: - # toggle the picking state - if self.datasourcemanager._srcobj.selected_nodes[j] == 1: - # unpick - self._select_nodes(selection_node_array = np.array([j]), \ - first_is_selected = True) - else: - # pick - self._select_nodes(selection_node_array = np.array([j]), activate = True, \ - first_is_selected = True) - - elif self.nodepicker.select_node2: - - # get the neighbors of the picked node in an array - nbrs = self.datasourcemanager._srcobj.relabled_graph.neighbors(j) - # put the two lists together - cur_nodes = np.append(j, np.array(nbrs)) - - if self.datasourcemanager._srcobj.selected_nodes[j] == 1: - # unpick - self._select_nodes(selection_node_array = cur_nodes, \ - first_is_selected = True) - else: - # pick - self._select_nodes(selection_node_array = cur_nodes, activate = True ,\ - first_is_selected = True) - - elif self.nodepicker.toggle_label: - - if self.node_labels.has_key(j): - # we want to remove the node label from the pipeline first - # and then delete the entry in the dictionary - a = self.node_labels[j] - a.remove() - del self.node_labels[j] - - else: - srcobj = self.datasourcemanager._srcobj - # create the text3d instance and add it to the dictionary - from enthought.mayavi import mlab - a = mlab.text3d(srcobj.positions[j,0], srcobj.positions[j,1], \ - srcobj.positions[j,2], \ - ' ' + srcobj.labels[j], # white spaces are hackish - name = 'Node ' + srcobj.labels[j]) - self.node_labels[j] = a - - else: - logger.info("No valid pick operation.") - - - def _select_nodes(self, selection_node_array, activate = False, first_is_selected = False, change_vector = True): - """ Helper function to update the datasourceobject nodes selection status - and update the currently rendered objects - - Parameters - ---------- - fist_is_selected : boolean - if the first node id in the selection_node_array is a clicked node - change_vector : boolean - add edges for visualization - - """ - logger.debug('_select_nodes invoked') - import time - - # update the edges - if first_is_selected: - if change_vector: - now=time.clock() - self._select_edges(activate = activate, fis = selection_node_array[0]) - logger.debug('change_vector True: _select_edges used %s s' % str(time.clock()-now)) - else: - now=time.clock() - self._select_edges(activate = activate) - logger.debug('first_is_selected False: _select_edges used %s s' % str(time.clock()-now)) - - now=time.clock() - tmparr = self.nodesrc.mlab_source.dataset.point_data.get_array('selected_nodes') - num_tmparr = tmparr.to_array() - logger.debug('getting nodesrc mlab array %s s' % str(time.clock()-now)) - - now=time.clock() - # setting the datastructure - self.datasourcemanager._srcobj.selected_nodes[selection_node_array] = int(activate) - logger.debug('setting selected_nodes in srcmng %s s' % str(time.clock()-now)) - - # update rendering information - num_tmparr[selection_node_array] = int(activate) - - now=time.clock() - # update the nodes - tmparr = num_tmparr - self.nodesrc.mlab_source.update() - logger.debug('update the nodes %s s' % str(time.clock()-now)) - - def _select_edges(self, activate, fis = -1): - """ Helper function to update the selected edges in the datasourceobject - based on the currently selected nodes and update the currently rendered edges. - """ - - # get source object - srcobj = self.datasourcemanager.get_sourceobject() - - # if there are no edges in this network, return - if len(srcobj.edges) == 0: - return - - if not fis == -1: - # first value is the starting node - if not srcobj.directed: - idx, pos = np.where(srcobj.edges == fis) - # idx stores the index, pos either from or to in tuple - # for undirected, we can discard pos - # now, we can (de)activate the edges corresponding to fis - srcobj.selected_edges[idx] = int(activate) - self.datasourcemanager._update_vector() - else: - # TODO - # how to select the edges if the graph is directed? - pass - else: - # just select the whole subgraph spanned by the selected_nodes - if activate: - tmp_selnodes = np.where(srcobj.selected_nodes == 0) - else: - tmp_selnodes = np.where(srcobj.selected_nodes == 1) - if len(tmp_selnodes) >= 1: - for i in tmp_selnodes[0]: - idx, pos = np.where(srcobj.edges == i) - srcobj.selected_edges[idx] = int(activate) - self.datasourcemanager._update_vector() - - # update vectorsrc - self.vectorsrc.mlab_source.set(u=srcobj.vectors[0],v=srcobj.vectors[1], w=srcobj.vectors[2]) - self.vectorsrc.mlab_source.update() - - - def _show_surface(self, forced = False): - """ Shows all the surfaces patches of the selected nodes depending - on the show_surface status - - Parameters - ---------- - forced : boolean - If true, the surfaces have to be displayed - - - """ - # precondition - # can only be called when there is already a surface rendered - if self.surfsrc is None: return - - # get the intensity value of the selected nodes - sellist = self.network.get_selectiongraph_list() - if not len(sellist) == 0: - iva = np.zeros(len(sellist)) - for i, nodeid in enumerate(sellist): - if self.network.graph.node[nodeid].has_key('dn_intensityvalue'): - iva[i] = int(self.network.graph.node[nodeid]['dn_intensityvalue']) - else: - iva = None - - # set the show_surfaces status to True if forced - if forced: - self.datasourcemanager._srcobj.show_surface = True - - # updates the surface label array - self.datasourcemanager._update_labelarr(intensityvalue_array = iva) - - # toggle the surface visibility - # the shape of the scalars and vertices array have to be consistent at this point (use set) - assert self.surfsrc.mlab_source.scalars.shape[0] == self.datasourcemanager._srcobj.labelarr.shape[0] - - self.surfsrc.mlab_source.set(scalars = self.datasourcemanager._srcobj.labelarr.ravel()) - self.surfsrc.mlab_source.update() - - def _toggle_surface(self): - """ Toggles visibility of the surface of the selected nodes - - """ - - # precondition - # can only be called when there is already a surface rendered - if self.surfsrc is None: return - - iva = None - if not self.datasourcemanager._srcobj.show_surface: - # get the intensity value of the selected nodes - sellist = self.network.get_selectiongraph_list() - iva = np.zeros(len(sellist)) - for i, nodeid in enumerate(sellist): - if self.network.graph.node[nodeid].has_key('dn_intensityvalue'): - iva[i] = int(self.network.graph.node[nodeid]['dn_intensityvalue']) - - self.datasourcemanager._srcobj.show_surface = not self.datasourcemanager._srcobj.show_surface - - # updates the surface label array - self.datasourcemanager._update_labelarr(intensityvalue_array = iva) - - # toggle the surface visibility - # the shape of the scalars and vertices array have to be consistent at this point (use set) - assert self.surfsrc.mlab_source.scalars.shape[0] == self.datasourcemanager._srcobj.labelarr.shape[0] - - self.surfsrc.mlab_source.set(scalars = self.datasourcemanager._srcobj.labelarr.ravel()) - self.surfsrc.mlab_source.update() - - def _create3DScene(self): - """ Creates a 3D Scene """ - figure = self.engine.new_scene(name="3D View: "+self.network.networkname) - figure.scene.show_axes = True - figure.scene.background = (0, 0, 0) - return figure - - def _create_scenes(self): - """ Reopens the closed scenes """ - self.scene3d = self._create3DScene() - # Uncomment to activate again - #self.scene2d = self._create2DScene() - - def close_scenes(self): - """ Closes all scenes for this render manager """ - - from enthought.mayavi import mlab - eng = mlab.get_engine() - try: - # Uncomment to activate again - #eng.close_scene(self.scene2d) - eng.close_scene(self.scene3d) - - except Exception: - pass - # mlab.close(self.scene3d) - - - def layout_3dview(self, surfacecontainerid, surfaceid): - """ Visualizes the 3D view, initial rendering if necessary! - - Parameters - ---------- - surfacecontainerid : int - The surface container id to use for layouting - surfaceid : int - The particular surface to use for layouting - - """ - import time - - tic = time.time() - # compute the sourceobject for layouting - self.datasourcemanager._compute_3DLayout(surfacecontainerid, surfaceid) - toc = time.time() - logger.debug("SourceObject has been changed successfully. (Time: %s)" % str(toc-tic)) - - # disable rendering for speedup - self.scene3d.scene.disable_render = True - - # set the correct scene for the update (scene3d) - self.engine.current_scene = self.scene3d - - # is there already data in the scenes, when not, create. - if self.nodesrc is None and self.vectorsrc is None and self.surfsrc is None: - - tic = time.time() - self.visualize_graph() - toc = time.time() - logger.debug('Graph rendered. Time: %s' % str(toc-tic)) - - tic = time.time() - self.visualize_surface() - toc = time.time() - logger.debug('Surface rendered. Time: %s' % str(toc-tic)) - else: - # get the source object - tso = self.datasourcemanager.get_sourceobject() - - tic = time.time() - # update the positions of the network nodes - self.nodesrc.mlab_source.set(x=tso.positions[:,0],\ - y=tso.positions[:,1],\ - z=tso.positions[:,2]) - self.nodesrc.mlab_source.update() - - toc = time.time() - logger.debug('Node position updated. Time: %s' % str(toc-tic)) - - tic = time.time() - # update start_positions and vectors for the network - self.vectorsrc.mlab_source.set(x=tso.start_positions[0],\ - y=tso.start_positions[1],z=tso.start_positions[2],\ - u=tso.vectors[0],v=tso.vectors[1],w=tso.vectors[2]) - - # update the rendering - self.vectorsrc.mlab_source.update() - toc = time.time() - logger.debug('Connectivity source updated. Time: %s' % str(toc-tic)) - - tic = time.time() - # update surface coordinates, triangles and labelarray - # important: use reset because dimensions might have changed - self.surfsrc.mlab_source.reset(x=tso.daV[:,0],\ - y=tso.daV[:,1], z=tso.daV[:,2],\ - triangles=tso.daF,\ - scalars=tso.labelarr.ravel()) - toc = time.time() - - # update the surface visibility - self._show_surface() - - logger.debug('Surface source updated. Time: %s' % str(toc-tic)) - - # enable rendering again - self.scene3d.scene.disable_render = False - - # update statusbar (with do_later) - from enthought.pyface.timer.api import do_later - do_later(self.network._parentcfile._workbenchwin.status_bar_manager.set, message = '') - - def visualize_surface(self): - """ Visualizes the given surface """ - from enthought.mayavi import mlab - - # precondition for surface visualization - if self.scene3d is None: - self.scene3d = self._create3DScene() - - # alias for currently used scene - fig = self.scene3d - - # get source object - srcobj = self.datasourcemanager.get_sourceobject() - - # dummy scalar array includes zero up to max - scalars_dummy = np.zeros(srcobj.labelarr_orig.ravel().shape ) - scalars_dummy[-1] = np.max(srcobj.labelarr_orig) - - self.surfsrc = mlab.pipeline.triangular_mesh_source(srcobj.daV[:,0],srcobj.daV[:,1],srcobj.daV[:,2],\ - srcobj.daF, name='Surface', scalars = scalars_dummy) #srcobj.labelarr_orig.ravel() ) - - # to ameliorate vtkLookupTable: Bad table range - outsurf = mlab.pipeline.select_output(self.surfsrc) - - thr = mlab.pipeline.threshold(outsurf, low=0.0, up=np.max(srcobj.labelarr_orig) ) - thr.auto_reset_lower = False - thr.auto_reset_upper = False - thr.filter_type = 'cells' - - self.surf = mlab.pipeline.surface(thr, colormap='prism', opacity = 1.0) - self.surf.actor.mapper.interpolate_scalars_before_mapping = True - - # setting surfsrc to labelarr - self.surfsrc.mlab_source.scalars = srcobj.labelarr - self.surfsrc.mlab_source.update() - - # set lower threshold to 1 - thr.lower_threshold = 1.0 - thr.upper_threshold = np.max(srcobj.labelarr_orig) - - - def visualize_graph(self): - """ Visualize the graph with the 3D view """ - from enthought.mayavi import mlab - from enthought.tvtk.api import tvtk - - # precondition for the graph visualization - if self.scene3d is None: - self.scene3d = self._create3DScene() - - # alias for currently used scene - fig = self.scene3d - - # get source object - srcobj = self.datasourcemanager.get_sourceobject() - - # create node source - ##### - self.nodesrc = mlab.pipeline.scalar_scatter(srcobj.positions[:,0], srcobj.positions[:,1], srcobj.positions[:,2],\ - figure = fig, name = 'Node Source') - - # adding scalar data arrays - # create a sequence array to map the node ids to color - from numpy import array - ar = array(range(1,len(srcobj.nodeids)+1)) - - self.nodesrc.mlab_source.dataset.point_data.add_array(ar) - self.nodesrc.mlab_source.dataset.point_data.get_array(0).name = 'nodeids' - - self.nodesrc.mlab_source.dataset.point_data.add_array(srcobj.selected_nodes) - self.nodesrc.mlab_source.dataset.point_data.get_array(1).name = 'selected_nodes' - - # setting the active attributes - actsel1 = mlab.pipeline.set_active_attribute(self.nodesrc, point_scalars='nodeids', \ - name="Colored Nodes") - actsel2 = mlab.pipeline.set_active_attribute(self.nodesrc, point_scalars='selected_nodes', \ - name="Selected Nodes") - - # create glyphs - self.nodes = mlab.pipeline.glyph(actsel1, scale_factor=3.0, scale_mode='none',\ - name = 'Nodes', mode='cube') - self.nodes.glyph.color_mode = 'color_by_scalar' - # FIXME: - # interpolate setting to true makes the color mapping wrong on linux - # otherwise on windows, if not set to true, the cubes stay dark (why?) - from sys import platform - if 'win32' in platform: - self.nodes.actor.mapper.interpolate_scalars_before_mapping = True - - # if there exists a colormap, use it - l = self.nodes.glyph.module.module_manager.scalar_lut_manager.lut - # number of colors has to be greater equal to 2 - if not len(srcobj.nodeids) < 2: - l.number_of_colors = len(srcobj.nodeids) - l.build() - - # getting colors from source object - l.table = srcobj.colors - - # create glyphs for selected nodes - self.nodes_selected = mlab.pipeline.glyph(actsel2, scale_mode = 'scalar', \ - opacity = 0.2, scale_factor = 7.0, \ - name = 'Nodes', color = (0.92, 0.98, 0.27)) - self.nodes_selected.glyph.color_mode = 'no_coloring' - self.nodes_selected.glyph.glyph.clamping = False - self.nodes_selected.glyph.glyph_source.glyph_source.phi_resolution = 12 - self.nodes_selected.glyph.glyph_source.glyph_source.theta_resolution = 12 - self.nodes_selected.actor.mapper.interpolate_scalars_before_mapping = True - - # should I load the node labels? - # this is too slow for many nodes - if preference_manager.cviewerui.labelload: - for index, label in enumerate(srcobj.labels): - tmplabel = mlab.text(srcobj.positions[index,0], srcobj.positions[index,1], \ - label, z=srcobj.positions[index,2], \ - width=0.010*len(label), \ - color = (1,1,1), name='Node Label ' + label) - tmplabel.property.shadow = True - - # split up what was achieved before by quiver3d - # add a vector_scatter data source with scalars - self.vectorsrc = mlab.pipeline.vector_scatter(srcobj.start_positions[0], - srcobj.start_positions[1], - srcobj.start_positions[2], - srcobj.vectors[0], - srcobj.vectors[1], - srcobj.vectors[2], - name = 'Connectivity Source', - figure = fig) - - lastkey = '' - # add all the scalars we have (from the srcobj scalarsdict) - # this should be an ordered dict! - for key, value in srcobj.scalarsdict.items(): - - da = tvtk.DoubleArray(name=str(key)) - da.from_array(srcobj.scalarsdict[key]) - - self.vectorsrc.mlab_source.dataset.point_data.add_array(da) - self.vectorsrc.mlab_source.dataset.point_data.scalars = da.to_array() - self.vectorsrc.mlab_source.dataset.point_data.scalars.name = str(key) - lastkey = str(key) - - # this is the winning time-consuming line, and can be ommited in further mayavi releases - self.vectorsrc.outputs[0].update() - - # add a set active attribute filter to select the scalars - self.attract = mlab.pipeline.set_active_attribute(self.vectorsrc, point_scalars=lastkey, \ - name="Set Edge Attribute") - - self.thres = mlab.pipeline.threshold(self.attract, name="Thresholding") - # to prevent vtkLookupTable: Bad table range - self.thres.filter_type = 'cells' - #self.thres.threshold_filter.all_scalars = False - - if srcobj.directed: - - self.vectors = mlab.pipeline.vectors(self.thres,\ - colormap='OrRd', - figure=fig, - name='Connections', - mode='arrow', - scale_factor=1, - resolution=20, - scale_mode = 'vector') - - self.vectors.glyph.glyph_source.glyph_source.shaft_radius = 0.015 - self.vectors.glyph.glyph_source.glyph_source.shaft_resolution = 20 - - self.vectors.glyph.glyph_source.glyph_source.tip_radius = 0.04 - self.vectors.glyph.glyph_source.glyph_source.tip_length = 0.15 - self.vectors.glyph.glyph_source.glyph_source.tip_resolution = 20 - - self.vectors.glyph.color_mode = 'color_by_scalar' - self.vectors.glyph.glyph.clamping = False - - else: - # then create a .vectors filter to display - self.vectors = mlab.pipeline.vectors(self.thres,\ - colormap='OrRd', - #mode='cylinder', - figure=fig, - name='Connections', - #scale_factor=1, - #resolution=20, - # make the opacity of the actor depend on the scalar. - #transparent=True, - scale_mode = 'vector') - - self.vectors.glyph.glyph_source.glyph_source.glyph_type = 'dash' - # vectors.glyph.glyph_source.glyph_source.radius = 0.01 - self.vectors.glyph.color_mode = 'color_by_scalar' - self.vectors.glyph.glyph.clamping = False - - def update_node_scale_factor(self, scale_factor): - """ Updates the scale factor for both the colored and the selected nodes """ - self.nodes.glyph.glyph.scale_factor = float(scale_factor) - self.nodes_selected.glyph.glyph.scale_factor = float(scale_factor) * 2.33 - - def update_graph_visualization(self): - """ Updates the graph visualization, taking the information - from the source object. """ - import time - - # update the node position - - # disable rendering for speedup - self.scene3d.scene.disable_render = True - - # set the correct scene for the update (scene3d) - self.engine.current_scene = self.scene3d - - tso = self.datasourcemanager.get_sourceobject() - - # update the positions of the network nodes - tic = time.time() - self.nodesrc.mlab_source.set(x=tso.positions[:,0],\ - y=tso.positions[:,1],\ - z=tso.positions[:,2]) - self.nodesrc.mlab_source.update() - toc = time.time() - logger.debug('Node positions updated. Time: %s' % str(toc-tic)) - - # update start_positions and vectors for the network - tic = time.time() - self.vectorsrc.mlab_source.set(x=tso.start_positions[0],\ - y=tso.start_positions[1],z=tso.start_positions[2],\ - u=tso.vectors[0],v=tso.vectors[1],w=tso.vectors[2]) - - # update the rendering - self.vectorsrc.mlab_source.update() - toc = time.time() - logger.debug('Connectivity source updated. Time: %s' % str(toc-tic)) - tic = time.time() - - # enable rendering again - self.scene3d.scene.disable_render = False - - # update the node size and color - # XXX - - def invoke_matrix_viewer(self): - """ Invoke the Conectome Matrix Viewer """ - from cviewer.visualization.matrix.cmatrix_viewer import CMatrixViewer - self.cmatrix_viewer = CMatrixViewer(self.network) - self.cmatrix_viewer.edit_traits() - - diff --git a/setup.py b/setup.py index 5f6c92b..402b33e 100644 --- a/setup.py +++ b/setup.py @@ -1,95 +1,95 @@ #!/usr/bin/env python import sys from glob import glob from distutils import log from distutils.cmd import Command import numpy as np # monkey-patch numpy distutils to use Cython instead of Pyrex from build_helpers import generate_a_pyrex_source, package_check, make_cython_ext, INFO_VARS -from numpy.distutils.command.build_src import build_src -build_src.generate_a_pyrex_source = generate_a_pyrex_source +#from numpy.distutils.command.build_src import build_src +#build_src.generate_a_pyrex_source = generate_a_pyrex_source def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options(ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True) config.add_subpackage('cviewer') return config ################################################################################ # Dependency check ################################################################################ def _mayavi_version(pkg_name): from enthought.mayavi import version return version.version def _traits_version(pkg_name): from enthought.traits import version return version.__version__ package_check('scipy', INFO_VARS['scipy_min_version']) package_check('networkx', INFO_VARS['networkx_min_version']) package_check('numpy', INFO_VARS['numpy_min_version']) package_check('enthought.mayavi', INFO_VARS['mayavi_min_version'],version_getter=_mayavi_version) package_check('enthought.traits', INFO_VARS['traits_min_version'],version_getter=_traits_version) ################################################################################ ################################################################################ # For some commands, use setuptools if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', 'egg_info', 'easy_install', )).intersection(sys.argv)) > 0: from setup_egg import extra_setuptools_args # extra_setuptools_args can be defined from the line above, but it can # also be defined here because setup.py has been exec'ed from # setup_egg.py. if not 'extra_setuptools_args' in globals(): extra_setuptools_args = dict() def main(**extra_args): from numpy.distutils.core import setup setup( name = 'ConnectomeViewer', version = INFO_VARS['version'], author = "Stephan Gerhard", author_email = "[email protected]", classifiers = [c.strip() for c in """\ Development Status :: 4 - Beta Intended Audience :: Developers Intended Audience :: Science/Research Operating System :: OS Independent Operating System :: POSIX Operating System :: POSIX :: Linux Operating System :: Unix Programming Language :: Python Topic :: Scientific/Engineering Topic :: Software Development """.splitlines() if len(c.split()) > 0], description = "Multi-Modal MR Connectomics Framework for Analysis and Visualization", license = "Modified BSD License", long_description = INFO_VARS['long_description'], maintainer = 'Stephan Gerhard', maintainer_email = '[email protected]', platforms = ["Linux", "Unix"], url = 'http://www.connectomeviewer.org/', - scripts = glob('scripts/*.py'), - ext_modules = [per_ext, tvol_ext, rec_ext], + scripts = glob('scripts/*'), +# ext_modules = [per_ext, tvol_ext, rec_ext], configuration = configuration, **extra_args ) if __name__ == "__main__": main()
LTS5/connectomeviewer
9abfeab978a6d2b0c35d757bcb76093a8f37ee5a
Fix in Chaco connection matrix viewer
diff --git a/cviewer/visualization/matrix/con_matrix_viewer.py b/cviewer/visualization/matrix/con_matrix_viewer.py index 7a8c30e..5f257b7 100644 --- a/cviewer/visualization/matrix/con_matrix_viewer.py +++ b/cviewer/visualization/matrix/con_matrix_viewer.py @@ -1,195 +1,199 @@ """ Matrix Viewer Extension * Left-drag pans the plot * Mousewheel up and down zooms the plot in and out * Pressing "z" brings up the Zoom Box, and you can click-drag a rectangular region to zoom. If you use a sequence of zoom boxes, pressing alt-left-arrow and alt-right-arrow moves you forwards and backwards through the "zoom history". * Right-click on the colorbar selects highlighted value range """ # Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and # University Hospital Center and University of Lausanne (UNIL-CHUV) # # Modified BSD License # Major library imports from enthought.enable.api import BaseTool # Enthought library imports from enthought.enable.api import Component, ComponentEditor, Window from enthought.traits.api import HasTraits, Instance, Str, Enum, Float, Int, Property, Any from enthought.traits.ui.api import Item, Group, View, HGroup, Handler # Chaco imports from enthought.chaco.api import ArrayPlotData, ColorBar, HPlotContainer, jet, LinearMapper, Plot from enthought.chaco.tools.api import PanTool, RangeSelection, RangeSelectionOverlay, ZoomTool class CustomHandler(Handler): """ Handler used to set NetworkName in TraitsTitle """ def object_data_name_changed(self, info): if not info.initialized: info.ui.title = "Connection Matrix: " + info.object.data_name class CustomTool(BaseTool): xval = Float yval = Float def normal_mouse_move(self, event): xval, yval = self.component.map_data((event.x, event.y)) - + #print "xval", xval self.xval = xval self.yval = yval class ConnectionMatrixViewer(HasTraits): tplot = Instance(Plot) plot = Instance(Component) custtool = Instance(CustomTool) colorbar = Instance(ColorBar) fro = Any to = Any data = None val = Float nodelabels = Any traits_view = View( Group( Item('plot', editor=ComponentEditor(size=(800,600)), show_label=False), HGroup( Item('fro', label="From", style = 'readonly', springy=True), Item('to', label="To", style = 'readonly', springy=True), Item('val', label="Value", style = 'readonly', springy=True), ), orientation = "vertical"), Item('data_name', label="Edge key"), # handler=CustomHandler(), resizable=True, title="Connection Matrix Viewer" ) def __init__(self, nodelabels, matdict, **traits): """ Starts a matrix inspector Parameters ---------- nodelables : list List of strings of labels for the rows of the matrix matdict : dictionary Keys are the edge type and values are NxN Numpy arrays """ super(HasTraits, self).__init__(**traits) self.add_trait('data_name', Enum(matdict.keys())) self.data_name = matdict.keys()[0] self.data = matdict self.nodelables = nodelabels self.plot = self._create_plot_component() # set trait notification on customtool self.custtool.on_trait_change(self._update_fields, "xval") self.custtool.on_trait_change(self._update_fields, "yval") def _data_name_changed(self, old, new): self.pd.set_data("imagedata", self.data[self.data_name]) #self.my_plot.set_value_selection((0, 2)) self.tplot.title = "Connection Matrix for %s" % self.data_name def _update_fields(self): - from numpy import trunc # map mouse location to array index - frotmp = int(trunc(self.custtool.yval)) - totmp = int(trunc(self.custtool.xval)) + frotmp = int(round(self.custtool.yval) - 1) + totmp = int(round(self.custtool.xval) - 1) # check if within range sh = self.data[self.data_name].shape # assume matrix whose shape is (# of rows, # of columns) if frotmp >= 0 and frotmp < sh[0] and totmp >= 0 and totmp < sh[1]: - row = " (%i" % (frotmp + 1) + ")" - col = " (%i" % (totmp + 1) + ")" + row = " (index: %i" % (frotmp + 1) + ")" + col = " (index: %i" % (totmp + 1) + ")" self.fro = " " + str(self.nodelables[frotmp]) + row self.to = " " + str(self.nodelables[totmp]) + col self.val = self.data[self.data_name][frotmp, totmp] def _create_plot_component(self): # Create a plot data object and give it this data self.pd = ArrayPlotData() self.pd.set_data("imagedata", self.data[self.data_name]) + # find dimensions + xdim = self.data[self.data_name].shape[1] + ydim = self.data[self.data_name].shape[0] + # Create the plot self.tplot = Plot(self.pd, default_origin="top left") self.tplot.x_axis.orientation = "top" self.tplot.img_plot("imagedata", name="my_plot", - #xbounds=(0,10), - #ybounds=(0,10), + xbounds=(0.5,xdim + 0.5), + ybounds=(0.5,ydim + 0.5), colormap=jet) # Tweak some of the plot properties self.tplot.title = "Connection Matrix for %s" % self.data_name self.tplot.padding = 80 # Right now, some of the tools are a little invasive, and we need the # actual CMapImage object to give to them self.my_plot = self.tplot.plots["my_plot"][0] # Attach some tools to the plot self.tplot.tools.append(PanTool(self.tplot)) zoom = ZoomTool(component=self.tplot, tool_mode="box", always_on=False) self.tplot.overlays.append(zoom) # my custom tool to get the connection information self.custtool = CustomTool(self.tplot) self.tplot.tools.append(self.custtool) # Create the colorbar, handing in the appropriate range and colormap colormap = self.my_plot.color_mapper self.colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range), color_mapper=colormap, plot=self.my_plot, orientation='v', resizable='v', width=30, padding=20) self.colorbar.padding_top = self.tplot.padding_top self.colorbar.padding_bottom = self.tplot.padding_bottom # create a range selection for the colorbar self.range_selection = RangeSelection(component=self.colorbar) self.colorbar.tools.append(self.range_selection) self.colorbar.overlays.append(RangeSelectionOverlay(component=self.colorbar, border_color="white", alpha=0.8, fill_color="lightgray")) # we also want to the range selection to inform the cmap plot of # the selection, so set that up as well self.range_selection.listeners.append(self.my_plot) # Create a container to position the plot and the colorbar side-by-side container = HPlotContainer(use_backbuffer = True) container.add(self.tplot) container.add(self.colorbar) container.bgcolor = "white" return container if __name__ == "__main__": import numpy as np - nodelabels = [str(e) for e in range(300)] - matdict = {'edgval1':np.random.random( (300,300) ), 'edgval2': np.random.random( (300,300) )} + nodelabels = [str(e) for e in range(3)] + nodelabels = ['a', 'b', 'c'] + matdict = {'edgval1':np.random.random( (3,3) ), 'edgval2': np.random.random( (3,3) )} demo = ConnectionMatrixViewer(nodelabels, matdict) demo.configure_traits()
Anber/django-schedule-field
3428732570eba342457b9e4551c9e9f33333cda5
.button > .schedule-menu-item
diff --git a/media/widgets/schedule/schedule.js b/media/widgets/schedule/schedule.js index 23a5177..ccbfc4a 100644 --- a/media/widgets/schedule/schedule.js +++ b/media/widgets/schedule/schedule.js @@ -1,221 +1,221 @@ if (!Array.prototype.map) { Array.prototype.map = function(fun /*, thisp*/) { var len = this.length; if (typeof fun != "function") throw new TypeError(); var res = new Array(len); var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in this) res[i] = fun.call(thisp, this[i], i, this); } return res; }; } Array.prototype.max = function() { var max = this[0]; var len = this.length; for (var i = 1; i < len; i++) if (this[i] > max) max = this[i]; return max; }; Array.prototype.min = function() { var min = this[0]; var len = this.length; for (var i = 1; i < len; i++) if (this[i] < min) min = this[i]; return min; }; (function($) { $.fn.schedule = function(options) { var defaults = { 'days': ['пн', 'вт', 'ср', 'чт', 'пт', 'сб', 'вс'], 'serializer': function(val) { var res = []; val.map(function(el, i) { res.push(el.day+'_'+el.hour); }); return res.join(','); }, 'deserializer': function(val) { var res = []; if (!val) return res; val.split(',').map(function(el, i) { var item = el.split('_'); res.push({ 'day': item[0], 'hour': item[1] }); }); return res; } }; var opts = $.extend(defaults, options); this.map(function(i, el) { var field = $(el); // Значение var val = function() { var val = []; $('.work', hours).map(function(i, el) { val.push({ 'day': parseInt($(el).attr('data-day')), 'hour': parseInt($(el).attr('data-hour')) }); }); return val; } // Сериализатор и десериализатор var serializer = opts['serializer']; var deserializer = opts['deserializer']; // Сохраняет значение в поле var setValue = function() { $(field).val(serializer(val())); $(field).change(); } // Выгружает значение из поля var getValue = function() { $('.hover', hours).removeClass('hover work'); var marked = deserializer($(field).val()); marked.map(function(el, i) { hours_index[el.day + '_' + el.hour].addClass('work'); }); } // Закрытие контекстного меню var close_context_menu = function() { context_menu.fadeOut(200); $('.hover', hours).removeClass('hover'); }; // Пометить часы как рабочие var mark_as_work = function() { $('.hover', hours).addClass('work'); close_context_menu(); setValue(); }; // Пометить часы как нерабочие var mark_as_off = function() { $('.hover', hours).removeClass('work'); close_context_menu(); setValue(); }; // Инвертировать var invert = function() { $('.hover', hours).toggleClass('work'); close_context_menu(); setValue(); } // Скрываем поле ввода field.hide(); // Создаём wrapper для всего виджета var wrapper = $('<div></div>').addClass('schedule-widget'); field.before(wrapper); // Создаём контекстное меню var context_menu = $('<div></div>').addClass('schedule-context-menu').hide(); - context_menu.append($('<a href="javascript:void(0);">Рабочее время</a>').addClass('button').click(mark_as_work)); - context_menu.append($('<a href="javascript:void(0);">Нерабочее время</a>').addClass('button').click(mark_as_off)); - context_menu.append($('<a href="javascript:void(0);">Инвертировать</a>').addClass('button').click(invert)); - context_menu.append($('<a href="javascript:void(0);">Отмена</a>').addClass('button').click(close_context_menu)); + context_menu.append($('<a href="javascript:void(0);">Рабочее время</a>').addClass('schedule-menu-item').click(mark_as_work)); + context_menu.append($('<a href="javascript:void(0);">Нерабочее время</a>').addClass('schedule-menu-item').click(mark_as_off)); + context_menu.append($('<a href="javascript:void(0);">Инвертировать</a>').addClass('schedule-menu-item').click(invert)); + context_menu.append($('<a href="javascript:void(0);">Отмена</a>').addClass('schedule-menu-item').click(close_context_menu)); $('body').append(context_menu); // Верхняя левая ячейка wrapper.append($('<div></div>').addClass('cell blank')); // Строка со списком часов for (var h = 0; h < 24; h++) { wrapper.append($('<div>' + h + '</div>').addClass('cell header').attr('data-hour', h)); } // Wrapper для сетки var hours = $('<div></div>').addClass('hours'); wrapper.append(hours); // Индекс var hours_index = {}; // Строим сетку opts['days'].map(function(day, i) { for (var h = 0; h < 24; h++) { hours_index[i+'_'+h] = $('<div></div>').addClass('cell hour').attr('data-day', i).attr('data-hour', h) hours.append(hours_index[i+'_'+h]); } }); // Столбик с названиями дней недели opts['days'].map(function(day, i) { wrapper.append($('<div>' + day + '</div>').addClass('cell header').attr('data-day', i)); }); // Инициализация переменных var mousedown = false; var prev_cell = null; var start_cell = null; var end_cell = null; // Блокируем выделение $(hours).bind('selectstart', function() { return false; }); // Нажали кнопку мышки $(hours).mousedown(function(ev) { mousedown = true; start_cell = end_cell = prev_cell = ev.target; $('.hover', hours).removeClass('hover'); $(prev_cell).addClass('hover'); return false; }); // Перемещаем мышку $(hours).mousemove(function(ev) { if (!mousedown || prev_cell == ev.target) return true; end_cell = prev_cell = ev.target; var days_val = [ parseInt($(start_cell).attr('data-day')), parseInt($(end_cell).attr('data-day')) ]; var hours_val = [ parseInt($(start_cell).attr('data-hour')), parseInt($(end_cell).attr('data-hour')) ]; $('.hover', hours).removeClass('hover'); for (var d = days_val.min(); d <= days_val.max(); d++) { for (var h = hours_val.min(); h <= hours_val.max(); h++) { hours_index[d+'_'+h].addClass('hover'); } } return false; }); // Отпустили кнопку мышки $('body').mouseup(function(ev) { if (!mousedown) return true; mousedown = false; start_cell = end_cell = prev_cell = null; context_menu.css({ top: ev.pageY, left: ev.pageX }).fadeIn(200); return false; }); // Отрисовываем содержимое поля в сетку getValue(); }); }; })(jQuery); $(function() { $('[data-widget=schedule]').schedule(); });
Anber/django-schedule-field
1f30ee7eef45b9991627eb578ce9d0fcf1e8c924
Remove <script> from widget
diff --git a/media/widgets/schedule/schedule.js b/media/widgets/schedule/schedule.js index 9032a30..23a5177 100644 --- a/media/widgets/schedule/schedule.js +++ b/media/widgets/schedule/schedule.js @@ -1,215 +1,221 @@ if (!Array.prototype.map) { Array.prototype.map = function(fun /*, thisp*/) { var len = this.length; if (typeof fun != "function") throw new TypeError(); - + var res = new Array(len); var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in this) res[i] = fun.call(thisp, this[i], i, this); } - + return res; }; } Array.prototype.max = function() { var max = this[0]; var len = this.length; for (var i = 1; i < len; i++) if (this[i] > max) max = this[i]; return max; }; Array.prototype.min = function() { var min = this[0]; var len = this.length; for (var i = 1; i < len; i++) if (this[i] < min) min = this[i]; return min; }; (function($) { $.fn.schedule = function(options) { var defaults = { 'days': ['пн', 'вт', 'ср', 'чт', 'пт', 'сб', 'вс'], 'serializer': function(val) { var res = []; val.map(function(el, i) { res.push(el.day+'_'+el.hour); }); return res.join(','); }, 'deserializer': function(val) { var res = []; if (!val) return res; val.split(',').map(function(el, i) { var item = el.split('_'); res.push({ 'day': item[0], 'hour': item[1] }); }); return res; } }; var opts = $.extend(defaults, options); - - // Значение - var val = function() { - var val = []; - $('.work', hours).map(function(i, el) { - val.push({ - 'day': parseInt($(el).attr('data-day')), - 'hour': parseInt($(el).attr('data-hour')) + + this.map(function(i, el) { + var field = $(el); + // Значение + var val = function() { + var val = []; + $('.work', hours).map(function(i, el) { + val.push({ + 'day': parseInt($(el).attr('data-day')), + 'hour': parseInt($(el).attr('data-hour')) + }); }); - }); - return val; - } - - // Сериализатор и десериализатор - var serializer = opts['serializer']; - var deserializer = opts['deserializer']; - - // Сохраняет значение в поле - var setValue = function() { - $(field).val(serializer(val())); - $(field).change(); - } - - // Выгружает значение из поля - var getValue = function() { - $('.hover', hours).removeClass('hover work'); - var marked = deserializer($(field).val()); - marked.map(function(el, i) { - hours_index[el.day + '_' + el.hour].addClass('work'); - }); - } - - // Закрытие контекстного меню - var close_context_menu = function() { - context_menu.fadeOut(200); - $('.hover', hours).removeClass('hover'); - }; - - // Пометить часы как рабочие - var mark_as_work = function() { - $('.hover', hours).addClass('work'); - close_context_menu(); - setValue(); - }; - - // Пометить часы как нерабочие - var mark_as_off = function() { - $('.hover', hours).removeClass('work'); - close_context_menu(); - setValue(); - }; - - // Инвертировать - var invert = function() { - $('.hover', hours).toggleClass('work'); - close_context_menu(); - setValue(); - } - - // Скрываем поле ввода - var field = this; - field.hide(); - - // Создаём wrapper для всего виджета - var wrapper = $('<div></div>').addClass('schedule-widget'); - field.before(wrapper); - - // Создаём контекстное меню - var context_menu = $('<div></div>').addClass('schedule-context-menu').hide(); - context_menu.append($('<a href="javascript:void(0);">Рабочее время</a>').addClass('button').click(mark_as_work)); - context_menu.append($('<a href="javascript:void(0);">Нерабочее время</a>').addClass('button').click(mark_as_off)); - context_menu.append($('<a href="javascript:void(0);">Инвертировать</a>').addClass('button').click(invert)); - context_menu.append($('<a href="javascript:void(0);">Отмена</a>').addClass('button').click(close_context_menu)); - $('body').append(context_menu); - - // Верхняя левая ячейка - wrapper.append($('<div></div>').addClass('cell blank')); - - // Строка со списком часов - for (var h = 0; h < 24; h++) { - wrapper.append($('<div>' + h + '</div>').addClass('cell header').attr('data-hour', h)); - } - - // Wrapper для сетки - var hours = $('<div></div>').addClass('hours'); - wrapper.append(hours); - - // Индекс - var hours_index = {}; - - // Строим сетку - opts['days'].map(function(day, i) { + return val; + } + + // Сериализатор и десериализатор + var serializer = opts['serializer']; + var deserializer = opts['deserializer']; + + // Сохраняет значение в поле + var setValue = function() { + $(field).val(serializer(val())); + $(field).change(); + } + + // Выгружает значение из поля + var getValue = function() { + $('.hover', hours).removeClass('hover work'); + var marked = deserializer($(field).val()); + marked.map(function(el, i) { + hours_index[el.day + '_' + el.hour].addClass('work'); + }); + } + + // Закрытие контекстного меню + var close_context_menu = function() { + context_menu.fadeOut(200); + $('.hover', hours).removeClass('hover'); + }; + + // Пометить часы как рабочие + var mark_as_work = function() { + $('.hover', hours).addClass('work'); + close_context_menu(); + setValue(); + }; + + // Пометить часы как нерабочие + var mark_as_off = function() { + $('.hover', hours).removeClass('work'); + close_context_menu(); + setValue(); + }; + + // Инвертировать + var invert = function() { + $('.hover', hours).toggleClass('work'); + close_context_menu(); + setValue(); + } + + // Скрываем поле ввода + field.hide(); + + // Создаём wrapper для всего виджета + var wrapper = $('<div></div>').addClass('schedule-widget'); + field.before(wrapper); + + // Создаём контекстное меню + var context_menu = $('<div></div>').addClass('schedule-context-menu').hide(); + context_menu.append($('<a href="javascript:void(0);">Рабочее время</a>').addClass('button').click(mark_as_work)); + context_menu.append($('<a href="javascript:void(0);">Нерабочее время</a>').addClass('button').click(mark_as_off)); + context_menu.append($('<a href="javascript:void(0);">Инвертировать</a>').addClass('button').click(invert)); + context_menu.append($('<a href="javascript:void(0);">Отмена</a>').addClass('button').click(close_context_menu)); + $('body').append(context_menu); + + // Верхняя левая ячейка + wrapper.append($('<div></div>').addClass('cell blank')); + + // Строка со списком часов for (var h = 0; h < 24; h++) { - hours_index[i+'_'+h] = $('<div></div>').addClass('cell hour').attr('data-day', i).attr('data-hour', h) - hours.append(hours_index[i+'_'+h]); + wrapper.append($('<div>' + h + '</div>').addClass('cell header').attr('data-hour', h)); } - }); - - // Столбик с названиями дней недели - opts['days'].map(function(day, i) { - wrapper.append($('<div>' + day + '</div>').addClass('cell header').attr('data-day', i)); - }); - - // Инициализация переменных - var mousedown = false; - var prev_cell = null; - var start_cell = null; - var end_cell = null; - - // Блокируем выделение - $(hours).bind('selectstart', function() { - return false; - }); - - // Нажали кнопку мышки - $(hours).mousedown(function(ev) { - mousedown = true; - start_cell = end_cell = prev_cell = ev.target; - $('.hover', hours).removeClass('hover'); - $(prev_cell).addClass('hover'); - return false; - }); - - // Перемещаем мышку - $(hours).mousemove(function(ev) { - if (!mousedown || prev_cell == ev.target) return true; - end_cell = prev_cell = ev.target; - - var days_val = [ - parseInt($(start_cell).attr('data-day')), - parseInt($(end_cell).attr('data-day')) - ]; - var hours_val = [ - parseInt($(start_cell).attr('data-hour')), - parseInt($(end_cell).attr('data-hour')) - ]; - - $('.hover', hours).removeClass('hover'); - for (var d = days_val.min(); d <= days_val.max(); d++) { - for (var h = hours_val.min(); h <= hours_val.max(); h++) { - hours_index[d+'_'+h].addClass('hover'); + + // Wrapper для сетки + var hours = $('<div></div>').addClass('hours'); + wrapper.append(hours); + + // Индекс + var hours_index = {}; + + // Строим сетку + opts['days'].map(function(day, i) { + for (var h = 0; h < 24; h++) { + hours_index[i+'_'+h] = $('<div></div>').addClass('cell hour').attr('data-day', i).attr('data-hour', h) + hours.append(hours_index[i+'_'+h]); } - } - return false; - }); - - // Отпустили кнопку мышки - $('body').mouseup(function(ev) { - if (!mousedown) return true; - mousedown = false; - start_cell = end_cell = prev_cell = null; - context_menu.css({ top: ev.pageY, left: ev.pageX }).fadeIn(200); - return false; + }); + + // Столбик с названиями дней недели + opts['days'].map(function(day, i) { + wrapper.append($('<div>' + day + '</div>').addClass('cell header').attr('data-day', i)); + }); + + // Инициализация переменных + var mousedown = false; + var prev_cell = null; + var start_cell = null; + var end_cell = null; + + // Блокируем выделение + $(hours).bind('selectstart', function() { + return false; + }); + + // Нажали кнопку мышки + $(hours).mousedown(function(ev) { + mousedown = true; + start_cell = end_cell = prev_cell = ev.target; + $('.hover', hours).removeClass('hover'); + $(prev_cell).addClass('hover'); + return false; + }); + + // Перемещаем мышку + $(hours).mousemove(function(ev) { + if (!mousedown || prev_cell == ev.target) return true; + end_cell = prev_cell = ev.target; + + var days_val = [ + parseInt($(start_cell).attr('data-day')), + parseInt($(end_cell).attr('data-day')) + ]; + var hours_val = [ + parseInt($(start_cell).attr('data-hour')), + parseInt($(end_cell).attr('data-hour')) + ]; + + $('.hover', hours).removeClass('hover'); + for (var d = days_val.min(); d <= days_val.max(); d++) { + for (var h = hours_val.min(); h <= hours_val.max(); h++) { + hours_index[d+'_'+h].addClass('hover'); + } + } + return false; + }); + + // Отпустили кнопку мышки + $('body').mouseup(function(ev) { + if (!mousedown) return true; + mousedown = false; + start_cell = end_cell = prev_cell = null; + context_menu.css({ top: ev.pageY, left: ev.pageX }).fadeIn(200); + return false; + }); + + // Отрисовываем содержимое поля в сетку + getValue(); }); - - // Отрисовываем содержимое поля в сетку - getValue(); }; })(jQuery); + +$(function() { + $('[data-widget=schedule]').schedule(); +}); diff --git a/schedule_field/__init__.py b/schedule_field/__init__.py index 1195af5..d1fa5aa 100644 --- a/schedule_field/__init__.py +++ b/schedule_field/__init__.py @@ -1,9 +1,9 @@ -VERSION = (0, 0, 1, 'alpha') +VERSION = (0, 0, 2, 'alpha') if VERSION[-1] != "final": # pragma: no cover __version__ = '.'.join(map(str, VERSION)) else: # pragma: no cover __version__ = '.'.join(map(str, VERSION[:-1])) __author__ = u'Anton Yevzhakov' __maintainer__ = u'Anton Yevzhakov' __email__ = '[email protected]' \ No newline at end of file diff --git a/schedule_field/widgets.py b/schedule_field/widgets.py index efedd7f..9fd4307 100644 --- a/schedule_field/widgets.py +++ b/schedule_field/widgets.py @@ -1,24 +1,23 @@ from django.forms.widgets import Textarea from django.utils.safestring import mark_safe from django.utils.html import conditional_escape from django.utils.encoding import force_unicode from django.forms.util import flatatt from schedule_field.models import Hour class ScheduleWidget(Textarea): class Media: css = { 'all': ('widgets/schedule/schedule.css',) } js = ('widgets/schedule/schedule.js',) def render(self, name, value, attrs=None): if value is None: value = '' if isinstance(value, (list, tuple)): value = ','.join(list(Hour.objects.values_list('id', flat=True).filter(pk__in=value))) final_attrs = self.build_attrs(attrs, name=name) - return mark_safe(u"<textarea%s>%s</textarea><script>$(function() {$('#%s').schedule();});</script>" % ( + return mark_safe(u'<textarea data-widget="schedule"%s>%s</textarea>' % ( flatatt(final_attrs), conditional_escape(force_unicode(value)), - final_attrs.get('id'), ))
seouri/medvane3
c4d615e4087e62c44f38f3d803642177abc4d113
be consitent on displaying bibliome age
diff --git a/app/views/bibliomes/index.html.erb b/app/views/bibliomes/index.html.erb index e03e199..5f83cda 100644 --- a/app/views/bibliomes/index.html.erb +++ b/app/views/bibliomes/index.html.erb @@ -1,8 +1,8 @@ <% page_title(@prefix + "Bibliomes") %> <%= page_entries_info @bibliomes %> <ul> <% for item in @bibliomes -%> - <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= item.total_articles %> articles, <%= age(item) %>)</span><%= status(item) %></li> + <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= number_with_delimiter(item.total_articles) %> articles, <%= age(item) %>)</span><%= status(item) %></li> <% end -%> </ul> <%= will_paginate @bibliomes %> \ No newline at end of file
seouri/medvane3
c64baa1984719a4412e565ed4b4268bdb03063b3
added In Process Bibliomes page
diff --git a/app/controllers/bibliomes_controller.rb b/app/controllers/bibliomes_controller.rb index 713a703..2114e7d 100644 --- a/app/controllers/bibliomes_controller.rb +++ b/app/controllers/bibliomes_controller.rb @@ -1,114 +1,122 @@ class BibliomesController < ApplicationController def index @bibliomes = Bibliome.built.paginate(:page => params[:page], :per_page => 10) @prefix = "All " respond_to do |format| format.html # index.html.erb format.xml { render :xml => @bibliomes } end end def recent @bibliomes = Bibliome.recent.paginate(:page => params[:page], :per_page => 10) @prefix = "Recent " respond_to do |format| format.html { render :action => "index" } end end def popular @bibliomes = Bibliome.popular.paginate(:page => params[:page], :per_page => 10) @prefix = "Popular " respond_to do |format| format.html { render :action => "index" } end end + def inprocess + @bibliomes = Bibliome.inprocess.paginate(:page => params[:page], :per_page => 10) + @prefix = "In Process " + respond_to do |format| + format.html { render :action => "index" } + end + end + def show @bibliome = Bibliome.find(params[:id]) @bibliome.hit! respond_to do |format| format.html # show.html.erb format.xml { render :xml => @bibliome } end end def new @q = params[:q] @count = 0 unless @q.blank? @webenv, @count = Medvane::Eutils.esearch(@q) @bibliomes = Bibliome.find_all_by_query(@q) if @count > 0 @medline = Medvane::Eutils.efetch(@webenv, 0, 5, "medline") @show_count = @count < 5 ? @count : 5 @bibliome_name = Digest::MD5.hexdigest(Time.now.to_f.to_s + @q) end end end def import q = params[:q] webenv = params[:w] count = params[:c] || 0 @bibliome = Bibliome.find_or_initialize_by_name(params[:name]) if @bibliome.new_record? and q.blank? == false and webenv.blank? == false and count.to_i > 1 @bibliome.query = q @bibliome.total_articles = count @bibliome.save! priority = (400 / Math.log(count)).to_i 0.step(@bibliome.total_articles.to_i, PubmedImport::RETMAX) do |retstart| Delayed::Job.enqueue(PubmedImport.new(@bibliome.id, webenv, retstart), priority) priority -= 1 end redirect_to @bibliome else redirect_to new_bibliome_path end end def edit @bibliome = Bibliome.find(params[:id]) end def create @bibliome = Bibliome.new(params[:bibliome]) respond_to do |format| if @bibliome.save flash[:notice] = 'Bibliome was successfully created.' format.html { redirect_to(@bibliome) } format.xml { render :xml => @bibliome, :status => :created, :location => @bibliome } else format.html { render :action => "new" } format.xml { render :xml => @bibliome.errors, :status => :unprocessable_entity } end end end def update @bibliome = Bibliome.find(params[:id]) respond_to do |format| if @bibliome.update_attributes(params[:bibliome]) flash[:notice] = 'Bibliome was successfully updated.' format.html { redirect_to(@bibliome) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @bibliome.errors, :status => :unprocessable_entity } end end end def destroy @bibliome = Bibliome.find(params[:id]) @bibliome.destroy respond_to do |format| format.html { redirect_to(bibliomes_url) } format.xml { head :ok } end end end diff --git a/app/views/bibliomes/index.html.erb b/app/views/bibliomes/index.html.erb index 05e89e9..e03e199 100644 --- a/app/views/bibliomes/index.html.erb +++ b/app/views/bibliomes/index.html.erb @@ -1,8 +1,8 @@ <% page_title(@prefix + "Bibliomes") %> <%= page_entries_info @bibliomes %> <ul> <% for item in @bibliomes -%> - <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= item.total_articles %> articles, <%= age(item) %>)</span></li> + <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= item.total_articles %> articles, <%= age(item) %>)</span><%= status(item) %></li> <% end -%> </ul> <%= will_paginate @bibliomes %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ab2d393..2cfbc36 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,59 +1,59 @@ ActionController::Routing::Routes.draw do |map| map.root :controller => "pages", :action => "home" map.about '/about', :controller => "pages", :action => "about" map.help '/help', :controller => "pages", :action => "help" - map.resources :bibliomes, :collection => { :recent => :get, :popular => :get, :import => :post } do |bibliomes| + map.resources :bibliomes, :collection => { :recent => :get, :popular => :get, :import => :post, :inprocess => :get } do |bibliomes| bibliomes.resources :genes bibliomes.resources :pubtypes bibliomes.resources :subjects bibliomes.resources :authors bibliomes.resources :journals bibliomes.resources :articles end map.pubmed '/build/pubmed/:q', :controller => "build", :action => "pubmed", :defaults => {:q => nil} map.import '/build/import/:name', :controller => "build", :action => "import", :defaults => {:name => nil} # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # map.resources :products # Sample resource route with options: # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } # Sample resource route with sub-resources: # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller # Sample resource route with more complex sub-resources # map.resources :products do |products| # products.resources :comments # products.resources :sales, :collection => { :recent => :get } # end # Sample resource route within a namespace: # map.namespace :admin do |admin| # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) # admin.resources :products # end # You can have the root of your site routed with map.root -- just remember to delete public/index.html. # map.root :controller => "welcome" # See how all your routes lay out with "rake routes" # Install the default routes as the lowest priority. # Note: These default routes make all actions in every controller accessible via GET requests. You should # consider removing or commenting them out if you're using named routes and resources. map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end
seouri/medvane3
0c7c67a59279291a63acff637d50f5be1ae9012b
fixed postgresql type cast problem and incorrect column name
diff --git a/app/models/bibliome.rb b/app/models/bibliome.rb index 8ee05f0..7758398 100644 --- a/app/models/bibliome.rb +++ b/app/models/bibliome.rb @@ -1,54 +1,54 @@ class Bibliome < ActiveRecord::Base has_many :bibliome_articles has_many :articles, :through => :bibliome_articles, :order => "#{BibliomeArticle.table_name}.pubdate desc" has_many :journals, :class_name => "BibliomeJournal", :include => :journal has_many :authors, :class_name => "BibliomeAuthor", :include => :author has_many :subjects, :class_name => "BibliomeSubject", :include => :subject #has_many :genes, :class_name => "BibliomeGene", :include => :gene has_many :pubtypes, :class_name => "BibliomePubtype", :include => :pubtype has_many :author_journals has_many :coauthorships has_many :author_subjects has_many :author_pubtypes has_many :journal_subject has_many :journal_pubtypes has_many :cosubjects validates_uniqueness_of :name named_scope :built, :conditions => { :built => true } named_scope :recent, lambda {|limit| { :conditions => { :built => true }, :order => "built_at desc", :limit => limit } } named_scope :popular, lambda {|limit| { :conditions => { :built => true }, :order => "hits desc", :limit => limit } } named_scope :enqueued, :conditions => { :built => false, :articles_count => 0 } - named_scope :inprocess, :conditions => "built=0 AND articles_count > 0" + named_scope :inprocess, :conditions => ["built = ? AND all_articles_count > 0", false] named_scope :last_built, :conditions => { :built => true }, :order => "built_at desc", :limit => 1 def status if built? "finished importing" else "imported" end end def hit! if built? self.delete_at = 2.weeks.from_now self.increment! :hits end end def processing_time to_time = built_at || Time.now from_time = started_at || Time.now (to_time - from_time).round end def build_speed (all_articles_count.to_f / processing_time.to_f * 60).round.to_s + " articles/min" end end
seouri/medvane3
e1a270fe6b4f911751bf219a6b0b6c01d476fecc
fixed bug never showing recent/poplular medvanes
diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index b79b815..f347c74 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,34 +1,34 @@ <% page_title("Biomedical Research at a Glance") -%> <h2>Build Your Own Bibliome</h2> <% form_tag new_bibliome_path, :method => "get", :id => "pubmed_search" do %> <%= text_field_tag('q', @q, :id => "pubmed_search_q") %> <%= hidden_field_tag('count', @count, :name => nil) %> <%= submit_tag "Search PubMed", :name => nil, :disable_with => "Searching PubMed ...", :id => "pubmed_search_submit" %> <div id="sample_search"> Try these queries: <%= link_to("Rett Syndrome", new_bibliome_path(:q => "Rett Syndrome"))%> <%= link_to("plos med[jour]", new_bibliome_path(:q => "plos med[jour]"))%> </div><!-- #sample_search --> <% end -%> <% if [email protected]? -%> <h2>Recent Bibliomes</h2> <ul> <% for item in @recent -%> <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= number_with_delimiter(item.total_articles) %> articles, <%= age(item) %>)</span></li> <% end -%> </ul> -<%= link_to("See more recent bibliomes", recent_bibliomes_path) if (@recent.size > 5) %> +<%= link_to("See more recent bibliomes", recent_bibliomes_path) if (Bibliome.count > 5) %> <% end -%> <% if [email protected]? -%> <h2>Popular Bibliomes</h2> <ul> <% for item in @popular -%> <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= number_with_delimiter(item.total_articles) %> articles, <%= age(item) %>)</span></li> <% end -%> </ul> -<%= link_to("See more popular bibliomes", popular_bibliomes_path) if (@popular.size > 5) %> +<%= link_to("See more popular bibliomes", popular_bibliomes_path) if (Bibliome.count > 5) %> <% end -%> \ No newline at end of file
seouri/medvane3
a4502c3c2115475dc62995ecb8fccd264824016c
migrate down only if migrated up
diff --git a/db/schema.rb b/db/schema.rb index eee3d47..4fbec66 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,332 +1,332 @@ # This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your database schema. If you need # to create the application database on another system, you should be using db:schema:load, not running # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20100128231533) do +ActiveRecord::Schema.define(:version => 20100131153734) do create_table "article_types", :force => true do |t| t.integer "article_id" t.integer "pubtype_id" end add_index "article_types", ["article_id"], :name => "index_article_types_on_article_id" create_table "articles", :force => true do |t| t.integer "journal_id" t.date "pubdate" t.text "title" t.text "affiliation" t.string "source" t.integer "bibliomes_count", :default => 0 end add_index "articles", ["journal_id", "pubdate"], :name => "index_articles_on_journal_id_and_pubdate" add_index "articles", ["pubdate"], :name => "index_articles_on_pubdate" create_table "author_journals", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "journal_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_journals", ["bibliome_id", "author_id", "year", "journal_id"], :name => "index_author_journals_on_bibliome_id_author_id_year_journal_id" add_index "author_journals", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_author_id_year_total" add_index "author_journals", ["bibliome_id", "journal_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_journal_id_year_total" create_table "author_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "pubtype_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "pubtype_id"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_pubtype_id" add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_total" add_index "author_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "author_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "subject_id" t.string "year" t.integer "first_direct", :default => 0 t.integer "first_descendant", :default => 0 t.integer "first_total", :default => 0 t.integer "last_direct", :default => 0 t.integer "last_descendant", :default => 0 t.integer "last_total", :default => 0 t.integer "middle_direct", :default => 0 t.integer "middle_descendant", :default => 0 t.integer "middle_total", :default => 0 t.integer "total_direct", :default => 0 t.integer "total_descendant", :default => 0 t.integer "total_total", :default => 0 end add_index "author_subjects", ["bibliome_id", "author_id", "year", "subject_id"], :name => "index_author_subjects_on_bibliome_id_author_id_year_subject_id" add_index "author_subjects", ["bibliome_id", "author_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_author_year_total_direct" add_index "author_subjects", ["bibliome_id", "subject_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_subject_year_total_direct" create_table "authors", :force => true do |t| t.string "last_name" t.string "fore_name" t.string "initials" t.string "suffix" end add_index "authors", ["last_name", "fore_name", "initials", "suffix"], :name => "index_authors_on_last_name_fore_name_initials_suffix", :unique => true add_index "authors", ["last_name", "initials"], :name => "index_authors_on_last_name_and_initials" create_table "authorships", :force => true do |t| t.integer "article_id" t.integer "author_id" t.integer "position" t.integer "last_position" end add_index "authorships", ["article_id", "position"], :name => "index_authorships_on_article_id_and_position" add_index "authorships", ["author_id"], :name => "index_authorships_on_author_id" create_table "bibliome_articles", :force => true do |t| t.integer "bibliome_id" t.integer "article_id" t.date "pubdate" end add_index "bibliome_articles", ["bibliome_id", "pubdate", "article_id"], :name => "index_bibliome_articles_on_bibliome_id_pubdate_article_id" create_table "bibliome_authors", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_authors", ["bibliome_id", "author_id", "year"], :name => "index_bibliome_authors_on_bibliome_id_and_author_id_and_year" add_index "bibliome_authors", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_authors_on_bibliome_id_year_articles_count" create_table "bibliome_genes", :force => true do |t| t.integer "bibliome_id" t.integer "gene_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_genes", ["bibliome_id", "gene_id", "year"], :name => "index_bibliome_genes_on_bibliome_id_and_gene_id_and_year" add_index "bibliome_genes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_articles_count" create_table "bibliome_journals", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_journals", ["bibliome_id", "journal_id", "year"], :name => "index_bibliome_journals_on_bibliome_id_and_journal_id_and_year" add_index "bibliome_journals", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_journals_on_bibliome_id_year_articles_count" create_table "bibliome_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "pubtype_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_pubtypes", ["bibliome_id", "pubtype_id", "year"], :name => "index_bibliome_pubtypes_on_bibliome_id_and_pubtype_id_and_year" add_index "bibliome_pubtypes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_pubtypes_on_bibliome_id_year_articles_count" create_table "bibliome_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_subjects", ["bibliome_id", "subject_id", "year"], :name => "index_bibliome_subjects_on_bibliome_id_and_subject_id_and_year" add_index "bibliome_subjects", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_subjects_on_bibliome_id_year_articles_count" create_table "bibliomes", :force => true do |t| t.string "name" t.text "query" t.integer "all_articles_count", :default => 0 t.integer "all_journals_count", :default => 0 t.integer "all_authors_count", :default => 0 t.integer "all_subjects_count", :default => 0 t.integer "all_genes_count", :default => 0 t.integer "all_pubtypes_count", :default => 0 t.integer "one_articles_count", :default => 0 t.integer "one_journals_count", :default => 0 t.integer "one_authors_count", :default => 0 t.integer "one_subjects_count", :default => 0 t.integer "one_genes_count", :default => 0 t.integer "one_pubtypes_count", :default => 0 t.integer "five_articles_count", :default => 0 t.integer "five_journals_count", :default => 0 t.integer "five_authors_count", :default => 0 t.integer "five_subjects_count", :default => 0 t.integer "five_genes_count", :default => 0 t.integer "five_pubtypes_count", :default => 0 t.integer "ten_articles_count", :default => 0 t.integer "ten_journals_count", :default => 0 t.integer "ten_authors_count", :default => 0 t.integer "ten_subjects_count", :default => 0 t.integer "ten_genes_count", :default => 0 t.integer "ten_pubtypes_count", :default => 0 t.integer "total_articles", :default => 0 t.integer "hits", :default => 0 t.boolean "built", :default => false t.datetime "started_at" t.datetime "built_at" t.datetime "delete_at" t.datetime "created_at" t.datetime "updated_at" end add_index "bibliomes", ["built", "built_at"], :name => "index_bibliomes_on_built_and_built_at" add_index "bibliomes", ["hits"], :name => "index_bibliomes_on_hits" add_index "bibliomes", ["name"], :name => "index_bibliomes_on_name", :unique => true create_table "coauthorships", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "coauthor_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "coauthorships", ["bibliome_id", "author_id", "year", "coauthor_id"], :name => "index_coauthorships_on_bibliome_id_author_id_year_coauthor_id" add_index "coauthorships", ["bibliome_id", "author_id", "year", "total"], :name => "index_coauthorships_on_bibliome_id_author_id_year_total" create_table "cosubjectships", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.integer "cosubject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "cosubject_id"], :name => "index_cosubjectships_on_bibliome_subject_year_cosubject" add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_cosubjectships_on_bibliome_subject_year_direct" create_table "delayed_jobs", :force => true do |t| t.integer "priority", :default => 0 t.integer "attempts", :default => 0 t.text "handler" t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" t.string "locked_by" t.datetime "created_at" t.datetime "updated_at" end create_table "genes", :force => true do |t| t.integer "taxonomy_id" t.string "symbol" end add_index "genes", ["symbol"], :name => "index_genes_on_symbol" create_table "journal_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "pubtype_id" t.string "year" t.integer "total", :default => 0 end add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "pubtype_id"], :name => "index_journal_pubtypes_on_bibliome_journal_year_pubtype" add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_journal_id_year_total" add_index "journal_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "journal_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "subject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_journal_id_year_direct" add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "subject_id"], :name => "index_journal_subjects_on_bibliome_journal_year_subject" add_index "journal_subjects", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_subject_id_year_direct" create_table "journals", :force => true do |t| t.string "title" t.string "abbr" end add_index "journals", ["abbr", "title"], :name => "index_journals_on_abbr_and_title" create_table "mesh_ancestors", :force => true do |t| t.integer "subject_id" t.integer "ancestor_id" end add_index "mesh_ancestors", ["subject_id"], :name => "index_mesh_ancestors_on_subject_id" create_table "mesh_trees", :force => true do |t| t.string "tree_number" t.integer "subject_id" t.integer "parent_id" end add_index "mesh_trees", ["parent_id"], :name => "index_mesh_trees_on_parent_id" add_index "mesh_trees", ["subject_id"], :name => "index_mesh_trees_on_subject_id" add_index "mesh_trees", ["tree_number"], :name => "index_mesh_trees_on_tree_number", :unique => true create_table "published_genes", :force => true do |t| t.integer "article_id" t.integer "gene_id" end add_index "published_genes", ["article_id"], :name => "index_published_genes_on_article_id" create_table "pubtypes", :force => true do |t| t.string "term" end add_index "pubtypes", ["term"], :name => "index_pubtypes_on_term" create_table "subjects", :force => true do |t| t.string "term" end add_index "subjects", ["term"], :name => "index_subjects_on_term", :unique => true create_table "taxonomies", :force => true do |t| t.string "name" end create_table "topics", :force => true do |t| t.integer "article_id" t.integer "subject_id" end add_index "topics", ["article_id"], :name => "index_topics_on_article_id" end diff --git a/lib/medvane/setup.rb b/lib/medvane/setup.rb index 604bfa2..62b4b1b 100644 --- a/lib/medvane/setup.rb +++ b/lib/medvane/setup.rb @@ -1,126 +1,130 @@ require 'open-uri' require 'zlib' module Medvane class Setup class << self def journals journal_ids = Journal.all(:select => :id).map {|j| j.id} puts "[#{Time.now.to_s}] Journal.size = #{journal_ids.size}" puts "[#{Time.now.to_s}] downloading jourcache.xml" journals = PubmedJournal.get puts "[#{Time.now.to_s}] add to Journal" added, failed = 0, 0 journals.each do |j| unless journal_ids.include?(j[0].to_i) journal = Journal.new journal.id, journal.title, journal.abbr = j if journal.save puts "added #{j.join(" | ")}" added += 1 else puts "failed to add #{j.join(" | ")}" failed += 1 end end end puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" end def genes + puts "[#{Time.now.to_s}] removing index from Gene" + migrate_down(20100131153724) puts "[#{Time.now.to_s}] recreate Gene" remigrate(20100128151156) puts "[#{Time.now.to_s}] downloading gene_info.gz" gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz') puts "[#{Time.now.to_s}] adding to Gene" added, failed = 0, 0 gz.each_line do |line| taxonomy_id, gene_id, symbol, locusTag, synonyms, dbXrefs, chromosome, map_location, description, type_of_gene, symbol_from_nomenclature_authority, full_name_from_nomenclature_authority, nomenclature_status, other_designations, modification_date = line.split(/\t/) if gene_id g = Gene.new(:taxonomy_id => taxonomy_id, :symbol => symbol) g.id = gene_id if g.save! added += 1 else failed += 1 end end end puts "[#{Time.now.to_s}] adding index to Gene" migrate_up(20100131153724) puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" end def published_genes + puts "[#{Time.now.to_s}] removing index from PublishedGene" + migrate_down(20100131153734) puts "[#{Time.now.to_s}] recreate PublishedGene" remigrate(20100127150217) puts "[#{Time.now.to_s}] downloading gene2pubmed.gz" gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz') puts "[#{Time.now.to_s}] adding to PublishedGene" added, failed = 0, 0, 0 gz.each_line do |line| tax_id, gene_id, article_id = line.strip.split(/\t/) pg = PublishedGene.new(:article_id => article_id, :gene_id => gene_id) if pg.save! added += 1 else failed += 1 end end puts "[#{Time.now.to_s}] adding index to PublishedGene" migrate_up(20100131153734) puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" end def taxonomies puts "[#{Time.now.to_s}] recreate Taxonomy" remigrate(20100128231533) puts "[#{Time.now.to_s}] downloading taxdump.tar.gz" gz = download_gz('ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz') puts "[#{Time.now.to_s}] adding to Taxonomy" added, failed = 0, 0 gz.each_line do |line| tax_id, name_txt, uniqu_name, name_class = line.split(/\s*\|\s*/) if name_class == 'scientific name' t = Taxonomy.new(:name => name_txt) t.id = tax_id if t.save added += 1 else failed += 1 end end end puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" end private def migrate_down(version) - ActiveRecord::Migrator.run(:down, "db/migrate/", version) + ActiveRecord::Migrator.run(:down, "db/migrate/", version) if ActiveRecord::Migrator.get_all_versions.include?(version) end def migrate_up(version) ActiveRecord::Migrator.run(:up, "db/migrate/", version) end def remigrate(version) migrate_down(version) migrate_up(version) end def download_gz(url) Zlib::GzipReader.new(open(url)) end end end end diff --git a/lib/tasks/medvane.rake b/lib/tasks/medvane.rake index d469ad3..0e3e9b0 100644 --- a/lib/tasks/medvane.rake +++ b/lib/tasks/medvane.rake @@ -1,37 +1,38 @@ namespace :mdvn do desc "Updates Journal from PubMed" task :journals => :environment do Medvane::Setup.journals end desc "Setup Medvane using background job" task :setup => :environment do ['journals', 'taxonomies', 'published_genes', 'genes'].each do |task| Delayed::Job.enqueue(SetupJob.new(task)) + puts "[#{Time.now.to_s}] enqueued SetupJob.new(#{task})" end end namespace :genes do desc "Updates Gene and related models" task :all => :environment do ['published', 'gene', 'taxonomy'].each do |task| Rake::Task["mdvn:genes:#{task}"].invoke end end desc "Updates PublishedGene from PubMed" task :published => :environment do Medvane::Setup.published_genes end desc "Updates Gene from PubMed" task :gene => :environment do Medvane::Setup.genes end desc "Updates Taxonomy from PubMed" task :taxonomy => :environment do Medvane::Setup.taxonomies end end end
seouri/medvane3
b7342e638b3ef49554ac68af8d4e9dd332be914f
changed postgresql ruby gem to 'pg'
diff --git a/config/database.yml.postgresql b/config/database.yml.postgresql index f735584..198c96d 100644 --- a/config/database.yml.postgresql +++ b/config/database.yml.postgresql @@ -1,51 +1,51 @@ # PostgreSQL. Versions 7.4 and 8.x are supported. # # Install the ruby-postgres driver: -# gem install ruby-postgres +# gem install pg # On Mac OS X: -# gem install ruby-postgres -- --include=/usr/local/pgsql +# gem install pg -- --include=/usr/local/pgsql # On Windows: -# gem install ruby-postgres +# gem install pg # Choose the win32 build. # Install PostgreSQL and put its /bin directory on your path. development: adapter: postgresql encoding: unicode database: medvane3_development pool: 5 username: medvane3 password: # Connect on a TCP socket. Omitted by default since the client uses a # domain socket that doesn't need configuration. Windows does not have # domain sockets, so uncomment these lines. #host: localhost #port: 5432 # Schema search path. The server defaults to $user,public #schema_search_path: myapp,sharedapp,public # Minimum log levels, in increasing order: # debug5, debug4, debug3, debug2, debug1, # log, notice, warning, error, fatal, and panic # The server defaults to notice. #min_messages: warning # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: postgresql encoding: unicode database: medvane3_test pool: 5 username: medvane3 password: production: adapter: postgresql encoding: unicode database: medvane3_production pool: 5 username: medvane3 password:
seouri/medvane3
843655c1870de2b906663653f3b03cb5840834dc
show period tab as button
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7ef037e..bd63768 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,106 +1,105 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome and bibliome.built? header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => @link_period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end def bibliome_nav(bibliome) li = [] ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| css_class = controller.controller_name == obj ? "current" : nil item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => @link_period)), :class => css_class) li.push(item) end content_tag(:ul, li.join("\n"), :id => "bibliome_nav") end def has_chart content_for(:has_chart) {true} end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => @link_period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] - li_class = period == period_key ? "current" : nil - link_text = period_val + li_class = period == period_key ? "current button" : "" period_key = nil if period_key == "all" link = url_for(:period => period_key) - li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) + li.push(content_tag(:li, link_to_unless(@link_period == period_key, period_val, link, :class => "button"), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 4 width = x_axis_label.size * 7 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 2}, :format => 'image_tag', :alt => "publication history") end def sparkline(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.length > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } alt_text = "publication history #{years.first}-#{years.last}" size = "30x10" source = Gchart.sparkline(:data => articles, :line_colors => "999999", :size => size, :alt => alt_text) image_tag(source, :alt => alt_text, :title => alt_text, :size => size) end end end diff --git a/public/images/button-overlay.png b/public/images/button-overlay.png new file mode 100644 index 0000000..222cdc9 Binary files /dev/null and b/public/images/button-overlay.png differ diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index 5d63b73..2870849 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -1,161 +1,188 @@ /* red: #913 yellow: #ea1 */ body { margin: 0; padding: 0; } a, a:visited { color: #913; } a:hover { color: #ea1; } li { margin-bottom: 0.25em; } #hd { margin: 0 -0.8em 0 -0.8em; padding: 0.1em 0.8em 0.25em 0.8em; background-color: #ccc; } #toolbar { display: inline; margin: 0 0.25em; } #toolbar li { width: 10em; list-style: none; display: inline; padding: 0.25em; font-weight: bold; color: #913; } #toolbar a, #toolbar a:visited { color: #000; text-decoration: none; } #toolbar a:hover { color: #913; text-decoration: underline; } #bd { min-height: 20em; padding: 0; } #bd h1 { margin: 0 -0.6em 0.5em -0.6em; padding: 0.1em 0.6em; background-color: #333; color: #ccc; display: block; } #bd h1 a, #bd h1 a:visited { color: #ccc; text-decoration: none; } #bd h1 a:hover { color: #ea1; } #results_info { margin: 1em 0; padding: 0.25em; background-color: #eee; } #sample_search { margin-top: 1em; font-size: 77%; } #pubmed_search_q { width: 23em; } #pubmed_search_submit, #build_bibliome_submit { } ol#results li { margin: 0.5em 0; } #bibliome_status { padding: 1em; border: 2px solid #913; color: #913; font-weight: bold; } .age, .count { font-size: 85%; color: #666; white-space: nowrap; } .citation { margin-bottom: 1em; } .citation .title { font-size: 108%; font-weight: bold; } .citation .source, .citation .subjects { font-size: 85%; } .top_neighbors { width: 19em; min-height: 19em; float: left; } #period_tab { display: inline; margin: 0; } #period_tab li { - width: 10em; list-style: none; display: inline; - padding: 0.25em; - color: #913; - font-size: 93%; + color: #fff; + font-size: 85%; + white-space: nowrap; } #period_tab li.current { - font-weight: bold; + background-color: #000; + cursor: default; +} +#period_tab a { + color: #fff; + text-decoration: none; + display: inline-block; } - #bibliome_nav { margin: 0; padding: 0; display: inline; } #bibliome_nav li { margin: 0; padding: 0 0.25em; list-style: none; font-size: 85%; font-weight: normal; display: inline; } #bibliome_nav li.current a { font-weight: bold; color: #fff; } #bibliome_nav li.current a:hover { color: #ea1; } #see_also { margin: -1em 0 1em 0; font-size: 85%; } #see_also ul { margin: 0; display: inline; } #see_also li { margin: 0 0.25em; list-style: none; display: inline; -} \ No newline at end of file +} + +.button, .button:visited { + background: #444 url(/images/button-overlay.png) repeat-x; + display: inline-block; + padding: 5px 7px; + color: #fff; + text-decoration: none; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5); + -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); + text-shadow: 0 -1px 1px rgba(0,0,0,0.25); + border-bottom: 1px solid rgba(0,0,0,0.25); + position: relative; + cursor: pointer; +} +.button:hover { background-color: #222; } +.button:active { top: 1px; } +.button, .button:visited { + font-weight: bold; + line-height: 1; + text-shadow: 0 -1px 1px rgba(0,0,0,0.25); +}
seouri/medvane3
fec31a80a3acca42477dd3505e4421105f706f7b
refactored Medvane setup tasks so that they can be run as background job as well
diff --git a/db/migrate/20100127150217_create_published_genes.rb b/db/migrate/20100127150217_create_published_genes.rb index b9861ac..6458771 100644 --- a/db/migrate/20100127150217_create_published_genes.rb +++ b/db/migrate/20100127150217_create_published_genes.rb @@ -1,13 +1,12 @@ class CreatePublishedGenes < ActiveRecord::Migration def self.up create_table :published_genes do |t| t.integer :article_id t.integer :gene_id end - add_index :published_genes, :article_id end def self.down drop_table :published_genes end end diff --git a/db/migrate/20100128151156_create_genes.rb b/db/migrate/20100128151156_create_genes.rb index b31016c..50ada27 100644 --- a/db/migrate/20100128151156_create_genes.rb +++ b/db/migrate/20100128151156_create_genes.rb @@ -1,13 +1,12 @@ class CreateGenes < ActiveRecord::Migration def self.up create_table :genes do |t| t.integer :taxonomy_id t.string :symbol end - add_index :genes, :symbol end def self.down drop_table :genes end end diff --git a/db/migrate/20100131153724_add_index_to_gene.rb b/db/migrate/20100131153724_add_index_to_gene.rb new file mode 100644 index 0000000..b1d69f6 --- /dev/null +++ b/db/migrate/20100131153724_add_index_to_gene.rb @@ -0,0 +1,9 @@ +class AddIndexToGene < ActiveRecord::Migration + def self.up + add_index :genes, :symbol + end + + def self.down + remove_index :genes, :symbol + end +end diff --git a/db/migrate/20100131153734_add_index_to_published_gene.rb b/db/migrate/20100131153734_add_index_to_published_gene.rb new file mode 100644 index 0000000..0351d37 --- /dev/null +++ b/db/migrate/20100131153734_add_index_to_published_gene.rb @@ -0,0 +1,9 @@ +class AddIndexToPublishedGene < ActiveRecord::Migration + def self.up + add_index :published_genes, :article_id + end + + def self.down + remove_index :published_genes, :article_id + end +end diff --git a/lib/medvane/setup.rb b/lib/medvane/setup.rb new file mode 100644 index 0000000..604bfa2 --- /dev/null +++ b/lib/medvane/setup.rb @@ -0,0 +1,126 @@ +require 'open-uri' +require 'zlib' + +module Medvane + class Setup + class << self + def journals + journal_ids = Journal.all(:select => :id).map {|j| j.id} + puts "[#{Time.now.to_s}] Journal.size = #{journal_ids.size}" + puts "[#{Time.now.to_s}] downloading jourcache.xml" + journals = PubmedJournal.get + + puts "[#{Time.now.to_s}] add to Journal" + added, failed = 0, 0 + journals.each do |j| + unless journal_ids.include?(j[0].to_i) + journal = Journal.new + journal.id, journal.title, journal.abbr = j + if journal.save + puts "added #{j.join(" | ")}" + added += 1 + else + puts "failed to add #{j.join(" | ")}" + failed += 1 + end + end + end + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + end + + def genes + puts "[#{Time.now.to_s}] recreate Gene" + remigrate(20100128151156) + + puts "[#{Time.now.to_s}] downloading gene_info.gz" + gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz') + + puts "[#{Time.now.to_s}] adding to Gene" + added, failed = 0, 0 + gz.each_line do |line| + taxonomy_id, gene_id, symbol, locusTag, synonyms, dbXrefs, chromosome, map_location, description, type_of_gene, symbol_from_nomenclature_authority, full_name_from_nomenclature_authority, nomenclature_status, other_designations, modification_date = line.split(/\t/) + if gene_id + g = Gene.new(:taxonomy_id => taxonomy_id, :symbol => symbol) + g.id = gene_id + if g.save! + added += 1 + else + failed += 1 + end + end + end + puts "[#{Time.now.to_s}] adding index to Gene" + migrate_up(20100131153724) + + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + end + + def published_genes + puts "[#{Time.now.to_s}] recreate PublishedGene" + remigrate(20100127150217) + + puts "[#{Time.now.to_s}] downloading gene2pubmed.gz" + gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz') + + puts "[#{Time.now.to_s}] adding to PublishedGene" + added, failed = 0, 0, 0 + gz.each_line do |line| + tax_id, gene_id, article_id = line.strip.split(/\t/) + pg = PublishedGene.new(:article_id => article_id, :gene_id => gene_id) + if pg.save! + added += 1 + else + failed += 1 + end + end + puts "[#{Time.now.to_s}] adding index to PublishedGene" + migrate_up(20100131153734) + + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + end + + def taxonomies + puts "[#{Time.now.to_s}] recreate Taxonomy" + remigrate(20100128231533) + + puts "[#{Time.now.to_s}] downloading taxdump.tar.gz" + gz = download_gz('ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz') + + puts "[#{Time.now.to_s}] adding to Taxonomy" + added, failed = 0, 0 + gz.each_line do |line| + tax_id, name_txt, uniqu_name, name_class = line.split(/\s*\|\s*/) + if name_class == 'scientific name' + t = Taxonomy.new(:name => name_txt) + t.id = tax_id + if t.save + added += 1 + else + failed += 1 + end + end + end + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + end + + private + + def migrate_down(version) + ActiveRecord::Migrator.run(:down, "db/migrate/", version) + end + + def migrate_up(version) + ActiveRecord::Migrator.run(:up, "db/migrate/", version) + end + + def remigrate(version) + migrate_down(version) + migrate_up(version) + end + + def download_gz(url) + Zlib::GzipReader.new(open(url)) + end + end + end +end diff --git a/lib/setup_job.rb b/lib/setup_job.rb new file mode 100644 index 0000000..4e0382f --- /dev/null +++ b/lib/setup_job.rb @@ -0,0 +1,5 @@ +class SetupJob < Struct.new(:task) + def perform + Medvane::Setup.send(task) + end +end \ No newline at end of file diff --git a/lib/tasks/medvane.rake b/lib/tasks/medvane.rake index 53f5c21..d469ad3 100644 --- a/lib/tasks/medvane.rake +++ b/lib/tasks/medvane.rake @@ -1,115 +1,37 @@ namespace :mdvn do desc "Updates Journal from PubMed" task :journals => :environment do - journal_ids = Journal.all(:select => :id).map {|j| j.id} - puts "[#{Time.now.to_s}] Journal.size = #{journal_ids.size}" - journals = PubmedJournal.get - added, failed = 0, 0 - journals.each do |j| - unless journal_ids.include?(j[0].to_i) - journal = Journal.new - journal.id, journal.title, journal.abbr = j - if journal.save - puts "added #{j.join(" | ")}" - added += 1 - else - puts "failed to add #{j.join(" | ")}" - failed += 1 - end - end - end - puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" - end - - def remigrate(version) - ActiveRecord::Migrator.run(:down, "db/migrate/", version) - ActiveRecord::Migrator.run(:up, "db/migrate/", version) + Medvane::Setup.journals end - def download_gz(url) - require 'open-uri' - require 'zlib' - Zlib::GzipReader.new(open(url)) + desc "Setup Medvane using background job" + task :setup => :environment do + ['journals', 'taxonomies', 'published_genes', 'genes'].each do |task| + Delayed::Job.enqueue(SetupJob.new(task)) + end end namespace :genes do desc "Updates Gene and related models" task :all => :environment do ['published', 'gene', 'taxonomy'].each do |task| Rake::Task["mdvn:genes:#{task}"].invoke end end desc "Updates PublishedGene from PubMed" task :published => :environment do - puts "[#{Time.now.to_s}] recreate PublishedGene" - remigrate(20100127150217) - - puts "[#{Time.now.to_s}] downloading gene2pubmed.gz" - gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz') - - puts "[#{Time.now.to_s}] adding to PublishedGene" - added, failed = 0, 0, 0 - gz.each_line do |line| - tax_id, gene_id, article_id = line.strip.split(/\t/) - pg = PublishedGene.new(:article_id => article_id, :gene_id => gene_id) - if pg.save! - added += 1 - else - failed += 1 - end - end - puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + Medvane::Setup.published_genes end desc "Updates Gene from PubMed" task :gene => :environment do - puts "[#{Time.now.to_s}] recreate Gene" - remigrate(20100128151156) - - puts "[#{Time.now.to_s}] downloading gene_info.gz" - gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz') - - puts "[#{Time.now.to_s}] adding to Gene" - added, failed = 0, 0 - gz.each_line do |line| - taxonomy_id, gene_id, symbol, LocusTag, Synonyms, dbXrefs, chromosome, map_location, description, type_of_gene, Symbol_from_nomenclature_authority, Full_name_from_nomenclature_authority, Nomenclature_status, Other_designations, Modification_date = line.split(/\t/) - if gene_id - g = Gene.new(:taxonomy_id => taxonomy_id, :symbol => symbol) - g.id = gene_id - if g.save! - added += 1 - else - failed += 1 - end - end - end - puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + Medvane::Setup.genes end desc "Updates Taxonomy from PubMed" task :taxonomy => :environment do - puts "[#{Time.now.to_s}] recreate Taxonomy" - remigrate(20100128231533) - - puts "[#{Time.now.to_s}] downloading taxdump.tar.gz" - gz = download_gz('ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz') - - puts "[#{Time.now.to_s}] adding to Gene" - added, failed = 0, 0 - gz.each_line do |line| - tax_id, name_txt, uniqu_name, name_class = line.split(/\s*\|\s*/) - if name_class == 'scientific name' - t = Taxonomy.new(:name => name_txt) - t.id = tax_id - if t.save - added += 1 - else - failed += 1 - end - end - end - puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + Medvane::Setup.taxonomies end end end
seouri/medvane3
9aa853b0aa247e01e2db4bb116b5013a279c0ef5
fix lib name for libxml
diff --git a/config/environment.rb b/config/environment.rb index 1c04cf2..96b84c8 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,46 +1,46 @@ # Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') Rails::Initializer.run do |config| # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) # Specify gems that this application depends on and have them installed with rake gems:install # config.gem "bj" # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" # config.gem "sqlite3-ruby", :lib => "sqlite3" # config.gem "aws-s3", :lib => "aws/s3" config.gem "googlecharts", :version => "1.4.0", :source => "http://gemcutter.org", :lib => "gchart" config.gem "will_paginate", :version => "2.3.12", :source => "http://gemcutter.org" config.gem "bio", :version => "1.3.1", :source => "http://gemcutter.org" config.gem "delayed_job", :version => "1.8.4", :source => "http://gemcutter.org" - config.gem "libxml-ruby", :version => "1.1.3", :source => "http://gemcutter.org" + config.gem "libxml-ruby", :version => "1.1.3", :source => "http://gemcutter.org", :lib => 'libxml' # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Skip frameworks you're not going to use. To use Rails without a database, # you must remove the Active Record framework. # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector, :forum_observer # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. config.time_zone = 'UTC' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] # config.i18n.default_locale = :de end
seouri/medvane3
60aad9e7a047b1271cc797b10c129f41f7232069
added libxml-ruby gem v1.1.3
diff --git a/config/environment.rb b/config/environment.rb index 8ffcf08..1c04cf2 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,45 +1,46 @@ # Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') Rails::Initializer.run do |config| # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) # Specify gems that this application depends on and have them installed with rake gems:install # config.gem "bj" # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" # config.gem "sqlite3-ruby", :lib => "sqlite3" # config.gem "aws-s3", :lib => "aws/s3" config.gem "googlecharts", :version => "1.4.0", :source => "http://gemcutter.org", :lib => "gchart" config.gem "will_paginate", :version => "2.3.12", :source => "http://gemcutter.org" config.gem "bio", :version => "1.3.1", :source => "http://gemcutter.org" config.gem "delayed_job", :version => "1.8.4", :source => "http://gemcutter.org" + config.gem "libxml-ruby", :version => "1.1.3", :source => "http://gemcutter.org" # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Skip frameworks you're not going to use. To use Rails without a database, # you must remove the Active Record framework. # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector, :forum_observer # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. config.time_zone = 'UTC' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] # config.i18n.default_locale = :de end
seouri/medvane3
df69f894f5d53ffc08927144b3bc226c3bfacb24
added libxml-ruby gems for Heroku
diff --git a/.gems b/.gems index dd94229..033c57a 100644 --- a/.gems +++ b/.gems @@ -1,4 +1,5 @@ googlecharts --version 1.4.0 --source gemcutter.org will_paginate --version 2.3.12 --source gemcutter.org bio --version 1.3.1 --source gemcutter.org delayed_job --version 1.8.4 --source gemcutter.org +libxml-ruby --version 1.1.3 --source gemcutter.org
seouri/medvane3
b76de6d3661e5571a231b36d4746c926b74f6b33
added postgresql db config example
diff --git a/config/database.yml.sample b/config/database.yml.mysql similarity index 100% rename from config/database.yml.sample rename to config/database.yml.mysql diff --git a/config/database.yml.postgresql b/config/database.yml.postgresql new file mode 100644 index 0000000..f735584 --- /dev/null +++ b/config/database.yml.postgresql @@ -0,0 +1,51 @@ +# PostgreSQL. Versions 7.4 and 8.x are supported. +# +# Install the ruby-postgres driver: +# gem install ruby-postgres +# On Mac OS X: +# gem install ruby-postgres -- --include=/usr/local/pgsql +# On Windows: +# gem install ruby-postgres +# Choose the win32 build. +# Install PostgreSQL and put its /bin directory on your path. +development: + adapter: postgresql + encoding: unicode + database: medvane3_development + pool: 5 + username: medvane3 + password: + + # Connect on a TCP socket. Omitted by default since the client uses a + # domain socket that doesn't need configuration. Windows does not have + # domain sockets, so uncomment these lines. + #host: localhost + #port: 5432 + + # Schema search path. The server defaults to $user,public + #schema_search_path: myapp,sharedapp,public + + # Minimum log levels, in increasing order: + # debug5, debug4, debug3, debug2, debug1, + # log, notice, warning, error, fatal, and panic + # The server defaults to notice. + #min_messages: warning + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: postgresql + encoding: unicode + database: medvane3_test + pool: 5 + username: medvane3 + password: + +production: + adapter: postgresql + encoding: unicode + database: medvane3_production + pool: 5 + username: medvane3 + password:
seouri/medvane3
bc907b507d88fb0fb281733fa035202d3bb825f2
added Gene, PublishedGene, Taxonomy
diff --git a/app/controllers/genes_controller.rb b/app/controllers/genes_controller.rb new file mode 100644 index 0000000..12118ec --- /dev/null +++ b/app/controllers/genes_controller.rb @@ -0,0 +1,85 @@ +class GenesController < ApplicationController + # GET /genes + # GET /genes.xml + def index + @genes = Gene.all + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @genes } + end + end + + # GET /genes/1 + # GET /genes/1.xml + def show + @gene = Gene.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @gene } + end + end + + # GET /genes/new + # GET /genes/new.xml + def new + @gene = Gene.new + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @gene } + end + end + + # GET /genes/1/edit + def edit + @gene = Gene.find(params[:id]) + end + + # POST /genes + # POST /genes.xml + def create + @gene = Gene.new(params[:gene]) + + respond_to do |format| + if @gene.save + flash[:notice] = 'Gene was successfully created.' + format.html { redirect_to(@gene) } + format.xml { render :xml => @gene, :status => :created, :location => @gene } + else + format.html { render :action => "new" } + format.xml { render :xml => @gene.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /genes/1 + # PUT /genes/1.xml + def update + @gene = Gene.find(params[:id]) + + respond_to do |format| + if @gene.update_attributes(params[:gene]) + flash[:notice] = 'Gene was successfully updated.' + format.html { redirect_to(@gene) } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @gene.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /genes/1 + # DELETE /genes/1.xml + def destroy + @gene = Gene.find(params[:id]) + @gene.destroy + + respond_to do |format| + format.html { redirect_to(genes_url) } + format.xml { head :ok } + end + end +end diff --git a/app/helpers/genes_helper.rb b/app/helpers/genes_helper.rb new file mode 100644 index 0000000..9e38fe8 --- /dev/null +++ b/app/helpers/genes_helper.rb @@ -0,0 +1,2 @@ +module GenesHelper +end diff --git a/app/models/article.rb b/app/models/article.rb index 1c8ddea..85375cb 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -1,13 +1,15 @@ class Article < ActiveRecord::Base has_many :bibliome_articles has_many :bibliomes, :through => :bibliome_articles belongs_to :journal has_many :authorships has_many :authors, :through => :authorships has_many :topics has_many :subjects, :through => :topics has_many :article_types has_many :pubtypes, :through => :article_types + has_many :published_genes + has_many :genes, :through => :published_genes, :include => :taxonomy validates_associated :journal end diff --git a/app/models/gene.rb b/app/models/gene.rb new file mode 100644 index 0000000..b383d1e --- /dev/null +++ b/app/models/gene.rb @@ -0,0 +1,4 @@ +class Gene < ActiveRecord::Base + belongs_to :taxonomy + has_many :published_genes +end diff --git a/app/models/published_gene.rb b/app/models/published_gene.rb new file mode 100644 index 0000000..b1b7ec9 --- /dev/null +++ b/app/models/published_gene.rb @@ -0,0 +1,4 @@ +class PublishedGene < ActiveRecord::Base + belongs_to :article + belongs_to :gene +end diff --git a/app/models/taxonomy.rb b/app/models/taxonomy.rb new file mode 100644 index 0000000..e4cb7e8 --- /dev/null +++ b/app/models/taxonomy.rb @@ -0,0 +1,3 @@ +class Taxonomy < ActiveRecord::Base + has_many :genes +end diff --git a/app/views/genes/edit.html.erb b/app/views/genes/edit.html.erb new file mode 100644 index 0000000..2fbf20c --- /dev/null +++ b/app/views/genes/edit.html.erb @@ -0,0 +1,20 @@ +<h1>Editing gene</h1> + +<% form_for(@gene) do |f| %> + <%= f.error_messages %> + + <p> + <%= f.label :taxonomy_id %><br /> + <%= f.text_field :taxonomy_id %> + </p> + <p> + <%= f.label :symbol %><br /> + <%= f.text_field :symbol %> + </p> + <p> + <%= f.submit 'Update' %> + </p> +<% end %> + +<%= link_to 'Show', @gene %> | +<%= link_to 'Back', genes_path %> \ No newline at end of file diff --git a/app/views/genes/index.html.erb b/app/views/genes/index.html.erb new file mode 100644 index 0000000..c76dca9 --- /dev/null +++ b/app/views/genes/index.html.erb @@ -0,0 +1,22 @@ +<h1>Listing genes</h1> + +<table> + <tr> + <th>Taxonomy</th> + <th>Symbol</th> + </tr> + +<% @genes.each do |gene| %> + <tr> + <td><%=h gene.taxonomy_id %></td> + <td><%=h gene.symbol %></td> + <td><%= link_to 'Show', gene %></td> + <td><%= link_to 'Edit', edit_gene_path(gene) %></td> + <td><%= link_to 'Destroy', gene, :confirm => 'Are you sure?', :method => :delete %></td> + </tr> +<% end %> +</table> + +<br /> + +<%= link_to 'New gene', new_gene_path %> \ No newline at end of file diff --git a/app/views/genes/new.html.erb b/app/views/genes/new.html.erb new file mode 100644 index 0000000..7215961 --- /dev/null +++ b/app/views/genes/new.html.erb @@ -0,0 +1,19 @@ +<h1>New gene</h1> + +<% form_for(@gene) do |f| %> + <%= f.error_messages %> + + <p> + <%= f.label :taxonomy_id %><br /> + <%= f.text_field :taxonomy_id %> + </p> + <p> + <%= f.label :symbol %><br /> + <%= f.text_field :symbol %> + </p> + <p> + <%= f.submit 'Create' %> + </p> +<% end %> + +<%= link_to 'Back', genes_path %> \ No newline at end of file diff --git a/app/views/genes/show.html.erb b/app/views/genes/show.html.erb new file mode 100644 index 0000000..edb83bc --- /dev/null +++ b/app/views/genes/show.html.erb @@ -0,0 +1,13 @@ +<p> + <b>Taxonomy:</b> + <%=h @gene.taxonomy_id %> +</p> + +<p> + <b>Symbol:</b> + <%=h @gene.symbol %> +</p> + + +<%= link_to 'Edit', edit_gene_path(@gene) %> | +<%= link_to 'Back', genes_path %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index cee905c..ab2d393 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,58 +1,59 @@ ActionController::Routing::Routes.draw do |map| map.root :controller => "pages", :action => "home" map.about '/about', :controller => "pages", :action => "about" map.help '/help', :controller => "pages", :action => "help" map.resources :bibliomes, :collection => { :recent => :get, :popular => :get, :import => :post } do |bibliomes| + bibliomes.resources :genes bibliomes.resources :pubtypes bibliomes.resources :subjects bibliomes.resources :authors bibliomes.resources :journals - bibliomes.resources :articles + bibliomes.resources :articles end map.pubmed '/build/pubmed/:q', :controller => "build", :action => "pubmed", :defaults => {:q => nil} map.import '/build/import/:name', :controller => "build", :action => "import", :defaults => {:name => nil} # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # map.resources :products # Sample resource route with options: # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } # Sample resource route with sub-resources: # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller # Sample resource route with more complex sub-resources # map.resources :products do |products| # products.resources :comments # products.resources :sales, :collection => { :recent => :get } # end # Sample resource route within a namespace: # map.namespace :admin do |admin| # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) # admin.resources :products # end # You can have the root of your site routed with map.root -- just remember to delete public/index.html. # map.root :controller => "welcome" # See how all your routes lay out with "rake routes" # Install the default routes as the lowest priority. # Note: These default routes make all actions in every controller accessible via GET requests. You should # consider removing or commenting them out if you're using named routes and resources. map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end diff --git a/db/migrate/20100127150217_create_published_genes.rb b/db/migrate/20100127150217_create_published_genes.rb new file mode 100644 index 0000000..b9861ac --- /dev/null +++ b/db/migrate/20100127150217_create_published_genes.rb @@ -0,0 +1,13 @@ +class CreatePublishedGenes < ActiveRecord::Migration + def self.up + create_table :published_genes do |t| + t.integer :article_id + t.integer :gene_id + end + add_index :published_genes, :article_id + end + + def self.down + drop_table :published_genes + end +end diff --git a/db/migrate/20100128151156_create_genes.rb b/db/migrate/20100128151156_create_genes.rb new file mode 100644 index 0000000..b31016c --- /dev/null +++ b/db/migrate/20100128151156_create_genes.rb @@ -0,0 +1,13 @@ +class CreateGenes < ActiveRecord::Migration + def self.up + create_table :genes do |t| + t.integer :taxonomy_id + t.string :symbol + end + add_index :genes, :symbol + end + + def self.down + drop_table :genes + end +end diff --git a/db/migrate/20100128231533_create_taxonomies.rb b/db/migrate/20100128231533_create_taxonomies.rb new file mode 100644 index 0000000..0a6ced6 --- /dev/null +++ b/db/migrate/20100128231533_create_taxonomies.rb @@ -0,0 +1,11 @@ +class CreateTaxonomies < ActiveRecord::Migration + def self.up + create_table :taxonomies do |t| + t.string :name + end + end + + def self.down + drop_table :taxonomies + end +end diff --git a/db/schema.rb b/db/schema.rb index e8c649e..eee3d47 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,314 +1,332 @@ # This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your database schema. If you need # to create the application database on another system, you should be using db:schema:load, not running # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20091226023507) do +ActiveRecord::Schema.define(:version => 20100128231533) do create_table "article_types", :force => true do |t| t.integer "article_id" t.integer "pubtype_id" end add_index "article_types", ["article_id"], :name => "index_article_types_on_article_id" create_table "articles", :force => true do |t| t.integer "journal_id" t.date "pubdate" t.text "title" t.text "affiliation" t.string "source" t.integer "bibliomes_count", :default => 0 end add_index "articles", ["journal_id", "pubdate"], :name => "index_articles_on_journal_id_and_pubdate" add_index "articles", ["pubdate"], :name => "index_articles_on_pubdate" create_table "author_journals", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "journal_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_journals", ["bibliome_id", "author_id", "year", "journal_id"], :name => "index_author_journals_on_bibliome_id_author_id_year_journal_id" add_index "author_journals", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_author_id_year_total" add_index "author_journals", ["bibliome_id", "journal_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_journal_id_year_total" create_table "author_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "pubtype_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "pubtype_id"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_pubtype_id" add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_total" add_index "author_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "author_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "subject_id" t.string "year" t.integer "first_direct", :default => 0 t.integer "first_descendant", :default => 0 t.integer "first_total", :default => 0 t.integer "last_direct", :default => 0 t.integer "last_descendant", :default => 0 t.integer "last_total", :default => 0 t.integer "middle_direct", :default => 0 t.integer "middle_descendant", :default => 0 t.integer "middle_total", :default => 0 t.integer "total_direct", :default => 0 t.integer "total_descendant", :default => 0 t.integer "total_total", :default => 0 end add_index "author_subjects", ["bibliome_id", "author_id", "year", "subject_id"], :name => "index_author_subjects_on_bibliome_id_author_id_year_subject_id" add_index "author_subjects", ["bibliome_id", "author_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_author_year_total_direct" add_index "author_subjects", ["bibliome_id", "subject_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_subject_year_total_direct" create_table "authors", :force => true do |t| t.string "last_name" t.string "fore_name" t.string "initials" t.string "suffix" end add_index "authors", ["last_name", "fore_name", "initials", "suffix"], :name => "index_authors_on_last_name_fore_name_initials_suffix", :unique => true add_index "authors", ["last_name", "initials"], :name => "index_authors_on_last_name_and_initials" create_table "authorships", :force => true do |t| t.integer "article_id" t.integer "author_id" t.integer "position" t.integer "last_position" end add_index "authorships", ["article_id", "position"], :name => "index_authorships_on_article_id_and_position" add_index "authorships", ["author_id"], :name => "index_authorships_on_author_id" create_table "bibliome_articles", :force => true do |t| t.integer "bibliome_id" t.integer "article_id" t.date "pubdate" end add_index "bibliome_articles", ["bibliome_id", "pubdate", "article_id"], :name => "index_bibliome_articles_on_bibliome_id_pubdate_article_id" create_table "bibliome_authors", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_authors", ["bibliome_id", "author_id", "year"], :name => "index_bibliome_authors_on_bibliome_id_and_author_id_and_year" add_index "bibliome_authors", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_authors_on_bibliome_id_year_articles_count" create_table "bibliome_genes", :force => true do |t| t.integer "bibliome_id" t.integer "gene_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_genes", ["bibliome_id", "gene_id", "year"], :name => "index_bibliome_genes_on_bibliome_id_and_gene_id_and_year" add_index "bibliome_genes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_articles_count" create_table "bibliome_journals", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_journals", ["bibliome_id", "journal_id", "year"], :name => "index_bibliome_journals_on_bibliome_id_and_journal_id_and_year" add_index "bibliome_journals", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_journals_on_bibliome_id_year_articles_count" create_table "bibliome_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "pubtype_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_pubtypes", ["bibliome_id", "pubtype_id", "year"], :name => "index_bibliome_pubtypes_on_bibliome_id_and_pubtype_id_and_year" add_index "bibliome_pubtypes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_pubtypes_on_bibliome_id_year_articles_count" create_table "bibliome_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_subjects", ["bibliome_id", "subject_id", "year"], :name => "index_bibliome_subjects_on_bibliome_id_and_subject_id_and_year" add_index "bibliome_subjects", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_subjects_on_bibliome_id_year_articles_count" create_table "bibliomes", :force => true do |t| t.string "name" t.text "query" t.integer "all_articles_count", :default => 0 t.integer "all_journals_count", :default => 0 t.integer "all_authors_count", :default => 0 t.integer "all_subjects_count", :default => 0 t.integer "all_genes_count", :default => 0 t.integer "all_pubtypes_count", :default => 0 t.integer "one_articles_count", :default => 0 t.integer "one_journals_count", :default => 0 t.integer "one_authors_count", :default => 0 t.integer "one_subjects_count", :default => 0 t.integer "one_genes_count", :default => 0 t.integer "one_pubtypes_count", :default => 0 t.integer "five_articles_count", :default => 0 t.integer "five_journals_count", :default => 0 t.integer "five_authors_count", :default => 0 t.integer "five_subjects_count", :default => 0 t.integer "five_genes_count", :default => 0 t.integer "five_pubtypes_count", :default => 0 t.integer "ten_articles_count", :default => 0 t.integer "ten_journals_count", :default => 0 t.integer "ten_authors_count", :default => 0 t.integer "ten_subjects_count", :default => 0 t.integer "ten_genes_count", :default => 0 t.integer "ten_pubtypes_count", :default => 0 t.integer "total_articles", :default => 0 t.integer "hits", :default => 0 t.boolean "built", :default => false t.datetime "started_at" t.datetime "built_at" t.datetime "delete_at" t.datetime "created_at" t.datetime "updated_at" end add_index "bibliomes", ["built", "built_at"], :name => "index_bibliomes_on_built_and_built_at" add_index "bibliomes", ["hits"], :name => "index_bibliomes_on_hits" add_index "bibliomes", ["name"], :name => "index_bibliomes_on_name", :unique => true create_table "coauthorships", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "coauthor_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "coauthorships", ["bibliome_id", "author_id", "year", "coauthor_id"], :name => "index_coauthorships_on_bibliome_id_author_id_year_coauthor_id" add_index "coauthorships", ["bibliome_id", "author_id", "year", "total"], :name => "index_coauthorships_on_bibliome_id_author_id_year_total" create_table "cosubjectships", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.integer "cosubject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "cosubject_id"], :name => "index_cosubjectships_on_bibliome_subject_year_cosubject" add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_cosubjectships_on_bibliome_subject_year_direct" create_table "delayed_jobs", :force => true do |t| t.integer "priority", :default => 0 t.integer "attempts", :default => 0 t.text "handler" t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" t.string "locked_by" t.datetime "created_at" t.datetime "updated_at" end + create_table "genes", :force => true do |t| + t.integer "taxonomy_id" + t.string "symbol" + end + + add_index "genes", ["symbol"], :name => "index_genes_on_symbol" + create_table "journal_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "pubtype_id" t.string "year" t.integer "total", :default => 0 end add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "pubtype_id"], :name => "index_journal_pubtypes_on_bibliome_journal_year_pubtype" add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_journal_id_year_total" add_index "journal_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "journal_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "subject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_journal_id_year_direct" add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "subject_id"], :name => "index_journal_subjects_on_bibliome_journal_year_subject" add_index "journal_subjects", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_subject_id_year_direct" create_table "journals", :force => true do |t| t.string "title" t.string "abbr" end add_index "journals", ["abbr", "title"], :name => "index_journals_on_abbr_and_title" create_table "mesh_ancestors", :force => true do |t| t.integer "subject_id" t.integer "ancestor_id" end add_index "mesh_ancestors", ["subject_id"], :name => "index_mesh_ancestors_on_subject_id" create_table "mesh_trees", :force => true do |t| t.string "tree_number" t.integer "subject_id" t.integer "parent_id" end add_index "mesh_trees", ["parent_id"], :name => "index_mesh_trees_on_parent_id" add_index "mesh_trees", ["subject_id"], :name => "index_mesh_trees_on_subject_id" add_index "mesh_trees", ["tree_number"], :name => "index_mesh_trees_on_tree_number", :unique => true + create_table "published_genes", :force => true do |t| + t.integer "article_id" + t.integer "gene_id" + end + + add_index "published_genes", ["article_id"], :name => "index_published_genes_on_article_id" + create_table "pubtypes", :force => true do |t| t.string "term" end add_index "pubtypes", ["term"], :name => "index_pubtypes_on_term" create_table "subjects", :force => true do |t| t.string "term" end add_index "subjects", ["term"], :name => "index_subjects_on_term", :unique => true + create_table "taxonomies", :force => true do |t| + t.string "name" + end + create_table "topics", :force => true do |t| t.integer "article_id" t.integer "subject_id" end add_index "topics", ["article_id"], :name => "index_topics_on_article_id" end diff --git a/lib/tasks/medvane.rake b/lib/tasks/medvane.rake index b247cef..53f5c21 100644 --- a/lib/tasks/medvane.rake +++ b/lib/tasks/medvane.rake @@ -1,29 +1,115 @@ namespace :mdvn do desc "Updates Journal from PubMed" task :journals => :environment do journal_ids = Journal.all(:select => :id).map {|j| j.id} - puts "Journal.size = #{journal_ids.size}" + puts "[#{Time.now.to_s}] Journal.size = #{journal_ids.size}" journals = PubmedJournal.get added, failed = 0, 0 journals.each do |j| unless journal_ids.include?(j[0].to_i) journal = Journal.new journal.id, journal.title, journal.abbr = j if journal.save puts "added #{j.join(" | ")}" added += 1 else puts "failed to add #{j.join(" | ")}" failed += 1 end end end - puts "added: #{added}, failed: #{failed}" + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" end - desc "Updates Gene from PubMed" - task :genes => :environment do - # ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz - # ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz + def remigrate(version) + ActiveRecord::Migrator.run(:down, "db/migrate/", version) + ActiveRecord::Migrator.run(:up, "db/migrate/", version) + end + + def download_gz(url) + require 'open-uri' + require 'zlib' + Zlib::GzipReader.new(open(url)) + end + + namespace :genes do + desc "Updates Gene and related models" + task :all => :environment do + ['published', 'gene', 'taxonomy'].each do |task| + Rake::Task["mdvn:genes:#{task}"].invoke + end + end + + desc "Updates PublishedGene from PubMed" + task :published => :environment do + puts "[#{Time.now.to_s}] recreate PublishedGene" + remigrate(20100127150217) + + puts "[#{Time.now.to_s}] downloading gene2pubmed.gz" + gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz') + + puts "[#{Time.now.to_s}] adding to PublishedGene" + added, failed = 0, 0, 0 + gz.each_line do |line| + tax_id, gene_id, article_id = line.strip.split(/\t/) + pg = PublishedGene.new(:article_id => article_id, :gene_id => gene_id) + if pg.save! + added += 1 + else + failed += 1 + end + end + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + end + + desc "Updates Gene from PubMed" + task :gene => :environment do + puts "[#{Time.now.to_s}] recreate Gene" + remigrate(20100128151156) + + puts "[#{Time.now.to_s}] downloading gene_info.gz" + gz = download_gz('ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz') + + puts "[#{Time.now.to_s}] adding to Gene" + added, failed = 0, 0 + gz.each_line do |line| + taxonomy_id, gene_id, symbol, LocusTag, Synonyms, dbXrefs, chromosome, map_location, description, type_of_gene, Symbol_from_nomenclature_authority, Full_name_from_nomenclature_authority, Nomenclature_status, Other_designations, Modification_date = line.split(/\t/) + if gene_id + g = Gene.new(:taxonomy_id => taxonomy_id, :symbol => symbol) + g.id = gene_id + if g.save! + added += 1 + else + failed += 1 + end + end + end + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + end + + desc "Updates Taxonomy from PubMed" + task :taxonomy => :environment do + puts "[#{Time.now.to_s}] recreate Taxonomy" + remigrate(20100128231533) + + puts "[#{Time.now.to_s}] downloading taxdump.tar.gz" + gz = download_gz('ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz') + + puts "[#{Time.now.to_s}] adding to Gene" + added, failed = 0, 0 + gz.each_line do |line| + tax_id, name_txt, uniqu_name, name_class = line.split(/\s*\|\s*/) + if name_class == 'scientific name' + t = Taxonomy.new(:name => name_txt) + t.id = tax_id + if t.save + added += 1 + else + failed += 1 + end + end + end + puts "[#{Time.now.to_s}] added: #{added}, failed: #{failed}" + end end end diff --git a/test/fixtures/genes.yml b/test/fixtures/genes.yml new file mode 100644 index 0000000..fc41bfb --- /dev/null +++ b/test/fixtures/genes.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + taxonomy_id: 1 + symbol: MyString + +two: + taxonomy_id: 1 + symbol: MyString diff --git a/test/fixtures/published_genes.yml b/test/fixtures/published_genes.yml new file mode 100644 index 0000000..960719a --- /dev/null +++ b/test/fixtures/published_genes.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + article_id: 1 + gene_id: 1 + +two: + article_id: 1 + gene_id: 1 diff --git a/test/fixtures/taxonomies.yml b/test/fixtures/taxonomies.yml new file mode 100644 index 0000000..157d747 --- /dev/null +++ b/test/fixtures/taxonomies.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/functional/genes_controller_test.rb b/test/functional/genes_controller_test.rb new file mode 100644 index 0000000..41a00ec --- /dev/null +++ b/test/functional/genes_controller_test.rb @@ -0,0 +1,45 @@ +require 'test_helper' + +class GenesControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:genes) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create gene" do + assert_difference('Gene.count') do + post :create, :gene => { } + end + + assert_redirected_to gene_path(assigns(:gene)) + end + + test "should show gene" do + get :show, :id => genes(:one).to_param + assert_response :success + end + + test "should get edit" do + get :edit, :id => genes(:one).to_param + assert_response :success + end + + test "should update gene" do + put :update, :id => genes(:one).to_param, :gene => { } + assert_redirected_to gene_path(assigns(:gene)) + end + + test "should destroy gene" do + assert_difference('Gene.count', -1) do + delete :destroy, :id => genes(:one).to_param + end + + assert_redirected_to genes_path + end +end diff --git a/test/unit/gene_test.rb b/test/unit/gene_test.rb new file mode 100644 index 0000000..70b8a78 --- /dev/null +++ b/test/unit/gene_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class GeneTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end diff --git a/test/unit/helpers/genes_helper_test.rb b/test/unit/helpers/genes_helper_test.rb new file mode 100644 index 0000000..f21f6dc --- /dev/null +++ b/test/unit/helpers/genes_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class GenesHelperTest < ActionView::TestCase +end diff --git a/test/unit/published_gene_test.rb b/test/unit/published_gene_test.rb new file mode 100644 index 0000000..a99c028 --- /dev/null +++ b/test/unit/published_gene_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class PublishedGeneTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end diff --git a/test/unit/taxonomy_test.rb b/test/unit/taxonomy_test.rb new file mode 100644 index 0000000..7bedb6b --- /dev/null +++ b/test/unit/taxonomy_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class TaxonomyTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end
seouri/medvane3
dfdc88c7f5799adc606716531150b3275af9d470
show executed time for rake db:seed
diff --git a/db/seeds.rb b/db/seeds.rb index 752384a..bc77800 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,32 +1,35 @@ descriptor_file = File.join(File.dirname(__FILE__), 'desc.2010.txt') if File.stat(descriptor_file).size > 0 + puts "[#{Time.now.to_s}] load Subject" File.foreach(descriptor_file) do |record| s = Subject.new s.id, s.term, trees = record.chomp.split("\t") s.save! end end mesh_trees_file = File.join(File.dirname(__FILE__), 'mesh_trees.2010.txt') if File.stat(mesh_trees_file).size > 0 + puts "[#{Time.now.to_s}] load MeshTree" File.foreach(mesh_trees_file) do |record| t = MeshTree.new t.id, t.tree_number, t.subject_id, t.parent_id = record.chomp.split("\t") t.save! if t.tree_number.match(/^V/) s = Subject.find(t.subject_id) p = Pubtype.find_or_initialize_by_term(s.term) p.id = s.id p.save! if p.new_record? end end end mesh_ancestors_file = File.join(File.dirname(__FILE__), 'mesh_ancestors.2010.txt') if File.stat(mesh_ancestors_file).size > 0 + puts "[#{Time.now.to_s}] load MeshAncestor" File.foreach(mesh_ancestors_file) do |record| t = MeshAncestor.new t.subject_id, t.ancestor_id = record.chomp.split("\t") t.save! end end
seouri/medvane3
40d226b9acbf06c4d32fbf8d3ab6cb6b7ee60cd5
added mdvn:journals task to Heroku cron job
diff --git a/lib/tasks/cron.rake b/lib/tasks/cron.rake index 1c2d9a7..3e6234c 100644 --- a/lib/tasks/cron.rake +++ b/lib/tasks/cron.rake @@ -1,2 +1,5 @@ task :cron => :environment do + if Time.now.hour == 4 + Rake::Task['mdvn:journals'].execute + end end \ No newline at end of file
seouri/medvane3
c0477b50e809b75662a8230cd2f663afec7f8efe
show journal update information
diff --git a/lib/tasks/medvane.rake b/lib/tasks/medvane.rake index fe053b9..b247cef 100644 --- a/lib/tasks/medvane.rake +++ b/lib/tasks/medvane.rake @@ -1,20 +1,29 @@ namespace :mdvn do desc "Updates Journal from PubMed" task :journals => :environment do journal_ids = Journal.all(:select => :id).map {|j| j.id} + puts "Journal.size = #{journal_ids.size}" journals = PubmedJournal.get + added, failed = 0, 0 journals.each do |j| unless journal_ids.include?(j[0].to_i) journal = Journal.new journal.id, journal.title, journal.abbr = j - journal.save + if journal.save + puts "added #{j.join(" | ")}" + added += 1 + else + puts "failed to add #{j.join(" | ")}" + failed += 1 + end end end + puts "added: #{added}, failed: #{failed}" end desc "Updates Gene from PubMed" task :genes => :environment do # ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz # ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz end end
seouri/medvane3
153b215f4421299014f19260fb583af0e2fe51c9
don't need to include again
diff --git a/lib/tasks/medvane.rake b/lib/tasks/medvane.rake index 7653e81..fe053b9 100644 --- a/lib/tasks/medvane.rake +++ b/lib/tasks/medvane.rake @@ -1,21 +1,20 @@ namespace :mdvn do desc "Updates Journal from PubMed" task :journals => :environment do - require 'pubmed_journal' journal_ids = Journal.all(:select => :id).map {|j| j.id} journals = PubmedJournal.get journals.each do |j| unless journal_ids.include?(j[0].to_i) journal = Journal.new journal.id, journal.title, journal.abbr = j journal.save end end end desc "Updates Gene from PubMed" task :genes => :environment do # ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz # ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz end end
seouri/medvane3
edd761f03993a41b78a18b00573114202a6e9554
remove debugging code
diff --git a/lib/tasks/medvane.rake b/lib/tasks/medvane.rake index 1aad190..7653e81 100644 --- a/lib/tasks/medvane.rake +++ b/lib/tasks/medvane.rake @@ -1,22 +1,21 @@ namespace :mdvn do desc "Updates Journal from PubMed" task :journals => :environment do require 'pubmed_journal' - require 'pp' journal_ids = Journal.all(:select => :id).map {|j| j.id} journals = PubmedJournal.get journals.each do |j| unless journal_ids.include?(j[0].to_i) journal = Journal.new journal.id, journal.title, journal.abbr = j journal.save end end end desc "Updates Gene from PubMed" task :genes => :environment do # ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz # ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz end end
seouri/medvane3
51848926d66a15f638fc2df624e7656dc6c2518c
prepare for rake mdvn:genes
diff --git a/lib/tasks/medvane.rake b/lib/tasks/medvane.rake index 09e37e5..1aad190 100644 --- a/lib/tasks/medvane.rake +++ b/lib/tasks/medvane.rake @@ -1,16 +1,22 @@ namespace :mdvn do desc "Updates Journal from PubMed" task :journals => :environment do require 'pubmed_journal' require 'pp' journal_ids = Journal.all(:select => :id).map {|j| j.id} journals = PubmedJournal.get journals.each do |j| unless journal_ids.include?(j[0].to_i) journal = Journal.new journal.id, journal.title, journal.abbr = j journal.save end end end + + desc "Updates Gene from PubMed" + task :genes => :environment do + # ftp://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz + # ftp://ftp.ncbi.nih.gov/gene/DATA/gene2pubmed.gz + end end
seouri/medvane3
ea3062b7a7004710fa58eb1f592b5b40e64a5c74
use journal title with ellipsis if the length is longer than 236 characters
diff --git a/lib/medline.rb b/lib/medline.rb index 3379ced..1d07e67 100644 --- a/lib/medline.rb +++ b/lib/medline.rb @@ -1,99 +1,107 @@ module Bio class MEDLINE < NCBIDB MONTH = { "Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12, "Spr" => 3, "Sum" => 6, "Aut" => 9, "Win" => 12, } def initialize(entry) # PMID: 19900898. One MH could span in more than one lines. # In such cases, the second line is recognized as another MH rather than # part of the first line. # To fix this bug, each line should be checked whether it starts with a # tag (new item) or not (wrapped line of the preceding tag). # If it is a wrapped line of the preceding tag, the last character ("\n") # is replaced with a space before the current line is appended. @pubmed = Hash.new('') tag = '' entry.each_line do |line| with_tag = false # bug fix if line =~ /^\w/ tag = line[0,4].strip with_tag = true # bug fix end if line.length > 6 @pubmed[tag][-1] = " " if @pubmed[tag][-1] and with_tag == false # bug fix @pubmed[tag] += line[6..-1] end end end attr_reader :pubmed def jt @pubmed['JT'].gsub(/\s+/, ' ').strip end #TODO: PMID:12895469, Edyta-Krzymanska-Olejnik only last name. AU/FAU don't match def authors authors = [] @pubmed['AU'].strip.split(/\n/).each do |author| name = author.split(/\s+/) suffix = nil if name.length > 2 && name[-2] =~ /^[A-Z]+$/ suffix = name.pop end initials = name.pop author = { "last_name" => name[0], "fore_name" => initials, "initials" => initials, "suffix" => suffix, } authors.push(author) end fau = @pubmed['FAU'].strip.split(/\n/) fau.each_index do |index| last = authors[index]["last_name"] suffix = authors[index]["suffix"] fore = fau[index].gsub(/^#{last},\s+/, "").gsub(/\s+#{suffix}$/, "") authors[index]["fore_name"] = fore end return authors end def major_descriptors #@pubmed['MH'].strip.split(/\n/).select {|m| m.match(/\*/)}.map {|m| m.gsub(/\/.+$/, "")} mh.select {|m| m.match(/\*/)}.map {|m| m.gsub(/\*|\/.+$/, "")} end def pub_month MONTH[dp[5, 3]] || 1 end def pub_day if dp[9,2] && dp[9,2].match(/^\d+$/) dp[9,2] else 1 end end def pubdate sprintf("%04d-%02d-%02d", year || 0, pub_month || 0, pub_day || 0) end + + def ellipsis_jt + if jt.length > 236 + jt[0 .. 235] + "..." + else + jt + end + end end end \ No newline at end of file diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index 89eefc5..093210b 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,222 +1,222 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) RETMAX = 200 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") while medline.size == 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| unless article_ids.include?(m.pmid.to_i) || m.pmid.blank? # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) - journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) + journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.ellipsis_jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} pubtypes = m.pt.map {|p| Pubtype.find_or_create_by_term(p.gsub(/JOURNAL ARTICLE/, "Journal Article"))} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end periods.each do |year| bibliome.increment!("#{year}_articles_count") if ["one", "five", "ten"].include?(year) # bibliome_journals bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end bibliome.all_articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) if bibliome.all_articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end
seouri/medvane3
65f6a9a5f7d70467da87b70b7cb0c45a0cf471e2
added PubMed journal update rake task
diff --git a/lib/pubmed_journal.rb b/lib/pubmed_journal.rb new file mode 100644 index 0000000..4131cab --- /dev/null +++ b/lib/pubmed_journal.rb @@ -0,0 +1,71 @@ +require 'open-uri' +require 'libxml' + +module PubmedJournal + class JournalCallback + include LibXML::XML::SaxParser::Callbacks + + CONTENT_KEY = '__content__'.freeze + HASH_SIZE_KEY = '__hash_size__'.freeze + + attr_reader :journals + + def current_hash + @hash_stack.last + end + + def on_start_document + @hash = { CONTENT_KEY => '' } + @hash_stack = [@hash] + @journals = [] + end + + def on_end_document + @hash = @hash_stack.pop + @hash.delete(CONTENT_KEY) + end + + def on_start_element(name, attrs) + new_hash = { CONTENT_KEY => '' }.merge(attrs) + new_hash[HASH_SIZE_KEY] = new_hash.size + 1 + + case current_hash[name] + when Array then current_hash[name] << new_hash + when Hash then current_hash[name] = [current_hash[name], new_hash] + when nil then current_hash[name] = new_hash + end + + @hash_stack.push(new_hash) + end + + def on_end_element(name) + if name == 'Journal' && current_hash['MedAbbr'].nil? == false + c = current_hash + id = c['jrid'] + name = c['Name'][CONTENT_KEY] + abbr = c['MedAbbr'][CONTENT_KEY] + @journals.push([id, name, abbr]) + end + if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && (current_hash[CONTENT_KEY].nil? || current_hash[CONTENT_KEY].empty?) || current_hash[CONTENT_KEY] == '' + current_hash.delete(CONTENT_KEY) + end + @hash_stack.pop + end + + def on_characters(string) + current_hash[CONTENT_KEY] << string + end + + alias_method :on_cdata_block, :on_characters + end + + def get + url = "ftp://ftp.ncbi.nih.gov/pubmed/jourcache.xml" + parser = LibXML::XML::SaxParser.io(open(url)) + updater = JournalCallback.new + parser.callbacks = updater + parser.parse + updater.journals + end + module_function :get +end diff --git a/lib/tasks/journals.rake b/lib/tasks/journals.rake new file mode 100644 index 0000000..09e37e5 --- /dev/null +++ b/lib/tasks/journals.rake @@ -0,0 +1,16 @@ +namespace :mdvn do + desc "Updates Journal from PubMed" + task :journals => :environment do + require 'pubmed_journal' + require 'pp' + journal_ids = Journal.all(:select => :id).map {|j| j.id} + journals = PubmedJournal.get + journals.each do |j| + unless journal_ids.include?(j[0].to_i) + journal = Journal.new + journal.id, journal.title, journal.abbr = j + journal.save + end + end + end +end
seouri/medvane3
415157b7037bc991508270f468a8592e9c81b4d8
number with delimiter for bibliome import status
diff --git a/app/helpers/bibliomes_helper.rb b/app/helpers/bibliomes_helper.rb index d608b0f..8dd48d0 100644 --- a/app/helpers/bibliomes_helper.rb +++ b/app/helpers/bibliomes_helper.rb @@ -1,46 +1,46 @@ module BibliomesHelper def status(bibliome) unless bibliome.built? - status = "#{bibliome.total_articles} articles are enqueued for importing. Please bookmark this page and come back later." + status = "#{number_with_delimiter(bibliome.total_articles)} articles are enqueued for importing. Please bookmark this page and come back later." progressbar = '' if bibliome.all_articles_count > 0 percentage = sprintf("%d", bibliome.all_articles_count.to_f / bibliome.total_articles.to_f * 100) started_at = bibliome.started_at || Time.now rate = bibliome.all_articles_count.to_f / (Time.now - started_at) time_left = ((bibliome.total_articles - bibliome.all_articles_count).to_f / rate).to_i estimate = distance_of_time_in_words(Time.now, Time.now + time_left) status = "#{number_with_delimiter(bibliome.all_articles_count)} of #{number_with_delimiter(bibliome.total_articles)} articles (#{percentage}%) were imported in #{processing_time(bibliome)} (#{bibliome.build_speed}). Estimated time to finish importing is #{estimate}." progressbar = content_tag(:div, content_tag(:div, content_tag(:div, "#{percentage}%", :style => "padding-left: 0.5em"), :style => "background-color: #ccc; width: #{percentage}%; border-right: 1px solid #913"), :style => "border: 1px solid #913; margin-top: 0.5em") end content_tag(:div, status + progressbar, :id => "bibliome_status") end end def processing_time(bibliome) to_time = bibliome.built_at || Time.now from_time = bibliome.started_at || Time.now distance_of_time_in_words(from_time, to_time, true) end def age(bibliome) if bibliome.built? time_ago_in_words(bibliome.built_at) + " ago" else "in process" end end def summary(bibliome) if bibliome.built? li = [] ["article", "journal", "author", "subject", "pubtype"].each do |obj| counter_field = "#{@period}_#{obj}s_count" count = bibliome.send(counter_field) link_text = pluralize(number_with_delimiter(count), obj.titleize) link_path = controller.send("bibliome_#{obj}s_path", bibliome, :period => @link_period) li.push(content_tag(:li, link_to(link_text, link_path))) end content_tag(:ul, li.join("\n")) end end end
seouri/medvane3
f324390fc15e710a303f13471ecc7c0ef1475952
number with delimiter for bibliome import status
diff --git a/app/helpers/bibliomes_helper.rb b/app/helpers/bibliomes_helper.rb index 2d5807b..d608b0f 100644 --- a/app/helpers/bibliomes_helper.rb +++ b/app/helpers/bibliomes_helper.rb @@ -1,46 +1,46 @@ module BibliomesHelper def status(bibliome) unless bibliome.built? status = "#{bibliome.total_articles} articles are enqueued for importing. Please bookmark this page and come back later." progressbar = '' if bibliome.all_articles_count > 0 percentage = sprintf("%d", bibliome.all_articles_count.to_f / bibliome.total_articles.to_f * 100) started_at = bibliome.started_at || Time.now rate = bibliome.all_articles_count.to_f / (Time.now - started_at) time_left = ((bibliome.total_articles - bibliome.all_articles_count).to_f / rate).to_i estimate = distance_of_time_in_words(Time.now, Time.now + time_left) - status = "#{bibliome.all_articles_count} of #{bibliome.total_articles} articles (#{percentage}%) were imported in #{processing_time(bibliome)} (#{bibliome.build_speed}). Estimated time to finish importing is #{estimate}." + status = "#{number_with_delimiter(bibliome.all_articles_count)} of #{number_with_delimiter(bibliome.total_articles)} articles (#{percentage}%) were imported in #{processing_time(bibliome)} (#{bibliome.build_speed}). Estimated time to finish importing is #{estimate}." progressbar = content_tag(:div, content_tag(:div, content_tag(:div, "#{percentage}%", :style => "padding-left: 0.5em"), :style => "background-color: #ccc; width: #{percentage}%; border-right: 1px solid #913"), :style => "border: 1px solid #913; margin-top: 0.5em") end content_tag(:div, status + progressbar, :id => "bibliome_status") end end def processing_time(bibliome) to_time = bibliome.built_at || Time.now from_time = bibliome.started_at || Time.now distance_of_time_in_words(from_time, to_time, true) end def age(bibliome) if bibliome.built? time_ago_in_words(bibliome.built_at) + " ago" else "in process" end end def summary(bibliome) if bibliome.built? li = [] ["article", "journal", "author", "subject", "pubtype"].each do |obj| counter_field = "#{@period}_#{obj}s_count" count = bibliome.send(counter_field) link_text = pluralize(number_with_delimiter(count), obj.titleize) link_path = controller.send("bibliome_#{obj}s_path", bibliome, :period => @link_period) li.push(content_tag(:li, link_to(link_text, link_path))) end content_tag(:ul, li.join("\n")) end end end
seouri/medvane3
bedf1954b0b08e8688b8eaeff90f8006f0a9a361
ensure that there is any result from eutils efetch
diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index 0f57626..89eefc5 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,222 +1,222 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) RETMAX = 200 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") - unless medline.size > 0 # webenv expired + while medline.size == 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| - unless article_ids.include?(m.pmid.to_i) # do this way rather than medline.reject!{...}.each to save memory + unless article_ids.include?(m.pmid.to_i) || m.pmid.blank? # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} pubtypes = m.pt.map {|p| Pubtype.find_or_create_by_term(p.gsub(/JOURNAL ARTICLE/, "Journal Article"))} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end periods.each do |year| bibliome.increment!("#{year}_articles_count") if ["one", "five", "ten"].include?(year) # bibliome_journals bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end bibliome.all_articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) if bibliome.all_articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end
seouri/medvane3
b8b1ba676d2741231d8e1b3535dd5c077f8c6468
refactored period parameter in the links
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 25a99ab..afa765b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,32 +1,33 @@ # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base before_filter :find_bibliome, :set_period helper :all # include all helpers, all the time helper_method :is_iphone_request? protect_from_forgery # See ActionController::RequestForgeryProtection for details # Scrub sensitive parameters from your log # filter_parameter_logging :password def is_iphone_request? request.user_agent =~ /(Mobile\/.+Safari)/ end private def find_bibliome if params[:bibliome_id] @bibliome = Bibliome.find(params[:bibliome_id]) @bibliome.hit! end end def set_period if ["one", "five", "ten"].include?(params[:period]) @period = params[:period] else @period = "all" end + @link_period = @period == "all" ? nil : @period end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fe983c1..7ef037e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,109 +1,106 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome and bibliome.built? - period = @period == "all" ? nil : @period - header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + " | " + bibliome_nav(bibliome) + header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => @link_period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end def bibliome_nav(bibliome) - period = @period == "all" ? nil : @period li = [] ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| css_class = controller.controller_name == obj ? "current" : nil - item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => period)), :class => css_class) + item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => @link_period)), :class => css_class) li.push(item) end content_tag(:ul, li.join("\n"), :id => "bibliome_nav") end def has_chart content_for(:has_chart) {true} end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") - period = @period == "all" ? nil : @period - link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) + link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => @link_period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 4 width = x_axis_label.size * 7 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 2}, :format => 'image_tag', :alt => "publication history") end def sparkline(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.length > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } alt_text = "publication history #{years.first}-#{years.last}" size = "30x10" source = Gchart.sparkline(:data => articles, :line_colors => "999999", :size => size, :alt => alt_text) image_tag(source, :alt => alt_text, :title => alt_text, :size => size) end end end diff --git a/app/helpers/bibliomes_helper.rb b/app/helpers/bibliomes_helper.rb index d3d947c..2d5807b 100644 --- a/app/helpers/bibliomes_helper.rb +++ b/app/helpers/bibliomes_helper.rb @@ -1,47 +1,46 @@ module BibliomesHelper def status(bibliome) unless bibliome.built? status = "#{bibliome.total_articles} articles are enqueued for importing. Please bookmark this page and come back later." progressbar = '' if bibliome.all_articles_count > 0 percentage = sprintf("%d", bibliome.all_articles_count.to_f / bibliome.total_articles.to_f * 100) started_at = bibliome.started_at || Time.now rate = bibliome.all_articles_count.to_f / (Time.now - started_at) time_left = ((bibliome.total_articles - bibliome.all_articles_count).to_f / rate).to_i estimate = distance_of_time_in_words(Time.now, Time.now + time_left) status = "#{bibliome.all_articles_count} of #{bibliome.total_articles} articles (#{percentage}%) were imported in #{processing_time(bibliome)} (#{bibliome.build_speed}). Estimated time to finish importing is #{estimate}." progressbar = content_tag(:div, content_tag(:div, content_tag(:div, "#{percentage}%", :style => "padding-left: 0.5em"), :style => "background-color: #ccc; width: #{percentage}%; border-right: 1px solid #913"), :style => "border: 1px solid #913; margin-top: 0.5em") end content_tag(:div, status + progressbar, :id => "bibliome_status") end end def processing_time(bibliome) to_time = bibliome.built_at || Time.now from_time = bibliome.started_at || Time.now distance_of_time_in_words(from_time, to_time, true) end def age(bibliome) if bibliome.built? time_ago_in_words(bibliome.built_at) + " ago" else "in process" end end def summary(bibliome) - period = @period == "all" ? nil : @period if bibliome.built? li = [] ["article", "journal", "author", "subject", "pubtype"].each do |obj| counter_field = "#{@period}_#{obj}s_count" count = bibliome.send(counter_field) link_text = pluralize(number_with_delimiter(count), obj.titleize) - link_path = controller.send("bibliome_#{obj}s_path", bibliome, :period => period) + link_path = controller.send("bibliome_#{obj}s_path", bibliome, :period => @link_period) li.push(content_tag(:li, link_to(link_text, link_path))) end content_tag(:ul, li.join("\n")) end end end diff --git a/app/views/authors/index.html.erb b/app/views/authors/index.html.erb index f043e95..0308456 100644 --- a/app/views/authors/index.html.erb +++ b/app/views/authors/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Authors", @bibliome.query)%> <h2>Authors</h2> <%= page_entries_info @authors %> <ol> <% @authors.each do |a| -%> - <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @period)) %> <%= count(a.articles_count) %> <%= sparkline(@bibliome, a.author)%></li> + <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @link_period)) %> <%= count(a.articles_count) %> <%= sparkline(@bibliome, a.author)%></li> <% end -%> </ol> <%= will_paginate @authors %> \ No newline at end of file diff --git a/app/views/journals/index.html.erb b/app/views/journals/index.html.erb index 509e09e..0d03c1f 100644 --- a/app/views/journals/index.html.erb +++ b/app/views/journals/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Journals", @bibliome.query)%> <h2>Journals</h2> <%= page_entries_info @journals %> <ol> <% @journals.each do |j| -%> - <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @period)) %> <%= count(j.articles_count) %> <%= sparkline(@bibliome, j.journal)%></td> + <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @link_period)) %> <%= count(j.articles_count) %> <%= sparkline(@bibliome, j.journal)%></td> <% end -%> </ol> <%= will_paginate @journals %> \ No newline at end of file diff --git a/app/views/pubtypes/index.html.erb b/app/views/pubtypes/index.html.erb index 77d360d..41d8400 100644 --- a/app/views/pubtypes/index.html.erb +++ b/app/views/pubtypes/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Pubtypes", @bibliome.query)%> <h2>Pubtypes</h2> <%= page_entries_info @pubtypes %> <ol> <% @pubtypes.each do |p| -%> - <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @period))%> <%= count(p.articles_count) %> <%= sparkline(@bibliome, p.pubtype)%></li> + <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @link_period))%> <%= count(p.articles_count) %> <%= sparkline(@bibliome, p.pubtype)%></li> <% end -%> </ol> <%= will_paginate @pubtypes %> \ No newline at end of file diff --git a/app/views/subjects/index.html.erb b/app/views/subjects/index.html.erb index d7647c6..28a2197 100644 --- a/app/views/subjects/index.html.erb +++ b/app/views/subjects/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Subjects", @bibliome.query)%> <h2>Subjects</h2> <%= page_entries_info @subjects %> <ol> <% @subjects.each do |s| -%> - <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @period)) %> <%= count(s.articles_count) %> <%= sparkline(@bibliome, s.subject)%></li> + <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @link_period)) %> <%= count(s.articles_count) %> <%= sparkline(@bibliome, s.subject)%></li> <% end -%> </ol> <%= will_paginate @subjects %> \ No newline at end of file
seouri/medvane3
32bd085f52396d1e4d8ef9bada406ef409cafb85
cosmetic change
diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index c7dbe01..5d63b73 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -1,160 +1,161 @@ /* red: #913 yellow: #ea1 */ body { margin: 0; padding: 0; } a, a:visited { color: #913; } a:hover { color: #ea1; } li { margin-bottom: 0.25em; } #hd { margin: 0 -0.8em 0 -0.8em; padding: 0.1em 0.8em 0.25em 0.8em; background-color: #ccc; } #toolbar { display: inline; margin: 0 0.25em; } #toolbar li { width: 10em; list-style: none; display: inline; padding: 0.25em; font-weight: bold; color: #913; } #toolbar a, #toolbar a:visited { color: #000; text-decoration: none; } #toolbar a:hover { color: #913; text-decoration: underline; } #bd { min-height: 20em; padding: 0; } #bd h1 { margin: 0 -0.6em 0.5em -0.6em; padding: 0.1em 0.6em; background-color: #333; color: #ccc; display: block; } #bd h1 a, #bd h1 a:visited { color: #ccc; text-decoration: none; } #bd h1 a:hover { color: #ea1; } #results_info { margin: 1em 0; padding: 0.25em; background-color: #eee; } #sample_search { margin-top: 1em; font-size: 77%; } #pubmed_search_q { width: 23em; } #pubmed_search_submit, #build_bibliome_submit { } ol#results li { margin: 0.5em 0; } #bibliome_status { padding: 1em; border: 2px solid #913; color: #913; font-weight: bold; } .age, .count { font-size: 85%; color: #666; white-space: nowrap; } .citation { margin-bottom: 1em; } .citation .title { font-size: 108%; font-weight: bold; } .citation .source, .citation .subjects { font-size: 85%; } .top_neighbors { width: 19em; min-height: 19em; float: left; } #period_tab { display: inline; margin: 0; } #period_tab li { width: 10em; list-style: none; display: inline; padding: 0.25em; color: #913; font-size: 93%; } #period_tab li.current { font-weight: bold; } #bibliome_nav { margin: 0; padding: 0; display: inline; } #bibliome_nav li { margin: 0; padding: 0 0.25em; list-style: none; font-size: 85%; font-weight: normal; display: inline; } #bibliome_nav li.current a { font-weight: bold; color: #fff; } #bibliome_nav li.current a:hover { color: #ea1; } #see_also { margin: -1em 0 1em 0; font-size: 85%; } #see_also ul { margin: 0; display: inline; } #see_also li { + margin: 0 0.25em; list-style: none; display: inline; } \ No newline at end of file
seouri/medvane3
5993ca6fac772e34d70675dc403570a0aab0642b
cosmetic change
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2263930..fe983c1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,109 +1,109 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome and bibliome.built? period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end def bibliome_nav(bibliome) period = @period == "all" ? nil : @period li = [] ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| css_class = controller.controller_name == obj ? "current" : nil item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => period)), :class => css_class) li.push(item) end content_tag(:ul, li.join("\n"), :id => "bibliome_nav") end def has_chart content_for(:has_chart) {true} end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") period = @period == "all" ? nil : @period link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end def bar_chart(data, x_axis_label, y_axis_max, legend = nil) - x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 - width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 + x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 4 + width = x_axis_label.size * 7 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end - Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") + Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 2}, :format => 'image_tag', :alt => "publication history") end def sparkline(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.length > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } alt_text = "publication history #{years.first}-#{years.last}" size = "30x10" source = Gchart.sparkline(:data => articles, :line_colors => "999999", :size => size, :alt => alt_text) image_tag(source, :alt => alt_text, :title => alt_text, :size => size) end end end
seouri/medvane3
5dd5e363eab35846f55b7925f987aea4c8507680
added 'see also' for author
diff --git a/app/helpers/authors_helper.rb b/app/helpers/authors_helper.rb index f22e1f9..7028266 100644 --- a/app/helpers/authors_helper.rb +++ b/app/helpers/authors_helper.rb @@ -1,2 +1,12 @@ module AuthorsHelper + def see_also(author) + return if author.see_also.size == 0 + period = @period == "all" ? nil : @period + li = [] + author.see_also.each do |see| + li.push(content_tag(:li, link_to(see.to_l, bibliome_author_path(@bibliome, see, :period => period) + "/#{period}"))) + end + ul = content_tag :ul, li.join("\n") + content_tag :div,"See also: " + ul, :id => "see_also" + end end diff --git a/app/models/author.rb b/app/models/author.rb index b9494d4..9537834 100644 --- a/app/models/author.rb +++ b/app/models/author.rb @@ -1,32 +1,40 @@ class Author < ActiveRecord::Base has_many :bibliome_authors, :order => "year" has_many :bibliomes, :through => :bibliome_authors has_many :authorships has_many :articles, :through => :authorships has_many :author_journals has_many :journals, :through => :author_journals has_many :coauthorship has_many :coauthors, :through => :coauthorship, :source => :coauthor_id has_many :author_subjects has_many :subjects, :through => :author_subjects has_many :author_pubtypes has_many :pubtypes, :through => :author_pubtypes validates_uniqueness_of :fore_name, :scope => [:last_name, :suffix] def full_name ["#{last_name || ""}", "#{fore_name || ""}"].join(", ") end def init_name ["#{last_name || ""}", "#{initials || ""}"].join(" ") end def merge_with(author) end def to_l full_name end + + def see_also + case initials.length + when 1: Author.find(:all, :conditions => ["last_name = ? AND initials like ? AND id != ?", last_name, "#{initials.first}%", id]) + when 2: Author.find(:all, :conditions => ["last_name = ? AND (initials = ? OR initials =?) AND id != ?", last_name, initials.first, initials, id]) + else return + end + end end diff --git a/app/views/authors/show.html.erb b/app/views/authors/show.html.erb index ed7bead..8a1ca87 100644 --- a/app/views/authors/show.html.erb +++ b/app/views/authors/show.html.erb @@ -1,7 +1,8 @@ <% page_title(@author.full_name, "Authors", @bibliome.query)%> <h2><%= @author.full_name %></h2> +<%= see_also(@author)%> <%= publication_history(@bibliome, @author) %> <%= top_neighbors(@journals, "journal")%> <%= top_neighbors(@coauthors, "coauthor")%> <%= top_neighbors(@subjects, "subject")%> <%= top_neighbors(@pubtypes, "pubtype")%> diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index ba66355..c7dbe01 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -1,148 +1,160 @@ /* red: #913 yellow: #ea1 */ body { margin: 0; padding: 0; } a, a:visited { color: #913; } a:hover { color: #ea1; } li { margin-bottom: 0.25em; } #hd { margin: 0 -0.8em 0 -0.8em; padding: 0.1em 0.8em 0.25em 0.8em; background-color: #ccc; } #toolbar { display: inline; margin: 0 0.25em; } #toolbar li { width: 10em; list-style: none; display: inline; padding: 0.25em; font-weight: bold; color: #913; } #toolbar a, #toolbar a:visited { color: #000; text-decoration: none; } #toolbar a:hover { color: #913; text-decoration: underline; } #bd { min-height: 20em; padding: 0; } #bd h1 { margin: 0 -0.6em 0.5em -0.6em; padding: 0.1em 0.6em; background-color: #333; color: #ccc; display: block; } #bd h1 a, #bd h1 a:visited { color: #ccc; text-decoration: none; } #bd h1 a:hover { color: #ea1; } #results_info { margin: 1em 0; padding: 0.25em; background-color: #eee; } #sample_search { margin-top: 1em; font-size: 77%; } #pubmed_search_q { width: 23em; } #pubmed_search_submit, #build_bibliome_submit { } ol#results li { margin: 0.5em 0; } #bibliome_status { padding: 1em; border: 2px solid #913; color: #913; font-weight: bold; } .age, .count { font-size: 85%; color: #666; white-space: nowrap; } .citation { margin-bottom: 1em; } .citation .title { font-size: 108%; font-weight: bold; } .citation .source, .citation .subjects { font-size: 85%; } .top_neighbors { width: 19em; min-height: 19em; float: left; } #period_tab { display: inline; margin: 0; } #period_tab li { width: 10em; list-style: none; display: inline; padding: 0.25em; color: #913; font-size: 93%; } #period_tab li.current { font-weight: bold; } #bibliome_nav { margin: 0; padding: 0; display: inline; } #bibliome_nav li { margin: 0; padding: 0 0.25em; list-style: none; font-size: 85%; font-weight: normal; display: inline; } #bibliome_nav li.current a { font-weight: bold; color: #fff; } #bibliome_nav li.current a:hover { color: #ea1; +} +#see_also { + margin: -1em 0 1em 0; + font-size: 85%; +} +#see_also ul { + margin: 0; + display: inline; +} +#see_also li { + list-style: none; + display: inline; } \ No newline at end of file
seouri/medvane3
2002adef6e1aac8d46072a9360437df704e63e1a
upgraded will_paginate to v2.3.12
diff --git a/config/environment.rb b/config/environment.rb index 2c7ac63..8ffcf08 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,45 +1,45 @@ # Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') Rails::Initializer.run do |config| # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) # Specify gems that this application depends on and have them installed with rake gems:install # config.gem "bj" # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" # config.gem "sqlite3-ruby", :lib => "sqlite3" # config.gem "aws-s3", :lib => "aws/s3" config.gem "googlecharts", :version => "1.4.0", :source => "http://gemcutter.org", :lib => "gchart" - config.gem "will_paginate", :version => "2.3.11", :source => "http://gemcutter.org" + config.gem "will_paginate", :version => "2.3.12", :source => "http://gemcutter.org" config.gem "bio", :version => "1.3.1", :source => "http://gemcutter.org" config.gem "delayed_job", :version => "1.8.4", :source => "http://gemcutter.org" # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Skip frameworks you're not going to use. To use Rails without a database, # you must remove the Active Record framework. # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector, :forum_observer # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. config.time_zone = 'UTC' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] # config.i18n.default_locale = :de end
seouri/medvane3
c7bceb0958b2128515f83a613c2f9bb3f17ed07c
PostgreSQL does binary search. Convert JOURNAL ARTICLE to Journal Article. Need to fix other object types, too.
diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index c1d5eca..0f57626 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,222 +1,222 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) RETMAX = 200 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") unless medline.size > 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| unless article_ids.include?(m.pmid.to_i) # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} - pubtypes = m.pt.map {|p| Pubtype.find_or_create_by_term(p)} + pubtypes = m.pt.map {|p| Pubtype.find_or_create_by_term(p.gsub(/JOURNAL ARTICLE/, "Journal Article"))} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end periods.each do |year| bibliome.increment!("#{year}_articles_count") if ["one", "five", "ten"].include?(year) # bibliome_journals bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end bibliome.all_articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) if bibliome.all_articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end
seouri/medvane3
5b8a26ddd258d1cdf9ee9391527b4c8b82357de9
create new pubtype if not found
diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index 95bfe53..c1d5eca 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,222 +1,222 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) RETMAX = 200 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") unless medline.size > 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| unless article_ids.include?(m.pmid.to_i) # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} - pubtypes = m.pt.map {|p| Pubtype.find_by_term(p)} + pubtypes = m.pt.map {|p| Pubtype.find_or_create_by_term(p)} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end periods.each do |year| bibliome.increment!("#{year}_articles_count") if ["one", "five", "ten"].include?(year) # bibliome_journals bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end bibliome.all_articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) if bibliome.all_articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end
seouri/medvane3
1d48aee9e528d8dc4eefe12529d3213ea82ba0f4
check if there is a bibliome
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 02c7eed..2263930 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,109 +1,109 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title - if bibliome.built? + if bibliome and bibliome.built? period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end def bibliome_nav(bibliome) period = @period == "all" ? nil : @period li = [] ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| css_class = controller.controller_name == obj ? "current" : nil item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => period)), :class => css_class) li.push(item) end content_tag(:ul, li.join("\n"), :id => "bibliome_nav") end def has_chart content_for(:has_chart) {true} end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") period = @period == "all" ? nil : @period link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") end def sparkline(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.length > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } alt_text = "publication history #{years.first}-#{years.last}" size = "30x10" source = Gchart.sparkline(:data => articles, :line_colors => "999999", :size => size, :alt => alt_text) image_tag(source, :alt => alt_text, :title => alt_text, :size => size) end end end
seouri/medvane3
c4f01ff086a303b1dcf776e62dc025ec3522f37d
show bibliome nav only for built bibliome
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 41f167f..02c7eed 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,109 +1,109 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title - if bibliome + if bibliome.built? period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end def bibliome_nav(bibliome) period = @period == "all" ? nil : @period li = [] ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| css_class = controller.controller_name == obj ? "current" : nil item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => period)), :class => css_class) li.push(item) end content_tag(:ul, li.join("\n"), :id => "bibliome_nav") end def has_chart content_for(:has_chart) {true} end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") period = @period == "all" ? nil : @period link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") end def sparkline(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.length > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } alt_text = "publication history #{years.first}-#{years.last}" size = "30x10" source = Gchart.sparkline(:data => articles, :line_colors => "999999", :size => size, :alt => alt_text) image_tag(source, :alt => alt_text, :title => alt_text, :size => size) end end end
seouri/medvane3
d8e48ac58ebfbfb94c725495c62823bf5b790e6f
set the right parameter for delayed_job
diff --git a/config/initializers/delayed_job.rb b/config/initializers/delayed_job.rb index ff88833..de85f51 100644 --- a/config/initializers/delayed_job.rb +++ b/config/initializers/delayed_job.rb @@ -1 +1 @@ -Delayed::Worker.destroy_failed_jobs = false \ No newline at end of file +Delayed::Job.destroy_failed_jobs = false \ No newline at end of file
seouri/medvane3
e0e893538c3ffd2fc8eb620367c29b12ff992be7
keep failed jobs in the table & give lower priority for later jobs in the same import
diff --git a/app/controllers/bibliomes_controller.rb b/app/controllers/bibliomes_controller.rb index d7c084b..713a703 100644 --- a/app/controllers/bibliomes_controller.rb +++ b/app/controllers/bibliomes_controller.rb @@ -1,113 +1,114 @@ class BibliomesController < ApplicationController def index @bibliomes = Bibliome.built.paginate(:page => params[:page], :per_page => 10) @prefix = "All " respond_to do |format| format.html # index.html.erb format.xml { render :xml => @bibliomes } end end def recent @bibliomes = Bibliome.recent.paginate(:page => params[:page], :per_page => 10) @prefix = "Recent " respond_to do |format| format.html { render :action => "index" } end end def popular @bibliomes = Bibliome.popular.paginate(:page => params[:page], :per_page => 10) @prefix = "Popular " respond_to do |format| format.html { render :action => "index" } end end def show @bibliome = Bibliome.find(params[:id]) @bibliome.hit! respond_to do |format| format.html # show.html.erb format.xml { render :xml => @bibliome } end end def new @q = params[:q] @count = 0 unless @q.blank? @webenv, @count = Medvane::Eutils.esearch(@q) @bibliomes = Bibliome.find_all_by_query(@q) if @count > 0 @medline = Medvane::Eutils.efetch(@webenv, 0, 5, "medline") @show_count = @count < 5 ? @count : 5 @bibliome_name = Digest::MD5.hexdigest(Time.now.to_f.to_s + @q) end end end def import q = params[:q] webenv = params[:w] count = params[:c] || 0 @bibliome = Bibliome.find_or_initialize_by_name(params[:name]) if @bibliome.new_record? and q.blank? == false and webenv.blank? == false and count.to_i > 1 @bibliome.query = q @bibliome.total_articles = count @bibliome.save! - priority = (50 / Math.log(count)).to_i - 0.step(@bibliome.total_articles.to_i, PubmedImport::RETMAX) do |retstart| + priority = (400 / Math.log(count)).to_i + 0.step(@bibliome.total_articles.to_i, PubmedImport::RETMAX) do |retstart| Delayed::Job.enqueue(PubmedImport.new(@bibliome.id, webenv, retstart), priority) + priority -= 1 end redirect_to @bibliome else redirect_to new_bibliome_path end end def edit @bibliome = Bibliome.find(params[:id]) end def create @bibliome = Bibliome.new(params[:bibliome]) respond_to do |format| if @bibliome.save flash[:notice] = 'Bibliome was successfully created.' format.html { redirect_to(@bibliome) } format.xml { render :xml => @bibliome, :status => :created, :location => @bibliome } else format.html { render :action => "new" } format.xml { render :xml => @bibliome.errors, :status => :unprocessable_entity } end end end def update @bibliome = Bibliome.find(params[:id]) respond_to do |format| if @bibliome.update_attributes(params[:bibliome]) flash[:notice] = 'Bibliome was successfully updated.' format.html { redirect_to(@bibliome) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @bibliome.errors, :status => :unprocessable_entity } end end end def destroy @bibliome = Bibliome.find(params[:id]) @bibliome.destroy respond_to do |format| format.html { redirect_to(bibliomes_url) } format.xml { head :ok } end end end diff --git a/config/initializers/delayed_job.rb b/config/initializers/delayed_job.rb new file mode 100644 index 0000000..ff88833 --- /dev/null +++ b/config/initializers/delayed_job.rb @@ -0,0 +1 @@ +Delayed::Worker.destroy_failed_jobs = false \ No newline at end of file
seouri/medvane3
0195250fc34458b10802a113041fb3a1af0561a0
added sparkline for publication history
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 903a829..41f167f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,98 +1,109 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end def bibliome_nav(bibliome) period = @period == "all" ? nil : @period li = [] ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| css_class = controller.controller_name == obj ? "current" : nil item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => period)), :class => css_class) li.push(item) end content_tag(:ul, li.join("\n"), :id => "bibliome_nav") end def has_chart content_for(:has_chart) {true} end - def sparkline(dat) - dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] - end - def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") period = @period == "all" ? nil : @period link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") - end + end + + def sparkline(bibliome, object) + collection_name = "bibliome_" + object.class.to_s.pluralize.downcase + data = object.send(collection_name).bibliome(bibliome) + if data.length > 0 + years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort + years_range = (years.first .. years.last).to_a + data_by_year = data.group_by(&:year) + articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } + alt_text = "publication history #{years.first}-#{years.last}" + size = "30x10" + source = Gchart.sparkline(:data => articles, :line_colors => "999999", :size => size, :alt => alt_text) + image_tag(source, :alt => alt_text, :title => alt_text, :size => size) + end + end end diff --git a/app/views/authors/index.html.erb b/app/views/authors/index.html.erb index 04279db..f043e95 100644 --- a/app/views/authors/index.html.erb +++ b/app/views/authors/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Authors", @bibliome.query)%> <h2>Authors</h2> <%= page_entries_info @authors %> <ol> <% @authors.each do |a| -%> - <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @period)) %> <%= count(a.articles_count) %></li> + <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @period)) %> <%= count(a.articles_count) %> <%= sparkline(@bibliome, a.author)%></li> <% end -%> </ol> <%= will_paginate @authors %> \ No newline at end of file diff --git a/app/views/journals/index.html.erb b/app/views/journals/index.html.erb index 018c569..509e09e 100644 --- a/app/views/journals/index.html.erb +++ b/app/views/journals/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Journals", @bibliome.query)%> <h2>Journals</h2> <%= page_entries_info @journals %> <ol> <% @journals.each do |j| -%> - <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @period)) %> <%= count(j.articles_count) %></td> + <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @period)) %> <%= count(j.articles_count) %> <%= sparkline(@bibliome, j.journal)%></td> <% end -%> </ol> <%= will_paginate @journals %> \ No newline at end of file diff --git a/app/views/pubtypes/index.html.erb b/app/views/pubtypes/index.html.erb index 2d92056..77d360d 100644 --- a/app/views/pubtypes/index.html.erb +++ b/app/views/pubtypes/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Pubtypes", @bibliome.query)%> <h2>Pubtypes</h2> <%= page_entries_info @pubtypes %> <ol> <% @pubtypes.each do |p| -%> - <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @period))%> <%= count(p.articles_count) %></li> + <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @period))%> <%= count(p.articles_count) %> <%= sparkline(@bibliome, p.pubtype)%></li> <% end -%> </ol> <%= will_paginate @pubtypes %> \ No newline at end of file diff --git a/app/views/subjects/index.html.erb b/app/views/subjects/index.html.erb index c8dd1f5..d7647c6 100644 --- a/app/views/subjects/index.html.erb +++ b/app/views/subjects/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Subjects", @bibliome.query)%> <h2>Subjects</h2> <%= page_entries_info @subjects %> <ol> <% @subjects.each do |s| -%> - <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @period)) %> <%= count(s.articles_count) %></li> + <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @period)) %> <%= count(s.articles_count) %> <%= sparkline(@bibliome, s.subject)%></li> <% end -%> </ol> <%= will_paginate @subjects %> \ No newline at end of file
seouri/medvane3
faceb98e819620ce21a565a718030fb22b5244b0
removed notes
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c47ce1..903a829 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,105 +1,98 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end def bibliome_nav(bibliome) period = @period == "all" ? nil : @period li = [] ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| css_class = controller.controller_name == obj ? "current" : nil item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => period)), :class => css_class) li.push(item) end content_tag(:ul, li.join("\n"), :id => "bibliome_nav") end def has_chart content_for(:has_chart) {true} end def sparkline(dat) dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") period = @period == "all" ? nil : @period link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end - #<% if [email protected]_journals.bibliome(@bibliome).blank? %> - #<ul> - # <% for item in @journal.bibliome_journals.bibliome(@bibliome) %> - # <li><%= item.year%>: <%= item.articles_count %> (<%= item.bibliome_id %>)</li> - # <% end %> - #</ul> - #<% end -%> def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") end end
seouri/medvane3
8fc85d7788ee59f8ed32cc3b10b7f4b385b92d68
number with delimiter
diff --git a/app/views/authors/index.html.erb b/app/views/authors/index.html.erb index 65a0c7d..04279db 100644 --- a/app/views/authors/index.html.erb +++ b/app/views/authors/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Authors", @bibliome.query)%> <h2>Authors</h2> <%= page_entries_info @authors %> <ol> <% @authors.each do |a| -%> - <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @period)) %> <span class="count">(<%= a.articles_count %>)</span></li> + <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @period)) %> <%= count(a.articles_count) %></li> <% end -%> </ol> <%= will_paginate @authors %> \ No newline at end of file diff --git a/app/views/journals/index.html.erb b/app/views/journals/index.html.erb index c95060a..018c569 100644 --- a/app/views/journals/index.html.erb +++ b/app/views/journals/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Journals", @bibliome.query)%> <h2>Journals</h2> <%= page_entries_info @journals %> <ol> <% @journals.each do |j| -%> - <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @period)) %> <span class="count">(<%= j.articles_count %>)</span></td> + <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @period)) %> <%= count(j.articles_count) %></td> <% end -%> </ol> <%= will_paginate @journals %> \ No newline at end of file diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index fedebd1..b79b815 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,34 +1,34 @@ <% page_title("Biomedical Research at a Glance") -%> <h2>Build Your Own Bibliome</h2> <% form_tag new_bibliome_path, :method => "get", :id => "pubmed_search" do %> <%= text_field_tag('q', @q, :id => "pubmed_search_q") %> <%= hidden_field_tag('count', @count, :name => nil) %> <%= submit_tag "Search PubMed", :name => nil, :disable_with => "Searching PubMed ...", :id => "pubmed_search_submit" %> <div id="sample_search"> Try these queries: <%= link_to("Rett Syndrome", new_bibliome_path(:q => "Rett Syndrome"))%> <%= link_to("plos med[jour]", new_bibliome_path(:q => "plos med[jour]"))%> </div><!-- #sample_search --> <% end -%> <% if [email protected]? -%> <h2>Recent Bibliomes</h2> <ul> <% for item in @recent -%> - <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= item.total_articles %> articles, <%= age(item) %>)</span></li> + <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= number_with_delimiter(item.total_articles) %> articles, <%= age(item) %>)</span></li> <% end -%> </ul> <%= link_to("See more recent bibliomes", recent_bibliomes_path) if (@recent.size > 5) %> <% end -%> <% if [email protected]? -%> <h2>Popular Bibliomes</h2> <ul> <% for item in @popular -%> - <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= item.total_articles %> articles, <%= age(item) %>)</span></li> + <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= number_with_delimiter(item.total_articles) %> articles, <%= age(item) %>)</span></li> <% end -%> </ul> <%= link_to("See more popular bibliomes", popular_bibliomes_path) if (@popular.size > 5) %> <% end -%> \ No newline at end of file diff --git a/app/views/pubtypes/index.html.erb b/app/views/pubtypes/index.html.erb index 17c2120..2d92056 100644 --- a/app/views/pubtypes/index.html.erb +++ b/app/views/pubtypes/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Pubtypes", @bibliome.query)%> <h2>Pubtypes</h2> <%= page_entries_info @pubtypes %> <ol> <% @pubtypes.each do |p| -%> - <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @period))%> <span class="count">(<%= p.articles_count %>)</span></li> + <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @period))%> <%= count(p.articles_count) %></li> <% end -%> </ol> <%= will_paginate @pubtypes %> \ No newline at end of file diff --git a/app/views/subjects/index.html.erb b/app/views/subjects/index.html.erb index 1756586..c8dd1f5 100644 --- a/app/views/subjects/index.html.erb +++ b/app/views/subjects/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Subjects", @bibliome.query)%> <h2>Subjects</h2> <%= page_entries_info @subjects %> <ol> <% @subjects.each do |s| -%> - <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @period)) %> <span class="count">(<%= s.articles_count %>)</span></li> + <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @period)) %> <%= count(s.articles_count) %></li> <% end -%> </ol> <%= will_paginate @subjects %> \ No newline at end of file
seouri/medvane3
c627718893d97303817c0ad7feef58f741cc799a
remove period param for 'all'
diff --git a/app/helpers/bibliomes_helper.rb b/app/helpers/bibliomes_helper.rb index 16fbc2a..d3d947c 100644 --- a/app/helpers/bibliomes_helper.rb +++ b/app/helpers/bibliomes_helper.rb @@ -1,46 +1,47 @@ module BibliomesHelper def status(bibliome) unless bibliome.built? status = "#{bibliome.total_articles} articles are enqueued for importing. Please bookmark this page and come back later." progressbar = '' if bibliome.all_articles_count > 0 percentage = sprintf("%d", bibliome.all_articles_count.to_f / bibliome.total_articles.to_f * 100) started_at = bibliome.started_at || Time.now rate = bibliome.all_articles_count.to_f / (Time.now - started_at) time_left = ((bibliome.total_articles - bibliome.all_articles_count).to_f / rate).to_i estimate = distance_of_time_in_words(Time.now, Time.now + time_left) status = "#{bibliome.all_articles_count} of #{bibliome.total_articles} articles (#{percentage}%) were imported in #{processing_time(bibliome)} (#{bibliome.build_speed}). Estimated time to finish importing is #{estimate}." progressbar = content_tag(:div, content_tag(:div, content_tag(:div, "#{percentage}%", :style => "padding-left: 0.5em"), :style => "background-color: #ccc; width: #{percentage}%; border-right: 1px solid #913"), :style => "border: 1px solid #913; margin-top: 0.5em") end content_tag(:div, status + progressbar, :id => "bibliome_status") end end def processing_time(bibliome) to_time = bibliome.built_at || Time.now from_time = bibliome.started_at || Time.now distance_of_time_in_words(from_time, to_time, true) end def age(bibliome) if bibliome.built? time_ago_in_words(bibliome.built_at) + " ago" else "in process" end end - def summary(bibliome, period="all") + def summary(bibliome) + period = @period == "all" ? nil : @period if bibliome.built? li = [] ["article", "journal", "author", "subject", "pubtype"].each do |obj| - counter_field = "#{period}_#{obj}s_count" + counter_field = "#{@period}_#{obj}s_count" count = bibliome.send(counter_field) link_text = pluralize(number_with_delimiter(count), obj.titleize) link_path = controller.send("bibliome_#{obj}s_path", bibliome, :period => period) li.push(content_tag(:li, link_to(link_text, link_path))) end content_tag(:ul, li.join("\n")) end end end diff --git a/app/views/bibliomes/show.html.erb b/app/views/bibliomes/show.html.erb index 74b57e7..322c40f 100644 --- a/app/views/bibliomes/show.html.erb +++ b/app/views/bibliomes/show.html.erb @@ -1,7 +1,7 @@ <% page_title(@bibliome.query)%> <%= status(@bibliome) %> -<%= summary(@bibliome, @period) %> +<%= summary(@bibliome) %> <% if @bibliome.built? -%> <div class="age">Built <%= time_ago_in_words(@bibliome.built_at)%> ago, will be deleted in 2 weeks from now if there is no access.</div> <% end -%> \ No newline at end of file
seouri/medvane3
91d0df74f4d40ed0f17e0c5c9b9c88fee0b8804b
added bibliome nav
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 32b1336..2c47ce1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,94 +1,105 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome period = @period == "all" ? nil : @period - header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + " | " + bibliome_nav(bibliome) end content_tag(:h1, header_text) end + def bibliome_nav(bibliome) + period = @period == "all" ? nil : @period + li = [] + ["articles", "journals", "authors", "subjects", "pubtypes"].each do |obj| + css_class = controller.controller_name == obj ? "current" : nil + item = content_tag(:li, link_to(obj, send("bibliome_#{obj}_path", bibliome, :period => period)), :class => css_class) + li.push(item) + end + content_tag(:ul, li.join("\n"), :id => "bibliome_nav") + end + def has_chart content_for(:has_chart) {true} end def sparkline(dat) dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") period = @period == "all" ? nil : @period link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end #<% if [email protected]_journals.bibliome(@bibliome).blank? %> #<ul> # <% for item in @journal.bibliome_journals.bibliome(@bibliome) %> # <li><%= item.year%>: <%= item.articles_count %> (<%= item.bibliome_id %>)</li> # <% end %> #</ul> #<% end -%> def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") end end diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index d48456a..ba66355 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -1,127 +1,148 @@ /* red: #913 yellow: #ea1 */ body { margin: 0; padding: 0; } a, a:visited { color: #913; } a:hover { color: #ea1; } li { margin-bottom: 0.25em; } #hd { margin: 0 -0.8em 0 -0.8em; padding: 0.1em 0.8em 0.25em 0.8em; background-color: #ccc; } #toolbar { display: inline; margin: 0 0.25em; } #toolbar li { width: 10em; list-style: none; display: inline; padding: 0.25em; font-weight: bold; color: #913; } #toolbar a, #toolbar a:visited { color: #000; text-decoration: none; } #toolbar a:hover { color: #913; text-decoration: underline; } #bd { min-height: 20em; padding: 0; } #bd h1 { margin: 0 -0.6em 0.5em -0.6em; padding: 0.1em 0.6em; background-color: #333; color: #ccc; + display: block; } #bd h1 a, #bd h1 a:visited { color: #ccc; text-decoration: none; - display: block; } #bd h1 a:hover { color: #ea1; } #results_info { margin: 1em 0; padding: 0.25em; background-color: #eee; } #sample_search { margin-top: 1em; font-size: 77%; } #pubmed_search_q { width: 23em; } #pubmed_search_submit, #build_bibliome_submit { } ol#results li { margin: 0.5em 0; } #bibliome_status { padding: 1em; border: 2px solid #913; color: #913; font-weight: bold; } .age, .count { font-size: 85%; color: #666; white-space: nowrap; } .citation { margin-bottom: 1em; } .citation .title { font-size: 108%; font-weight: bold; } .citation .source, .citation .subjects { font-size: 85%; } .top_neighbors { width: 19em; min-height: 19em; float: left; } #period_tab { display: inline; margin: 0; } #period_tab li { width: 10em; list-style: none; display: inline; padding: 0.25em; color: #913; font-size: 93%; } #period_tab li.current { font-weight: bold; +} + +#bibliome_nav { + margin: 0; + padding: 0; + display: inline; +} +#bibliome_nav li { + margin: 0; + padding: 0 0.25em; + list-style: none; + font-size: 85%; + font-weight: normal; + display: inline; +} +#bibliome_nav li.current a { + font-weight: bold; + color: #fff; +} +#bibliome_nav li.current a:hover { + color: #ea1; } \ No newline at end of file
seouri/medvane3
c85dee3593e2b363a3acf8862458c897023664c8
don't append period parameter for 'all'
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0d7beef..32b1336 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,93 +1,94 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(*args) @page_title = args.join(" | ") content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) end content_tag(:h1, header_text) end def has_chart content_for(:has_chart) {true} end def sparkline(dat) dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") - link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => @period)) + period = @period == "all" ? nil : @period + link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end #<% if [email protected]_journals.bibliome(@bibliome).blank? %> #<ul> # <% for item in @journal.bibliome_journals.bibliome(@bibliome) %> # <li><%= item.year%>: <%= item.articles_count %> (<%= item.bibliome_id %>)</li> # <% end %> #</ul> #<% end -%> def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") end end
seouri/medvane3
57e42309b94a8cbac71678fb74404e536e1b9b79
show subjects for each article
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 6700212..88e9b97 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -1,85 +1,85 @@ class ArticlesController < ApplicationController # GET /articles # GET /articles.xml def index - @articles = @bibliome.articles.paginate(:page => params[:page], :per_page => 10, :include => :authors, :total_entries => @bibliome.send("#{@period}_articles_count")) + @articles = @bibliome.articles.paginate(:page => params[:page], :per_page => 10, :include => [:authors, :subjects], :total_entries => @bibliome.send("#{@period}_articles_count")) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @articles } end end # GET /articles/1 # GET /articles/1.xml def show @article = Article.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @article } end end # GET /articles/new # GET /articles/new.xml def new @article = Article.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @article } end end # GET /articles/1/edit def edit @article = Article.find(params[:id]) end # POST /articles # POST /articles.xml def create @article = Article.new(params[:article]) respond_to do |format| if @article.save flash[:notice] = 'Article was successfully created.' format.html { redirect_to(@article) } format.xml { render :xml => @article, :status => :created, :location => @article } else format.html { render :action => "new" } format.xml { render :xml => @article.errors, :status => :unprocessable_entity } end end end # PUT /articles/1 # PUT /articles/1.xml def update @article = Article.find(params[:id]) respond_to do |format| if @article.update_attributes(params[:article]) flash[:notice] = 'Article was successfully updated.' format.html { redirect_to(@article) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @article.errors, :status => :unprocessable_entity } end end end # DELETE /articles/1 # DELETE /articles/1.xml def destroy @article = Article.find(params[:id]) @article.destroy respond_to do |format| format.html { redirect_to(articles_url) } format.xml { head :ok } end end end diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index 79722d3..0722a48 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -1,9 +1,9 @@ <% page_title("Articles", @bibliome.query)%> <h2>Articles</h2> <%= page_entries_info @articles %> <ol> <% @articles.each do |article| %> - <li class="citation"><div class="title"><%= article.title %></div><div class="authors"><%= article.authors.map {|a| link_to(a.init_name, bibliome_author_path(@bibliome, a))}.join(", ")%></div><div class="source"><%= link_to(article.source, bibliome_journal_path(@bibliome, article.journal_id)) %></div></li> + <li class="citation"><div class="title"><%= article.title %></div><div class="authors"><%= article.authors.map {|a| link_to(a.init_name, bibliome_author_path(@bibliome, a))}.join(", ")%></div><div class="source"><%= link_to(article.source, bibliome_journal_path(@bibliome, article.journal_id)) %></div><div class="subjects"><%= article.subjects.map {|s| link_to(s.term, bibliome_subject_path(@bibliome, s))}.join(", ")%></div></li> <% end -%> </ol> <%= will_paginate @articles %> \ No newline at end of file diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index e806e85..d48456a 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -1,127 +1,127 @@ /* red: #913 yellow: #ea1 */ body { margin: 0; padding: 0; } a, a:visited { color: #913; } a:hover { color: #ea1; } li { margin-bottom: 0.25em; } #hd { margin: 0 -0.8em 0 -0.8em; padding: 0.1em 0.8em 0.25em 0.8em; background-color: #ccc; } #toolbar { display: inline; margin: 0 0.25em; } #toolbar li { width: 10em; list-style: none; display: inline; padding: 0.25em; font-weight: bold; color: #913; } #toolbar a, #toolbar a:visited { color: #000; text-decoration: none; } #toolbar a:hover { color: #913; text-decoration: underline; } #bd { min-height: 20em; padding: 0; } #bd h1 { margin: 0 -0.6em 0.5em -0.6em; padding: 0.1em 0.6em; background-color: #333; color: #ccc; } #bd h1 a, #bd h1 a:visited { color: #ccc; text-decoration: none; display: block; } #bd h1 a:hover { color: #ea1; } #results_info { margin: 1em 0; padding: 0.25em; background-color: #eee; } #sample_search { margin-top: 1em; font-size: 77%; } #pubmed_search_q { width: 23em; } #pubmed_search_submit, #build_bibliome_submit { } ol#results li { margin: 0.5em 0; } #bibliome_status { padding: 1em; border: 2px solid #913; color: #913; font-weight: bold; } .age, .count { font-size: 85%; color: #666; white-space: nowrap; } .citation { margin-bottom: 1em; } .citation .title { font-size: 108%; font-weight: bold; } -.citation .source { +.citation .source, .citation .subjects { font-size: 85%; } .top_neighbors { width: 19em; min-height: 19em; float: left; } #period_tab { display: inline; margin: 0; } #period_tab li { width: 10em; list-style: none; display: inline; padding: 0.25em; color: #913; font-size: 93%; } #period_tab li.current { font-weight: bold; } \ No newline at end of file
seouri/medvane3
6ae8eca1d1c4390ae0f40469a4bc4d9470ddfc1f
refactored html title to be consitent
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 39a9afa..0d7beef 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,93 +1,93 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper - def page_title(title) - @page_title = title - content_for(:title) {title} + def page_title(*args) + @page_title = args.join(" | ") + content_for(:title) {@page_title} end def page_header(bibliome) header_text = @page_title if bibliome period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) end content_tag(:h1, header_text) end def has_chart content_for(:has_chart) {true} end def sparkline(dat) dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => @period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end def publication_history(bibliome, object) collection_name = "bibliome_" + object.class.to_s.pluralize.downcase data = object.send(collection_name).bibliome(bibliome) if data.size > 0 years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort years_range = (years.first .. years.last).to_a x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } data_by_year = data.group_by(&:year) articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } article_max = number_with_delimiter(articles.sort.last) content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") end end #<% if [email protected]_journals.bibliome(@bibliome).blank? %> #<ul> # <% for item in @journal.bibliome_journals.bibliome(@bibliome) %> # <li><%= item.year%>: <%= item.articles_count %> (<%= item.bibliome_id %>)</li> # <% end %> #</ul> #<% end -%> def bar_chart(data, x_axis_label, y_axis_max, legend = nil) x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 width += 70 unless legend.nil? colors = case data.size when 2: "000066,999999" when 3: "660000,999999,000066" else "999999" end Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") end end diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index dd03ca2..79722d3 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -1,8 +1,9 @@ +<% page_title("Articles", @bibliome.query)%> <h2>Articles</h2> <%= page_entries_info @articles %> <ol> <% @articles.each do |article| %> <li class="citation"><div class="title"><%= article.title %></div><div class="authors"><%= article.authors.map {|a| link_to(a.init_name, bibliome_author_path(@bibliome, a))}.join(", ")%></div><div class="source"><%= link_to(article.source, bibliome_journal_path(@bibliome, article.journal_id)) %></div></li> <% end -%> </ol> <%= will_paginate @articles %> \ No newline at end of file diff --git a/app/views/authors/index.html.erb b/app/views/authors/index.html.erb index 94503fe..65a0c7d 100644 --- a/app/views/authors/index.html.erb +++ b/app/views/authors/index.html.erb @@ -1,8 +1,9 @@ +<% page_title("Authors", @bibliome.query)%> <h2>Authors</h2> <%= page_entries_info @authors %> <ol> <% @authors.each do |a| -%> <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @period)) %> <span class="count">(<%= a.articles_count %>)</span></li> <% end -%> </ol> <%= will_paginate @authors %> \ No newline at end of file diff --git a/app/views/authors/show.html.erb b/app/views/authors/show.html.erb index 343c7f7..ed7bead 100644 --- a/app/views/authors/show.html.erb +++ b/app/views/authors/show.html.erb @@ -1,7 +1,7 @@ -<% page_title(@author.full_name + " | " + @bibliome.query)%> +<% page_title(@author.full_name, "Authors", @bibliome.query)%> <h2><%= @author.full_name %></h2> <%= publication_history(@bibliome, @author) %> <%= top_neighbors(@journals, "journal")%> <%= top_neighbors(@coauthors, "coauthor")%> <%= top_neighbors(@subjects, "subject")%> <%= top_neighbors(@pubtypes, "pubtype")%> diff --git a/app/views/bibliomes/show.html.erb b/app/views/bibliomes/show.html.erb index 88f2b92..74b57e7 100644 --- a/app/views/bibliomes/show.html.erb +++ b/app/views/bibliomes/show.html.erb @@ -1,6 +1,7 @@ +<% page_title(@bibliome.query)%> <%= status(@bibliome) %> <%= summary(@bibliome, @period) %> <% if @bibliome.built? -%> <div class="age">Built <%= time_ago_in_words(@bibliome.built_at)%> ago, will be deleted in 2 weeks from now if there is no access.</div> <% end -%> \ No newline at end of file diff --git a/app/views/journals/index.html.erb b/app/views/journals/index.html.erb index 579a583..c95060a 100644 --- a/app/views/journals/index.html.erb +++ b/app/views/journals/index.html.erb @@ -1,8 +1,9 @@ +<% page_title("Journals", @bibliome.query)%> <h2>Journals</h2> <%= page_entries_info @journals %> <ol> <% @journals.each do |j| -%> <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @period)) %> <span class="count">(<%= j.articles_count %>)</span></td> <% end -%> </ol> <%= will_paginate @journals %> \ No newline at end of file diff --git a/app/views/journals/show.html.erb b/app/views/journals/show.html.erb index c954e71..5234973 100644 --- a/app/views/journals/show.html.erb +++ b/app/views/journals/show.html.erb @@ -1,7 +1,7 @@ -<% page_title(@journal.abbr + " | " + @bibliome.query)%> +<% page_title(@journal.abbr, "Journals", @bibliome.query)%> <h2><%=h @journal.title %></h2> <%= publication_history(@bibliome, @journal) %> <%= top_neighbors(@authors, "author")%> <%= top_neighbors(@subjects, "subject")%> <%= top_neighbors(@pubtypes, "pubtype")%> diff --git a/app/views/pubtypes/index.html.erb b/app/views/pubtypes/index.html.erb index 92bf345..17c2120 100644 --- a/app/views/pubtypes/index.html.erb +++ b/app/views/pubtypes/index.html.erb @@ -1,8 +1,9 @@ +<% page_title("Pubtypes", @bibliome.query)%> <h2>Pubtypes</h2> <%= page_entries_info @pubtypes %> <ol> <% @pubtypes.each do |p| -%> <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @period))%> <span class="count">(<%= p.articles_count %>)</span></li> <% end -%> </ol> <%= will_paginate @pubtypes %> \ No newline at end of file diff --git a/app/views/pubtypes/show.html.erb b/app/views/pubtypes/show.html.erb index dee3f72..c8fe413 100644 --- a/app/views/pubtypes/show.html.erb +++ b/app/views/pubtypes/show.html.erb @@ -1,5 +1,5 @@ -<% page_title(@pubtype.term + " | " + @bibliome.query)%> +<% page_title(@pubtype.term, "Pubtypes", @bibliome.query)%> <h2><%= @pubtype.term %></h2> <%= publication_history(@bibliome, @pubtype) %> <%= top_neighbors(@journals, "journal")%> <%= top_neighbors(@authors, "author")%> \ No newline at end of file diff --git a/app/views/subjects/index.html.erb b/app/views/subjects/index.html.erb index c508b75..1756586 100644 --- a/app/views/subjects/index.html.erb +++ b/app/views/subjects/index.html.erb @@ -1,8 +1,9 @@ +<% page_title("Subjects", @bibliome.query)%> <h2>Subjects</h2> <%= page_entries_info @subjects %> <ol> <% @subjects.each do |s| -%> <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @period)) %> <span class="count">(<%= s.articles_count %>)</span></li> <% end -%> </ol> <%= will_paginate @subjects %> \ No newline at end of file diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 8ae1691..59eed8a 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -1,6 +1,6 @@ -<% page_title(@subject.term + " | " + @bibliome.query)%> +<% page_title(@subject.term, "Subjects", @bibliome.query)%> <h2><%=h @subject.term %></h2> <%= publication_history(@bibliome, @subject) %> <%= top_neighbors(@journals, "journal")%> <%= top_neighbors(@authors, "author")%> <%= top_neighbors(@cosubjects, "cosubject")%>
seouri/medvane3
88f102f6f427955e1b381ea3c659851649a53a8e
use counter in the bibliome for total entries in pagination
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 19ca901..6700212 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -1,85 +1,85 @@ class ArticlesController < ApplicationController # GET /articles # GET /articles.xml def index - @articles = @bibliome.articles.paginate(:page => params[:page], :per_page => 10, :include => :authors) + @articles = @bibliome.articles.paginate(:page => params[:page], :per_page => 10, :include => :authors, :total_entries => @bibliome.send("#{@period}_articles_count")) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @articles } end end # GET /articles/1 # GET /articles/1.xml def show @article = Article.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @article } end end # GET /articles/new # GET /articles/new.xml def new @article = Article.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @article } end end # GET /articles/1/edit def edit @article = Article.find(params[:id]) end # POST /articles # POST /articles.xml def create @article = Article.new(params[:article]) respond_to do |format| if @article.save flash[:notice] = 'Article was successfully created.' format.html { redirect_to(@article) } format.xml { render :xml => @article, :status => :created, :location => @article } else format.html { render :action => "new" } format.xml { render :xml => @article.errors, :status => :unprocessable_entity } end end end # PUT /articles/1 # PUT /articles/1.xml def update @article = Article.find(params[:id]) respond_to do |format| if @article.update_attributes(params[:article]) flash[:notice] = 'Article was successfully updated.' format.html { redirect_to(@article) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @article.errors, :status => :unprocessable_entity } end end end # DELETE /articles/1 # DELETE /articles/1.xml def destroy @article = Article.find(params[:id]) @article.destroy respond_to do |format| format.html { redirect_to(articles_url) } format.xml { head :ok } end end end diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index b5123a1..54caac4 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -1,89 +1,89 @@ class AuthorsController < ApplicationController # GET /authors # GET /authors.xml def index - @authors = @bibliome.authors.period(@period).paginate(:page => params[:page], :per_page => 10) + @authors = @bibliome.authors.period(@period).paginate(:page => params[:page], :per_page => 10, :total_entries => @bibliome.send("#{@period}_authors_count")) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @authors } end end # GET /authors/1 # GET /authors/1.xml def show @author = Author.find(params[:id]) @journals = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) @coauthors = Coauthorship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:coauthor, :bibliome]) @subjects = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total_direct desc", :limit => 10, :include => [:subject, :bibliome]) @pubtypes = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @author } end end # GET /authors/new # GET /authors/new.xml def new @author = Author.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @author } end end # GET /authors/1/edit def edit @author = Author.find(params[:id]) end # POST /authors # POST /authors.xml def create @author = Author.new(params[:author]) respond_to do |format| if @author.save flash[:notice] = 'Author was successfully created.' format.html { redirect_to(@author) } format.xml { render :xml => @author, :status => :created, :location => @author } else format.html { render :action => "new" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # PUT /authors/1 # PUT /authors/1.xml def update @author = Author.find(params[:id]) respond_to do |format| if @author.update_attributes(params[:author]) flash[:notice] = 'Author was successfully updated.' format.html { redirect_to(@author) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # DELETE /authors/1 # DELETE /authors/1.xml def destroy @author = Author.find(params[:id]) @author.destroy respond_to do |format| format.html { redirect_to(authors_url) } format.xml { head :ok } end end end diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 1b20c24..e35be1d 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -1,87 +1,87 @@ class JournalsController < ApplicationController # GET /journals # GET /journals.xml def index - @journals = @bibliome.journals.period(@period).paginate(:page => params[:page], :per_page => 10) + @journals = @bibliome.journals.period(@period).paginate(:page => params[:page], :per_page => 10, :total_entries => @bibliome.send("#{@period}_journals_count")) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @journals } end end # GET /journals/1 # GET /journals/1.xml def show @journal = Journal.find(params[:id]) @authors = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) @subjects = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => @period}, :order => "direct desc", :limit => 10, :include => [:subject, :bibliome]) @pubtypes = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @journal } end end # GET /journals/new # GET /journals/new.xml def new @journal = Journal.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @journal } end end # GET /journals/1/edit def edit @journal = Journal.find(params[:id]) end # POST /journals # POST /journals.xml def create @journal = Journal.new(params[:journal]) respond_to do |format| if @journal.save flash[:notice] = 'Journal was successfully created.' format.html { redirect_to(@journal) } format.xml { render :xml => @journal, :status => :created, :location => @journal } else format.html { render :action => "new" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # PUT /journals/1 # PUT /journals/1.xml def update @journal = Journal.find(params[:id]) respond_to do |format| if @journal.update_attributes(params[:journal]) flash[:notice] = 'Journal was successfully updated.' format.html { redirect_to(@journal) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # DELETE /journals/1 # DELETE /journals/1.xml def destroy @journal = Journal.find(params[:id]) @journal.destroy respond_to do |format| format.html { redirect_to(journals_url) } format.xml { head :ok } end end end diff --git a/app/controllers/pubtypes_controller.rb b/app/controllers/pubtypes_controller.rb index c8ab500..cbf9e4c 100644 --- a/app/controllers/pubtypes_controller.rb +++ b/app/controllers/pubtypes_controller.rb @@ -1,87 +1,87 @@ class PubtypesController < ApplicationController # GET /pubtypes # GET /pubtypes.xml def index - @pubtypes = @bibliome.pubtypes.period(@period).paginate(:page => params[:page], :per_page => 10) + @pubtypes = @bibliome.pubtypes.period(@period).paginate(:page => params[:page], :per_page => 10, :total_entries => @bibliome.send("#{@period}_pubtypes_count")) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @pubtypes } end end # GET /pubtypes/1 # GET /pubtypes/1.xml def show @pubtype = Pubtype.find(params[:id]) @journals = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) @authors = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @pubtype } end end # GET /pubtypes/new # GET /pubtypes/new.xml def new @pubtype = Pubtype.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @pubtype } end end # GET /pubtypes/1/edit def edit @pubtype = Pubtype.find(params[:id]) end # POST /pubtypes # POST /pubtypes.xml def create @pubtype = Pubtype.new(params[:pubtype]) respond_to do |format| if @pubtype.save flash[:notice] = 'Pubtype was successfully created.' format.html { redirect_to(@pubtype) } format.xml { render :xml => @pubtype, :status => :created, :location => @pubtype } else format.html { render :action => "new" } format.xml { render :xml => @pubtype.errors, :status => :unprocessable_entity } end end end # PUT /pubtypes/1 # PUT /pubtypes/1.xml def update @pubtype = Pubtype.find(params[:id]) respond_to do |format| if @pubtype.update_attributes(params[:pubtype]) flash[:notice] = 'Pubtype was successfully updated.' format.html { redirect_to(@pubtype) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @pubtype.errors, :status => :unprocessable_entity } end end end # DELETE /pubtypes/1 # DELETE /pubtypes/1.xml def destroy @pubtype = Pubtype.find(params[:id]) @pubtype.destroy respond_to do |format| format.html { redirect_to(pubtypes_url) } format.xml { head :ok } end end end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 78c45ee..8d8996e 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,88 +1,88 @@ class SubjectsController < ApplicationController # GET /subjects # GET /subjects.xml def index - @subjects = @bibliome.subjects.period(@period).paginate(:page => params[:page], :per_page => 10) + @subjects = @bibliome.subjects.period(@period).paginate(:page => params[:page], :per_page => 10, :total_entries => @bibliome.send("#{@period}_subjects_count")) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @subjects } end end # GET /subjects/1 # GET /subjects/1.xml def show @subject = Subject.find(params[:id]) @journals = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) @authors = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => @period}, :order => "total_direct desc", :limit => 10, :include => [:author, :bibliome]) @cosubjects = Cosubjectship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => @period}, :order => "direct desc", :limit => 10, :include => [:cosubject, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @subject } end end # GET /subjects/new # GET /subjects/new.xml def new @subject = Subject.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @subject } end end # GET /subjects/1/edit def edit @subject = Subject.find(params[:id]) end # POST /subjects # POST /subjects.xml def create @subject = Subject.new(params[:subject]) respond_to do |format| if @subject.save flash[:notice] = 'Subject was successfully created.' format.html { redirect_to(@subject) } format.xml { render :xml => @subject, :status => :created, :location => @subject } else format.html { render :action => "new" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # PUT /subjects/1 # PUT /subjects/1.xml def update @subject = Subject.find(params[:id]) respond_to do |format| if @subject.update_attributes(params[:subject]) flash[:notice] = 'Subject was successfully updated.' format.html { redirect_to(@subject) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # DELETE /subjects/1 # DELETE /subjects/1.xml def destroy @subject = Subject.find(params[:id]) @subject.destroy respond_to do |format| format.html { redirect_to(subjects_url) } format.xml { head :ok } end end end
seouri/medvane3
a3203e969f96f655ec78fe73d47455b42b3e6044
added publication history graph
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9ffc1d8..39a9afa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,60 +1,93 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(title) @page_title = title content_for(:title) {title} end def page_header(bibliome) header_text = @page_title if bibliome period = @period == "all" ? nil : @period header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) end content_tag(:h1, header_text) end def has_chart content_for(:has_chart) {true} end def sparkline(dat) dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => @period)) end def period_tab(period="all") periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] li = [] periods.each do |p| period_key = p[0] period_val = p[1] li_class = period == period_key ? "current" : nil link_text = period_val period_key = nil if period_key == "all" link = url_for(:period => period_key) li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) end content_tag(:ul, li.join("\n"), :id => "period_tab") end + + def publication_history(bibliome, object) + collection_name = "bibliome_" + object.class.to_s.pluralize.downcase + data = object.send(collection_name).bibliome(bibliome) + if data.size > 0 + years = data.select {|d| d.year.match(/^\d+$/) }.map {|d| d.year}.sort + years_range = (years.first .. years.last).to_a + x_axis_label = years_range.map {|y| y == years.first || y == years.last ? y : "" } + data_by_year = data.group_by(&:year) + articles = years_range.map {|y| data_by_year[y].nil? ? 0 : data_by_year[y][0].articles_count } + article_max = number_with_delimiter(articles.sort.last) + content_tag(:div, bar_chart(articles, x_axis_label, article_max), :id => "publication_history") + end + end + #<% if [email protected]_journals.bibliome(@bibliome).blank? %> + #<ul> + # <% for item in @journal.bibliome_journals.bibliome(@bibliome) %> + # <li><%= item.year%>: <%= item.articles_count %> (<%= item.bibliome_id %>)</li> + # <% end %> + #</ul> + #<% end -%> + + def bar_chart(data, x_axis_label, y_axis_max, legend = nil) + x_axis_label[0] = "" unless x_axis_label.size == 1 || x_axis_label.size > 5 + width = x_axis_label.size * 8 + y_axis_max.to_s.size * 6 + 10 + 10 + width += 70 unless legend.nil? + colors = case data.size + when 2: "000066,999999" + when 3: "660000,999999,000066" + else "999999" + end + Gchart.bar(:data => data, :axis_labels => [x_axis_label, [0, y_axis_max]], :bar_colors => colors, :legend => legend, :size => "#{width}x40", :axis_with_labels => 'x,y', :bar_width_and_spacing => {:width => 5, :spacing => 3}, :format => 'image_tag', :alt => "publication history") + end end diff --git a/app/models/author.rb b/app/models/author.rb index d618f4d..b9494d4 100644 --- a/app/models/author.rb +++ b/app/models/author.rb @@ -1,32 +1,32 @@ class Author < ActiveRecord::Base - has_many :bibliome_authors + has_many :bibliome_authors, :order => "year" has_many :bibliomes, :through => :bibliome_authors has_many :authorships has_many :articles, :through => :authorships has_many :author_journals has_many :journals, :through => :author_journals has_many :coauthorship has_many :coauthors, :through => :coauthorship, :source => :coauthor_id has_many :author_subjects has_many :subjects, :through => :author_subjects has_many :author_pubtypes has_many :pubtypes, :through => :author_pubtypes validates_uniqueness_of :fore_name, :scope => [:last_name, :suffix] def full_name ["#{last_name || ""}", "#{fore_name || ""}"].join(", ") end def init_name ["#{last_name || ""}", "#{initials || ""}"].join(" ") end def merge_with(author) end def to_l full_name end end diff --git a/app/models/bibliome_author.rb b/app/models/bibliome_author.rb index eef2c58..35581cc 100644 --- a/app/models/bibliome_author.rb +++ b/app/models/bibliome_author.rb @@ -1,10 +1,14 @@ class BibliomeAuthor < ActiveRecord::Base belongs_to :bibliome belongs_to :author validates_uniqueness_of :author_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| { :conditions => { :year => range }, :order => "articles_count desc"} } + + named_scope :bibliome, lambda {|bibliome| + { :conditions => { :bibliome_id => bibliome.id }} + } end diff --git a/app/models/bibliome_gene.rb b/app/models/bibliome_gene.rb index 4168e8e..7e8df6e 100644 --- a/app/models/bibliome_gene.rb +++ b/app/models/bibliome_gene.rb @@ -1,10 +1,14 @@ class BibliomeGene < ActiveRecord::Base belongs_to :bibliome belongs_to :genes validates_uniqueness_of :gene_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| { :conditions => { :year => range }, :order => "articles_count desc"} } + + named_scope :bibliome, lambda {|bibliome| + { :conditions => { :bibliome_id => bibliome.id }} + } end diff --git a/app/models/bibliome_journal.rb b/app/models/bibliome_journal.rb index 77b443f..5f3ed19 100644 --- a/app/models/bibliome_journal.rb +++ b/app/models/bibliome_journal.rb @@ -1,13 +1,17 @@ class BibliomeJournal < ActiveRecord::Base belongs_to :bibliome belongs_to :journal has_many :author_journals has_many :journal_subjects has_many :journal_pubtypes validates_uniqueness_of :journal_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| { :conditions => { :year => range }, :order => "articles_count desc"} } + + named_scope :bibliome, lambda {|bibliome| + { :conditions => { :bibliome_id => bibliome.id }} + } end diff --git a/app/models/bibliome_pubtype.rb b/app/models/bibliome_pubtype.rb index 296755b..8d243ae 100644 --- a/app/models/bibliome_pubtype.rb +++ b/app/models/bibliome_pubtype.rb @@ -1,10 +1,14 @@ class BibliomePubtype < ActiveRecord::Base belongs_to :bibliome belongs_to :pubtype validates_uniqueness_of :pubtype_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| { :conditions => { :year => range }, :order => "articles_count desc"} } + + named_scope :bibliome, lambda {|bibliome| + { :conditions => { :bibliome_id => bibliome.id }} + } end diff --git a/app/models/bibliome_subject.rb b/app/models/bibliome_subject.rb index afe4f43..40efba8 100644 --- a/app/models/bibliome_subject.rb +++ b/app/models/bibliome_subject.rb @@ -1,10 +1,14 @@ class BibliomeSubject < ActiveRecord::Base belongs_to :bibliome belongs_to :subject validates_uniqueness_of :subject_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| { :conditions => { :year => range }, :order => "articles_count desc"} } + + named_scope :bibliome, lambda {|bibliome| + { :conditions => { :bibliome_id => bibliome.id }} + } end diff --git a/app/models/journal.rb b/app/models/journal.rb index c1e4669..ac178a3 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -1,18 +1,18 @@ class Journal < ActiveRecord::Base - has_many :bibliome_journals + has_many :bibliome_journals, :order => "year" has_many :bibliomes, :through => :bibliome_journals has_many :articles has_many :author_journals has_many :authors, :through => :author_journals has_many :journal_subjects has_many :subjects, :through => :journal_subjects has_many :journal_pubtypes has_many :pubtypes, :through => :journal_pubtypes validates_uniqueness_of :title, :scope => :abbr validates_uniqueness_of :abbr, :scope => :title def to_l abbr end end diff --git a/app/models/pubtype.rb b/app/models/pubtype.rb index 12f1f0b..cf15dfb 100644 --- a/app/models/pubtype.rb +++ b/app/models/pubtype.rb @@ -1,14 +1,14 @@ class Pubtype < ActiveRecord::Base - has_many :bibliome_pubtypes + has_many :bibliome_pubtypes, :order => "year" has_many :bibliomes, :through => :bibliome_pubtypes has_many :article_types has_many :articles, :through => :article_types has_many :author_pubtypes has_many :authors, :through => :author_pubtypes has_many :journal_pubtypes has_many :journals, :through => :journal_pubtypes def to_l term end end diff --git a/app/models/subject.rb b/app/models/subject.rb index e2f164c..d620280 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -1,19 +1,19 @@ class Subject < ActiveRecord::Base - has_many :bibliome_subjects + has_many :bibliome_subjects, :order => "year" has_many :bibliomes, :through => :bibliome_subjects has_many :topics has_many :articles, :through => :topics has_many :mesh_trees has_many :mesh_ancestors has_many :ancestors, :through => :mesh_ancestors, :source => :ancestor has_many :author_subjects has_many :authors, :through => :author_subjects has_many :journal_subjects has_many :journals, :through => :journal_subjects has_many :cosubjectships has_many :cosubjects, :through => :cosubjectships, :source => :cosubject_id def to_l term end end diff --git a/app/views/authors/show.html.erb b/app/views/authors/show.html.erb index 284724e..343c7f7 100644 --- a/app/views/authors/show.html.erb +++ b/app/views/authors/show.html.erb @@ -1,6 +1,7 @@ <% page_title(@author.full_name + " | " + @bibliome.query)%> <h2><%= @author.full_name %></h2> +<%= publication_history(@bibliome, @author) %> <%= top_neighbors(@journals, "journal")%> <%= top_neighbors(@coauthors, "coauthor")%> <%= top_neighbors(@subjects, "subject")%> <%= top_neighbors(@pubtypes, "pubtype")%> diff --git a/app/views/journals/show.html.erb b/app/views/journals/show.html.erb index 7984563..c954e71 100644 --- a/app/views/journals/show.html.erb +++ b/app/views/journals/show.html.erb @@ -1,6 +1,7 @@ <% page_title(@journal.abbr + " | " + @bibliome.query)%> <h2><%=h @journal.title %></h2> +<%= publication_history(@bibliome, @journal) %> <%= top_neighbors(@authors, "author")%> <%= top_neighbors(@subjects, "subject")%> <%= top_neighbors(@pubtypes, "pubtype")%> diff --git a/app/views/pubtypes/show.html.erb b/app/views/pubtypes/show.html.erb index 9afa2f8..dee3f72 100644 --- a/app/views/pubtypes/show.html.erb +++ b/app/views/pubtypes/show.html.erb @@ -1,5 +1,5 @@ <% page_title(@pubtype.term + " | " + @bibliome.query)%> <h2><%= @pubtype.term %></h2> - +<%= publication_history(@bibliome, @pubtype) %> <%= top_neighbors(@journals, "journal")%> <%= top_neighbors(@authors, "author")%> \ No newline at end of file diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 0b49b78..8ae1691 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -1,5 +1,6 @@ <% page_title(@subject.term + " | " + @bibliome.query)%> <h2><%=h @subject.term %></h2> +<%= publication_history(@bibliome, @subject) %> <%= top_neighbors(@journals, "journal")%> <%= top_neighbors(@authors, "author")%> <%= top_neighbors(@cosubjects, "cosubject")%> diff --git a/db/migrate/20091226022917_create_bibliome_journals.rb b/db/migrate/20091226022917_create_bibliome_journals.rb index b4c3d0a..228ba92 100644 --- a/db/migrate/20091226022917_create_bibliome_journals.rb +++ b/db/migrate/20091226022917_create_bibliome_journals.rb @@ -1,16 +1,16 @@ class CreateBibliomeJournals < ActiveRecord::Migration def self.up create_table :bibliome_journals do |t| t.integer :bibliome_id t.integer :journal_id t.string :year t.integer :articles_count, :default => 0 end add_index :bibliome_journals, [:bibliome_id, :year, :articles_count], :name => 'index_bibliome_journals_on_bibliome_id_year_articles_count' - add_index :bibliome_journals, [:bibliome_id, :year, :journal_id] + add_index :bibliome_journals, [:bibliome_id, :journal_id, :year] end def self.down drop_table :bibliome_journals end end diff --git a/db/migrate/20091226022941_create_bibliome_authors.rb b/db/migrate/20091226022941_create_bibliome_authors.rb index 62f34e6..04e3c1d 100644 --- a/db/migrate/20091226022941_create_bibliome_authors.rb +++ b/db/migrate/20091226022941_create_bibliome_authors.rb @@ -1,16 +1,16 @@ class CreateBibliomeAuthors < ActiveRecord::Migration def self.up create_table :bibliome_authors do |t| t.integer :bibliome_id t.integer :author_id t.string :year t.integer :articles_count, :default => 0 end - add_index :bibliome_authors, [:bibliome_id, :year, :author_id] + add_index :bibliome_authors, [:bibliome_id, :author_id, :year] add_index :bibliome_authors, [:bibliome_id, :year, :articles_count], :name => 'index_bibliome_authors_on_bibliome_id_year_articles_count' end def self.down drop_table :bibliome_authors end end diff --git a/db/migrate/20091226023003_create_bibliome_subjects.rb b/db/migrate/20091226023003_create_bibliome_subjects.rb index a057d16..eb066d0 100644 --- a/db/migrate/20091226023003_create_bibliome_subjects.rb +++ b/db/migrate/20091226023003_create_bibliome_subjects.rb @@ -1,16 +1,16 @@ class CreateBibliomeSubjects < ActiveRecord::Migration def self.up create_table :bibliome_subjects do |t| t.integer :bibliome_id t.integer :subject_id t.string :year t.integer :articles_count, :default => 0 end - add_index :bibliome_subjects, [:bibliome_id, :year, :subject_id] + add_index :bibliome_subjects, [:bibliome_id, :subject_id, :year] add_index :bibliome_subjects, [:bibliome_id, :year, :articles_count], :name => 'index_bibliome_subjects_on_bibliome_id_year_articles_count' end def self.down drop_table :bibliome_subjects end end diff --git a/db/migrate/20091226023025_create_bibliome_genes.rb b/db/migrate/20091226023025_create_bibliome_genes.rb index 2f1d72d..99c0a31 100644 --- a/db/migrate/20091226023025_create_bibliome_genes.rb +++ b/db/migrate/20091226023025_create_bibliome_genes.rb @@ -1,16 +1,16 @@ class CreateBibliomeGenes < ActiveRecord::Migration def self.up create_table :bibliome_genes do |t| t.integer :bibliome_id t.integer :gene_id t.string :year t.integer :articles_count, :default => 0 end - add_index :bibliome_genes, [:bibliome_id, :year, :gene_id] + add_index :bibliome_genes, [:bibliome_id, :gene_id, :year] add_index :bibliome_genes, [:bibliome_id, :year, :articles_count] end def self.down drop_table :bibliome_genes end end diff --git a/db/migrate/20091226023042_create_bibliome_pubtypes.rb b/db/migrate/20091226023042_create_bibliome_pubtypes.rb index 712ca76..f58938d 100644 --- a/db/migrate/20091226023042_create_bibliome_pubtypes.rb +++ b/db/migrate/20091226023042_create_bibliome_pubtypes.rb @@ -1,16 +1,16 @@ class CreateBibliomePubtypes < ActiveRecord::Migration def self.up create_table :bibliome_pubtypes do |t| t.integer :bibliome_id t.integer :pubtype_id t.string :year t.integer :articles_count, :default => 0 end - add_index :bibliome_pubtypes, [:bibliome_id, :year, :pubtype_id] + add_index :bibliome_pubtypes, [:bibliome_id, :pubtype_id, :year] add_index :bibliome_pubtypes, [:bibliome_id, :year, :articles_count], :name => 'index_bibliome_pubtypes_on_bibliome_id_year_articles_count' end def self.down drop_table :bibliome_pubtypes end end diff --git a/db/schema.rb b/db/schema.rb index d236067..e8c649e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,314 +1,314 @@ # This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your database schema. If you need # to create the application database on another system, you should be using db:schema:load, not running # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. ActiveRecord::Schema.define(:version => 20091226023507) do create_table "article_types", :force => true do |t| t.integer "article_id" t.integer "pubtype_id" end add_index "article_types", ["article_id"], :name => "index_article_types_on_article_id" create_table "articles", :force => true do |t| t.integer "journal_id" t.date "pubdate" t.text "title" t.text "affiliation" t.string "source" t.integer "bibliomes_count", :default => 0 end add_index "articles", ["journal_id", "pubdate"], :name => "index_articles_on_journal_id_and_pubdate" add_index "articles", ["pubdate"], :name => "index_articles_on_pubdate" create_table "author_journals", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "journal_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_journals", ["bibliome_id", "author_id", "year", "journal_id"], :name => "index_author_journals_on_bibliome_id_author_id_year_journal_id" add_index "author_journals", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_author_id_year_total" add_index "author_journals", ["bibliome_id", "journal_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_journal_id_year_total" create_table "author_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "pubtype_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "pubtype_id"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_pubtype_id" add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_total" add_index "author_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "author_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "subject_id" t.string "year" t.integer "first_direct", :default => 0 t.integer "first_descendant", :default => 0 t.integer "first_total", :default => 0 t.integer "last_direct", :default => 0 t.integer "last_descendant", :default => 0 t.integer "last_total", :default => 0 t.integer "middle_direct", :default => 0 t.integer "middle_descendant", :default => 0 t.integer "middle_total", :default => 0 t.integer "total_direct", :default => 0 t.integer "total_descendant", :default => 0 t.integer "total_total", :default => 0 end add_index "author_subjects", ["bibliome_id", "author_id", "year", "subject_id"], :name => "index_author_subjects_on_bibliome_id_author_id_year_subject_id" add_index "author_subjects", ["bibliome_id", "author_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_author_year_total_direct" add_index "author_subjects", ["bibliome_id", "subject_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_subject_year_total_direct" create_table "authors", :force => true do |t| t.string "last_name" t.string "fore_name" t.string "initials" t.string "suffix" end add_index "authors", ["last_name", "fore_name", "initials", "suffix"], :name => "index_authors_on_last_name_fore_name_initials_suffix", :unique => true add_index "authors", ["last_name", "initials"], :name => "index_authors_on_last_name_and_initials" create_table "authorships", :force => true do |t| t.integer "article_id" t.integer "author_id" t.integer "position" t.integer "last_position" end add_index "authorships", ["article_id", "position"], :name => "index_authorships_on_article_id_and_position" add_index "authorships", ["author_id"], :name => "index_authorships_on_author_id" create_table "bibliome_articles", :force => true do |t| t.integer "bibliome_id" t.integer "article_id" t.date "pubdate" end add_index "bibliome_articles", ["bibliome_id", "pubdate", "article_id"], :name => "index_bibliome_articles_on_bibliome_id_pubdate_article_id" create_table "bibliome_authors", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.string "year" t.integer "articles_count", :default => 0 end + add_index "bibliome_authors", ["bibliome_id", "author_id", "year"], :name => "index_bibliome_authors_on_bibliome_id_and_author_id_and_year" add_index "bibliome_authors", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_authors_on_bibliome_id_year_articles_count" - add_index "bibliome_authors", ["bibliome_id", "year", "author_id"], :name => "index_bibliome_authors_on_bibliome_id_and_year_and_author_id" create_table "bibliome_genes", :force => true do |t| t.integer "bibliome_id" t.integer "gene_id" t.string "year" t.integer "articles_count", :default => 0 end + add_index "bibliome_genes", ["bibliome_id", "gene_id", "year"], :name => "index_bibliome_genes_on_bibliome_id_and_gene_id_and_year" add_index "bibliome_genes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_articles_count" - add_index "bibliome_genes", ["bibliome_id", "year", "gene_id"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_gene_id" create_table "bibliome_journals", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.string "year" t.integer "articles_count", :default => 0 end + add_index "bibliome_journals", ["bibliome_id", "journal_id", "year"], :name => "index_bibliome_journals_on_bibliome_id_and_journal_id_and_year" add_index "bibliome_journals", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_journals_on_bibliome_id_year_articles_count" - add_index "bibliome_journals", ["bibliome_id", "year", "journal_id"], :name => "index_bibliome_journals_on_bibliome_id_and_year_and_journal_id" create_table "bibliome_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "pubtype_id" t.string "year" t.integer "articles_count", :default => 0 end + add_index "bibliome_pubtypes", ["bibliome_id", "pubtype_id", "year"], :name => "index_bibliome_pubtypes_on_bibliome_id_and_pubtype_id_and_year" add_index "bibliome_pubtypes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_pubtypes_on_bibliome_id_year_articles_count" - add_index "bibliome_pubtypes", ["bibliome_id", "year", "pubtype_id"], :name => "index_bibliome_pubtypes_on_bibliome_id_and_year_and_pubtype_id" create_table "bibliome_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.string "year" t.integer "articles_count", :default => 0 end + add_index "bibliome_subjects", ["bibliome_id", "subject_id", "year"], :name => "index_bibliome_subjects_on_bibliome_id_and_subject_id_and_year" add_index "bibliome_subjects", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_subjects_on_bibliome_id_year_articles_count" - add_index "bibliome_subjects", ["bibliome_id", "year", "subject_id"], :name => "index_bibliome_subjects_on_bibliome_id_and_year_and_subject_id" create_table "bibliomes", :force => true do |t| t.string "name" t.text "query" t.integer "all_articles_count", :default => 0 t.integer "all_journals_count", :default => 0 t.integer "all_authors_count", :default => 0 t.integer "all_subjects_count", :default => 0 t.integer "all_genes_count", :default => 0 t.integer "all_pubtypes_count", :default => 0 t.integer "one_articles_count", :default => 0 t.integer "one_journals_count", :default => 0 t.integer "one_authors_count", :default => 0 t.integer "one_subjects_count", :default => 0 t.integer "one_genes_count", :default => 0 t.integer "one_pubtypes_count", :default => 0 t.integer "five_articles_count", :default => 0 t.integer "five_journals_count", :default => 0 t.integer "five_authors_count", :default => 0 t.integer "five_subjects_count", :default => 0 t.integer "five_genes_count", :default => 0 t.integer "five_pubtypes_count", :default => 0 t.integer "ten_articles_count", :default => 0 t.integer "ten_journals_count", :default => 0 t.integer "ten_authors_count", :default => 0 t.integer "ten_subjects_count", :default => 0 t.integer "ten_genes_count", :default => 0 t.integer "ten_pubtypes_count", :default => 0 t.integer "total_articles", :default => 0 t.integer "hits", :default => 0 t.boolean "built", :default => false t.datetime "started_at" t.datetime "built_at" t.datetime "delete_at" t.datetime "created_at" t.datetime "updated_at" end add_index "bibliomes", ["built", "built_at"], :name => "index_bibliomes_on_built_and_built_at" add_index "bibliomes", ["hits"], :name => "index_bibliomes_on_hits" add_index "bibliomes", ["name"], :name => "index_bibliomes_on_name", :unique => true create_table "coauthorships", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "coauthor_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "coauthorships", ["bibliome_id", "author_id", "year", "coauthor_id"], :name => "index_coauthorships_on_bibliome_id_author_id_year_coauthor_id" add_index "coauthorships", ["bibliome_id", "author_id", "year", "total"], :name => "index_coauthorships_on_bibliome_id_author_id_year_total" create_table "cosubjectships", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.integer "cosubject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "cosubject_id"], :name => "index_cosubjectships_on_bibliome_subject_year_cosubject" add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_cosubjectships_on_bibliome_subject_year_direct" create_table "delayed_jobs", :force => true do |t| t.integer "priority", :default => 0 t.integer "attempts", :default => 0 t.text "handler" t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" t.string "locked_by" t.datetime "created_at" t.datetime "updated_at" end create_table "journal_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "pubtype_id" t.string "year" t.integer "total", :default => 0 end add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "pubtype_id"], :name => "index_journal_pubtypes_on_bibliome_journal_year_pubtype" add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_journal_id_year_total" add_index "journal_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "journal_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "subject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_journal_id_year_direct" add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "subject_id"], :name => "index_journal_subjects_on_bibliome_journal_year_subject" add_index "journal_subjects", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_subject_id_year_direct" create_table "journals", :force => true do |t| t.string "title" t.string "abbr" end add_index "journals", ["abbr", "title"], :name => "index_journals_on_abbr_and_title" create_table "mesh_ancestors", :force => true do |t| t.integer "subject_id" t.integer "ancestor_id" end add_index "mesh_ancestors", ["subject_id"], :name => "index_mesh_ancestors_on_subject_id" create_table "mesh_trees", :force => true do |t| t.string "tree_number" t.integer "subject_id" t.integer "parent_id" end add_index "mesh_trees", ["parent_id"], :name => "index_mesh_trees_on_parent_id" add_index "mesh_trees", ["subject_id"], :name => "index_mesh_trees_on_subject_id" add_index "mesh_trees", ["tree_number"], :name => "index_mesh_trees_on_tree_number", :unique => true create_table "pubtypes", :force => true do |t| t.string "term" end add_index "pubtypes", ["term"], :name => "index_pubtypes_on_term" create_table "subjects", :force => true do |t| t.string "term" end add_index "subjects", ["term"], :name => "index_subjects_on_term", :unique => true create_table "topics", :force => true do |t| t.integer "article_id" t.integer "subject_id" end add_index "topics", ["article_id"], :name => "index_topics_on_article_id" end diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index 34e702e..95bfe53 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,222 +1,222 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) - RETMAX = 500 + RETMAX = 200 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") unless medline.size > 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| unless article_ids.include?(m.pmid.to_i) # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} pubtypes = m.pt.map {|p| Pubtype.find_by_term(p)} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end periods.each do |year| bibliome.increment!("#{year}_articles_count") if ["one", "five", "ten"].include?(year) # bibliome_journals bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end bibliome.all_articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) if bibliome.all_articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end
seouri/medvane3
938bb0726d7f74afd275e9bf59e9cd4c5515c2f8
smaller period links for iPhone
diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index 62f46c2..e806e85 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -1,126 +1,127 @@ /* red: #913 yellow: #ea1 */ body { margin: 0; padding: 0; } a, a:visited { color: #913; } a:hover { color: #ea1; } li { margin-bottom: 0.25em; } #hd { margin: 0 -0.8em 0 -0.8em; padding: 0.1em 0.8em 0.25em 0.8em; background-color: #ccc; } #toolbar { display: inline; margin: 0 0.25em; } #toolbar li { width: 10em; list-style: none; display: inline; padding: 0.25em; font-weight: bold; color: #913; } #toolbar a, #toolbar a:visited { color: #000; text-decoration: none; } #toolbar a:hover { color: #913; text-decoration: underline; } #bd { min-height: 20em; padding: 0; } #bd h1 { margin: 0 -0.6em 0.5em -0.6em; padding: 0.1em 0.6em; background-color: #333; color: #ccc; } #bd h1 a, #bd h1 a:visited { color: #ccc; text-decoration: none; display: block; } #bd h1 a:hover { color: #ea1; } #results_info { margin: 1em 0; padding: 0.25em; background-color: #eee; } #sample_search { margin-top: 1em; font-size: 77%; } #pubmed_search_q { width: 23em; } #pubmed_search_submit, #build_bibliome_submit { } ol#results li { margin: 0.5em 0; } #bibliome_status { padding: 1em; border: 2px solid #913; color: #913; font-weight: bold; } .age, .count { font-size: 85%; color: #666; white-space: nowrap; } .citation { margin-bottom: 1em; } .citation .title { font-size: 108%; font-weight: bold; } .citation .source { font-size: 85%; } .top_neighbors { width: 19em; min-height: 19em; float: left; } #period_tab { display: inline; margin: 0; } #period_tab li { width: 10em; list-style: none; display: inline; padding: 0.25em; color: #913; + font-size: 93%; } #period_tab li.current { font-weight: bold; } \ No newline at end of file
seouri/medvane3
0345f630cceb6142cb3b6dad43383e43c4d62ed3
period tab working
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 351490c..25a99ab 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,32 +1,32 @@ # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base before_filter :find_bibliome, :set_period helper :all # include all helpers, all the time helper_method :is_iphone_request? protect_from_forgery # See ActionController::RequestForgeryProtection for details # Scrub sensitive parameters from your log # filter_parameter_logging :password def is_iphone_request? request.user_agent =~ /(Mobile\/.+Safari)/ end private def find_bibliome if params[:bibliome_id] @bibliome = Bibliome.find(params[:bibliome_id]) @bibliome.hit! end end def set_period - if ["one", "five", "ten", "all"].include?(params[:period]) + if ["one", "five", "ten"].include?(params[:period]) @period = params[:period] else @period = "all" end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6ffe334..9ffc1d8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,35 +1,60 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(title) + @page_title = title content_for(:title) {title} end + def page_header(bibliome) + header_text = @page_title + if bibliome + period = @period == "all" ? nil : @period + header_text = link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome, :period => period)) + end + content_tag(:h1, header_text) + end + def has_chart content_for(:has_chart) {true} end def sparkline(dat) dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") - link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass))) + link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass), :period => @period)) + end + + def period_tab(period="all") + periods = [ ["all", "All Time"], ["one", "Last Year"], ["five", "Last 5 Years"], ["ten", "Last 10 Years"] ] + li = [] + periods.each do |p| + period_key = p[0] + period_val = p[1] + li_class = period == period_key ? "current" : nil + link_text = period_val + period_key = nil if period_key == "all" + link = url_for(:period => period_key) + li.push(content_tag(:li, link_to_unless(li_class, link_text, link), :class => li_class)) + end + content_tag(:ul, li.join("\n"), :id => "period_tab") end end diff --git a/app/helpers/bibliomes_helper.rb b/app/helpers/bibliomes_helper.rb index 55365a4..16fbc2a 100644 --- a/app/helpers/bibliomes_helper.rb +++ b/app/helpers/bibliomes_helper.rb @@ -1,32 +1,46 @@ module BibliomesHelper def status(bibliome) unless bibliome.built? status = "#{bibliome.total_articles} articles are enqueued for importing. Please bookmark this page and come back later." progressbar = '' - if bibliome.articles_count > 0 - percentage = sprintf("%d", bibliome.articles_count.to_f / bibliome.total_articles.to_f * 100) + if bibliome.all_articles_count > 0 + percentage = sprintf("%d", bibliome.all_articles_count.to_f / bibliome.total_articles.to_f * 100) started_at = bibliome.started_at || Time.now - rate = bibliome.articles_count.to_f / (Time.now - started_at) - time_left = ((bibliome.total_articles - bibliome.articles_count).to_f / rate).to_i + rate = bibliome.all_articles_count.to_f / (Time.now - started_at) + time_left = ((bibliome.total_articles - bibliome.all_articles_count).to_f / rate).to_i estimate = distance_of_time_in_words(Time.now, Time.now + time_left) - status = "#{bibliome.articles_count} of #{bibliome.total_articles} articles (#{percentage}%) were imported in #{processing_time(bibliome)} (#{bibliome.build_speed}). Estimated time to finish importing is #{estimate}." + status = "#{bibliome.all_articles_count} of #{bibliome.total_articles} articles (#{percentage}%) were imported in #{processing_time(bibliome)} (#{bibliome.build_speed}). Estimated time to finish importing is #{estimate}." progressbar = content_tag(:div, content_tag(:div, content_tag(:div, "#{percentage}%", :style => "padding-left: 0.5em"), :style => "background-color: #ccc; width: #{percentage}%; border-right: 1px solid #913"), :style => "border: 1px solid #913; margin-top: 0.5em") end content_tag(:div, status + progressbar, :id => "bibliome_status") end end def processing_time(bibliome) to_time = bibliome.built_at || Time.now from_time = bibliome.started_at || Time.now distance_of_time_in_words(from_time, to_time, true) end def age(bibliome) if bibliome.built? time_ago_in_words(bibliome.built_at) + " ago" else "in process" end end + + def summary(bibliome, period="all") + if bibliome.built? + li = [] + ["article", "journal", "author", "subject", "pubtype"].each do |obj| + counter_field = "#{period}_#{obj}s_count" + count = bibliome.send(counter_field) + link_text = pluralize(number_with_delimiter(count), obj.titleize) + link_path = controller.send("bibliome_#{obj}s_path", bibliome, :period => period) + li.push(content_tag(:li, link_to(link_text, link_path))) + end + content_tag(:ul, li.join("\n")) + end + end end diff --git a/app/models/bibliome.rb b/app/models/bibliome.rb index 0e750a0..8ee05f0 100644 --- a/app/models/bibliome.rb +++ b/app/models/bibliome.rb @@ -1,54 +1,54 @@ class Bibliome < ActiveRecord::Base - has_many :bibliome_articles, :order => "#{BibliomeArticle.table_name}.pubdate desc" - has_many :articles, :through => :bibliome_articles + has_many :bibliome_articles + has_many :articles, :through => :bibliome_articles, :order => "#{BibliomeArticle.table_name}.pubdate desc" has_many :journals, :class_name => "BibliomeJournal", :include => :journal has_many :authors, :class_name => "BibliomeAuthor", :include => :author has_many :subjects, :class_name => "BibliomeSubject", :include => :subject #has_many :genes, :class_name => "BibliomeGene", :include => :gene has_many :pubtypes, :class_name => "BibliomePubtype", :include => :pubtype has_many :author_journals has_many :coauthorships has_many :author_subjects has_many :author_pubtypes has_many :journal_subject has_many :journal_pubtypes has_many :cosubjects validates_uniqueness_of :name named_scope :built, :conditions => { :built => true } named_scope :recent, lambda {|limit| { :conditions => { :built => true }, :order => "built_at desc", :limit => limit } } named_scope :popular, lambda {|limit| { :conditions => { :built => true }, :order => "hits desc", :limit => limit } } named_scope :enqueued, :conditions => { :built => false, :articles_count => 0 } named_scope :inprocess, :conditions => "built=0 AND articles_count > 0" named_scope :last_built, :conditions => { :built => true }, :order => "built_at desc", :limit => 1 def status if built? "finished importing" else "imported" end end def hit! if built? self.delete_at = 2.weeks.from_now self.increment! :hits end end def processing_time to_time = built_at || Time.now from_time = started_at || Time.now (to_time - from_time).round end def build_speed - (articles_count.to_f / processing_time.to_f * 60).round.to_s + " articles/min" + (all_articles_count.to_f / processing_time.to_f * 60).round.to_s + " articles/min" end end diff --git a/app/models/bibliome_article.rb b/app/models/bibliome_article.rb index 2f813ad..bf010bf 100644 --- a/app/models/bibliome_article.rb +++ b/app/models/bibliome_article.rb @@ -1,6 +1,10 @@ class BibliomeArticle < ActiveRecord::Base - belongs_to :bibliome, :counter_cache => :articles_count + belongs_to :bibliome, :counter_cache => :all_articles_count belongs_to :article, :counter_cache => :bibliomes_count validates_uniqueness_of :article_id, :scope => :bibliome_id + + named_scope :period, lambda {|range| + { :order => "pubdate desc"} + } end diff --git a/app/views/authors/index.html.erb b/app/views/authors/index.html.erb index 88d40db..94503fe 100644 --- a/app/views/authors/index.html.erb +++ b/app/views/authors/index.html.erb @@ -1,8 +1,8 @@ <h2>Authors</h2> <%= page_entries_info @authors %> <ol> <% @authors.each do |a| -%> - <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author)) %> <span class="count">(<%= a.articles_count %>)</span></li> + <li><%= link_to(a.author.full_name, bibliome_author_path(@bibliome, a.author, :period => @period)) %> <span class="count">(<%= a.articles_count %>)</span></li> <% end -%> </ol> <%= will_paginate @authors %> \ No newline at end of file diff --git a/app/views/bibliomes/show.html.erb b/app/views/bibliomes/show.html.erb index 9fabb72..88f2b92 100644 --- a/app/views/bibliomes/show.html.erb +++ b/app/views/bibliomes/show.html.erb @@ -1,13 +1,6 @@ <%= status(@bibliome) %> +<%= summary(@bibliome, @period) %> <% if @bibliome.built? -%> -<ul> - <li><%= link_to(pluralize(number_with_delimiter(@bibliome.articles_count), "Article"), bibliome_articles_path(@bibliome)) %></li> - <li><%= link_to(pluralize(number_with_delimiter(@bibliome.all_journals_count), "Journal"), bibliome_journals_path(@bibliome)) %></li> - <li><%= link_to(pluralize(number_with_delimiter(@bibliome.all_authors_count), "Author"), bibliome_authors_path(@bibliome)) %></li> - <li><%= link_to(pluralize(number_with_delimiter(@bibliome.all_subjects_count), "Subject"), bibliome_subjects_path(@bibliome)) %></li> - <!--li><%= link_to(pluralize(number_with_delimiter(@bibliome.all_genes_count), "Gene"), bibliome_genes_path(@bibliome)) if false %></li--> - <li><%= link_to(pluralize(number_with_delimiter(@bibliome.all_pubtypes_count), "Pubtype"), bibliome_pubtypes_path(@bibliome)) %></li> -</ul> <div class="age">Built <%= time_ago_in_words(@bibliome.built_at)%> ago, will be deleted in 2 weeks from now if there is no access.</div> <% end -%> \ No newline at end of file diff --git a/app/views/journals/index.html.erb b/app/views/journals/index.html.erb index d5212af..579a583 100644 --- a/app/views/journals/index.html.erb +++ b/app/views/journals/index.html.erb @@ -1,8 +1,8 @@ <h2>Journals</h2> <%= page_entries_info @journals %> <ol> <% @journals.each do |j| -%> - <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal)) %> <span class="count">(<%= j.articles_count %>)</span></td> + <li><%= link_to(j.journal.abbr, bibliome_journal_path(@bibliome, j.journal, :period => @period)) %> <span class="count">(<%= j.articles_count %>)</span></td> <% end -%> </ol> <%= will_paginate @journals %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 433a77f..eb3fe85 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,54 +1,51 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title><%= yield(:title) || controller.controller_name.titleize %> | Medvane </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <meta name="viewport" content="width=device-width"> <link rel="apple-touch-icon" href="/images/icon-57x57.png"/> <% if Rails.env == "production" %> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css&2.8.0r4/build/base/base-min.css"/> <% else -%> <%= stylesheet_link_tag "yui-rfgb" %> <% end -%> <%= stylesheet_link_tag "screen" %> <% if Rails.env == "production" %> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '<%= ENV['GOOGLE_ANALYTICS_UA']%>']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); })(); </script> <% end -%> <% if yield(:has_chart) -%><%= javascript_include_tag "protovis-r3.1" %><% end -%> </head> <body> <div id="doc3" class="yui-t7"> <div id="hd" role="banner"> <%= link_to(image_tag("medvane-137x30.png"), root_path) %> <ul id="toolbar"> <li><%= link_to_unless_current("Home", root_path) %></li> <li><%= link_to_unless_current("About Us", about_path) %></li> <li><%= link_to_unless_current("Help", help_path) %></li> </ul><!-- #toolbar --> </div><!-- #hd --> <div id="bd" role="main"> <div class="yui-g"> -<% if @bibliome -%> -<h1><%= link_to_unless_current(h(@bibliome.query), bibliome_path(@bibliome)) %></h1> -<% else -%> -<h1><%= yield(:title) %></h1> -<% end -%> +<%= page_header(@bibliome) %> +<%= period_tab(@period) if @bibliome and @bibliome.built? %> <%= yield %> </div><!-- .yui-g --> </div><!-- #bd --> <div id="ft" role="contentinfo"> </div><!-- #ft --> </div><!-- #doc4 .yui-t7 --> </body> </html> \ No newline at end of file diff --git a/app/views/pubtypes/index.html.erb b/app/views/pubtypes/index.html.erb index 7ecb503..92bf345 100644 --- a/app/views/pubtypes/index.html.erb +++ b/app/views/pubtypes/index.html.erb @@ -1,8 +1,8 @@ <h2>Pubtypes</h2> <%= page_entries_info @pubtypes %> <ol> <% @pubtypes.each do |p| -%> - <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype))%> <span class="count">(<%= p.articles_count %>)</span></li> + <li><%= link_to(p.pubtype.term, bibliome_pubtype_path(@bibliome, p.pubtype, :period => @period))%> <span class="count">(<%= p.articles_count %>)</span></li> <% end -%> </ol> <%= will_paginate @pubtypes %> \ No newline at end of file diff --git a/app/views/subjects/index.html.erb b/app/views/subjects/index.html.erb index 3c39e11..c508b75 100644 --- a/app/views/subjects/index.html.erb +++ b/app/views/subjects/index.html.erb @@ -1,8 +1,8 @@ <h2>Subjects</h2> <%= page_entries_info @subjects %> <ol> <% @subjects.each do |s| -%> - <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject)) %> <span class="count">(<%= s.articles_count %>)</span></li> + <li><%= link_to(s.subject.term, bibliome_subject_path(@bibliome, s.subject, :period => @period)) %> <span class="count">(<%= s.articles_count %>)</span></li> <% end -%> </ol> <%= will_paginate @subjects %> \ No newline at end of file diff --git a/db/migrate/20091202045126_create_bibliomes.rb b/db/migrate/20091202045126_create_bibliomes.rb index a8dd3db..b9b69a3 100644 --- a/db/migrate/20091202045126_create_bibliomes.rb +++ b/db/migrate/20091202045126_create_bibliomes.rb @@ -1,43 +1,46 @@ class CreateBibliomes < ActiveRecord::Migration def self.up create_table :bibliomes do |t| t.string :name t.text :query - t.integer :articles_count, :default => 0 + t.integer :all_articles_count, :default => 0 t.integer :all_journals_count, :default => 0 t.integer :all_authors_count, :default => 0 t.integer :all_subjects_count, :default => 0 t.integer :all_genes_count, :default => 0 t.integer :all_pubtypes_count, :default => 0 + t.integer :one_articles_count, :default => 0 t.integer :one_journals_count, :default => 0 t.integer :one_authors_count, :default => 0 t.integer :one_subjects_count, :default => 0 t.integer :one_genes_count, :default => 0 t.integer :one_pubtypes_count, :default => 0 + t.integer :five_articles_count, :default => 0 t.integer :five_journals_count, :default => 0 t.integer :five_authors_count, :default => 0 t.integer :five_subjects_count, :default => 0 t.integer :five_genes_count, :default => 0 t.integer :five_pubtypes_count, :default => 0 + t.integer :ten_articles_count, :default => 0 t.integer :ten_journals_count, :default => 0 t.integer :ten_authors_count, :default => 0 t.integer :ten_subjects_count, :default => 0 t.integer :ten_genes_count, :default => 0 t.integer :ten_pubtypes_count, :default => 0 t.integer :total_articles, :default => 0 t.integer :hits, :default => 0 t.boolean :built, :default => false t.datetime :started_at t.datetime :built_at t.datetime :delete_at t.timestamps end add_index :bibliomes, :name, :unique => true add_index :bibliomes, [:built, :built_at] add_index :bibliomes, :hits end def self.down drop_table :bibliomes end end diff --git a/db/schema.rb b/db/schema.rb index ce3b4d6..d236067 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,311 +1,314 @@ # This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your database schema. If you need # to create the application database on another system, you should be using db:schema:load, not running # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. ActiveRecord::Schema.define(:version => 20091226023507) do create_table "article_types", :force => true do |t| t.integer "article_id" t.integer "pubtype_id" end add_index "article_types", ["article_id"], :name => "index_article_types_on_article_id" create_table "articles", :force => true do |t| t.integer "journal_id" t.date "pubdate" t.text "title" t.text "affiliation" t.string "source" t.integer "bibliomes_count", :default => 0 end add_index "articles", ["journal_id", "pubdate"], :name => "index_articles_on_journal_id_and_pubdate" add_index "articles", ["pubdate"], :name => "index_articles_on_pubdate" create_table "author_journals", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "journal_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_journals", ["bibliome_id", "author_id", "year", "journal_id"], :name => "index_author_journals_on_bibliome_id_author_id_year_journal_id" add_index "author_journals", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_author_id_year_total" add_index "author_journals", ["bibliome_id", "journal_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_journal_id_year_total" create_table "author_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "pubtype_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "pubtype_id"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_pubtype_id" add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_total" add_index "author_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "author_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "subject_id" t.string "year" t.integer "first_direct", :default => 0 t.integer "first_descendant", :default => 0 t.integer "first_total", :default => 0 t.integer "last_direct", :default => 0 t.integer "last_descendant", :default => 0 t.integer "last_total", :default => 0 t.integer "middle_direct", :default => 0 t.integer "middle_descendant", :default => 0 t.integer "middle_total", :default => 0 t.integer "total_direct", :default => 0 t.integer "total_descendant", :default => 0 t.integer "total_total", :default => 0 end add_index "author_subjects", ["bibliome_id", "author_id", "year", "subject_id"], :name => "index_author_subjects_on_bibliome_id_author_id_year_subject_id" add_index "author_subjects", ["bibliome_id", "author_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_author_year_total_direct" add_index "author_subjects", ["bibliome_id", "subject_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_subject_year_total_direct" create_table "authors", :force => true do |t| t.string "last_name" t.string "fore_name" t.string "initials" t.string "suffix" end add_index "authors", ["last_name", "fore_name", "initials", "suffix"], :name => "index_authors_on_last_name_fore_name_initials_suffix", :unique => true add_index "authors", ["last_name", "initials"], :name => "index_authors_on_last_name_and_initials" create_table "authorships", :force => true do |t| t.integer "article_id" t.integer "author_id" t.integer "position" t.integer "last_position" end add_index "authorships", ["article_id", "position"], :name => "index_authorships_on_article_id_and_position" add_index "authorships", ["author_id"], :name => "index_authorships_on_author_id" create_table "bibliome_articles", :force => true do |t| t.integer "bibliome_id" t.integer "article_id" t.date "pubdate" end add_index "bibliome_articles", ["bibliome_id", "pubdate", "article_id"], :name => "index_bibliome_articles_on_bibliome_id_pubdate_article_id" create_table "bibliome_authors", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_authors", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_authors_on_bibliome_id_year_articles_count" add_index "bibliome_authors", ["bibliome_id", "year", "author_id"], :name => "index_bibliome_authors_on_bibliome_id_and_year_and_author_id" create_table "bibliome_genes", :force => true do |t| t.integer "bibliome_id" t.integer "gene_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_genes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_articles_count" add_index "bibliome_genes", ["bibliome_id", "year", "gene_id"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_gene_id" create_table "bibliome_journals", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_journals", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_journals_on_bibliome_id_year_articles_count" add_index "bibliome_journals", ["bibliome_id", "year", "journal_id"], :name => "index_bibliome_journals_on_bibliome_id_and_year_and_journal_id" create_table "bibliome_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "pubtype_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_pubtypes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_pubtypes_on_bibliome_id_year_articles_count" add_index "bibliome_pubtypes", ["bibliome_id", "year", "pubtype_id"], :name => "index_bibliome_pubtypes_on_bibliome_id_and_year_and_pubtype_id" create_table "bibliome_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_subjects", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_subjects_on_bibliome_id_year_articles_count" add_index "bibliome_subjects", ["bibliome_id", "year", "subject_id"], :name => "index_bibliome_subjects_on_bibliome_id_and_year_and_subject_id" create_table "bibliomes", :force => true do |t| t.string "name" t.text "query" - t.integer "articles_count", :default => 0 + t.integer "all_articles_count", :default => 0 t.integer "all_journals_count", :default => 0 t.integer "all_authors_count", :default => 0 t.integer "all_subjects_count", :default => 0 t.integer "all_genes_count", :default => 0 t.integer "all_pubtypes_count", :default => 0 + t.integer "one_articles_count", :default => 0 t.integer "one_journals_count", :default => 0 t.integer "one_authors_count", :default => 0 t.integer "one_subjects_count", :default => 0 t.integer "one_genes_count", :default => 0 t.integer "one_pubtypes_count", :default => 0 + t.integer "five_articles_count", :default => 0 t.integer "five_journals_count", :default => 0 t.integer "five_authors_count", :default => 0 t.integer "five_subjects_count", :default => 0 t.integer "five_genes_count", :default => 0 t.integer "five_pubtypes_count", :default => 0 + t.integer "ten_articles_count", :default => 0 t.integer "ten_journals_count", :default => 0 t.integer "ten_authors_count", :default => 0 t.integer "ten_subjects_count", :default => 0 t.integer "ten_genes_count", :default => 0 t.integer "ten_pubtypes_count", :default => 0 t.integer "total_articles", :default => 0 t.integer "hits", :default => 0 t.boolean "built", :default => false t.datetime "started_at" t.datetime "built_at" t.datetime "delete_at" t.datetime "created_at" t.datetime "updated_at" end add_index "bibliomes", ["built", "built_at"], :name => "index_bibliomes_on_built_and_built_at" add_index "bibliomes", ["hits"], :name => "index_bibliomes_on_hits" add_index "bibliomes", ["name"], :name => "index_bibliomes_on_name", :unique => true create_table "coauthorships", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "coauthor_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "coauthorships", ["bibliome_id", "author_id", "year", "coauthor_id"], :name => "index_coauthorships_on_bibliome_id_author_id_year_coauthor_id" add_index "coauthorships", ["bibliome_id", "author_id", "year", "total"], :name => "index_coauthorships_on_bibliome_id_author_id_year_total" create_table "cosubjectships", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.integer "cosubject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "cosubject_id"], :name => "index_cosubjectships_on_bibliome_subject_year_cosubject" add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_cosubjectships_on_bibliome_subject_year_direct" create_table "delayed_jobs", :force => true do |t| t.integer "priority", :default => 0 t.integer "attempts", :default => 0 t.text "handler" t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" t.string "locked_by" t.datetime "created_at" t.datetime "updated_at" end create_table "journal_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "pubtype_id" t.string "year" t.integer "total", :default => 0 end add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "pubtype_id"], :name => "index_journal_pubtypes_on_bibliome_journal_year_pubtype" add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_journal_id_year_total" add_index "journal_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "journal_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "subject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_journal_id_year_direct" add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "subject_id"], :name => "index_journal_subjects_on_bibliome_journal_year_subject" add_index "journal_subjects", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_subject_id_year_direct" create_table "journals", :force => true do |t| t.string "title" t.string "abbr" end add_index "journals", ["abbr", "title"], :name => "index_journals_on_abbr_and_title" create_table "mesh_ancestors", :force => true do |t| t.integer "subject_id" t.integer "ancestor_id" end add_index "mesh_ancestors", ["subject_id"], :name => "index_mesh_ancestors_on_subject_id" create_table "mesh_trees", :force => true do |t| t.string "tree_number" t.integer "subject_id" t.integer "parent_id" end add_index "mesh_trees", ["parent_id"], :name => "index_mesh_trees_on_parent_id" add_index "mesh_trees", ["subject_id"], :name => "index_mesh_trees_on_subject_id" add_index "mesh_trees", ["tree_number"], :name => "index_mesh_trees_on_tree_number", :unique => true create_table "pubtypes", :force => true do |t| t.string "term" end add_index "pubtypes", ["term"], :name => "index_pubtypes_on_term" create_table "subjects", :force => true do |t| t.string "term" end add_index "subjects", ["term"], :name => "index_subjects_on_term", :unique => true create_table "topics", :force => true do |t| t.integer "article_id" t.integer "subject_id" end add_index "topics", ["article_id"], :name => "index_topics_on_article_id" end diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index faf610d..34e702e 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,221 +1,222 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) RETMAX = 500 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") unless medline.size > 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| unless article_ids.include?(m.pmid.to_i) # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} pubtypes = m.pt.map {|p| Pubtype.find_by_term(p)} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end - # bibliome_journals periods.each do |year| + bibliome.increment!("#{year}_articles_count") if ["one", "five", "ten"].include?(year) + # bibliome_journals bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end - bibliome.articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) - if bibliome.articles_count == bibliome.total_articles + bibliome.all_articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) + if bibliome.all_articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index 946193a..62f46c2 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -1,111 +1,126 @@ /* red: #913 yellow: #ea1 */ body { margin: 0; padding: 0; } a, a:visited { color: #913; } a:hover { color: #ea1; } li { margin-bottom: 0.25em; } #hd { margin: 0 -0.8em 0 -0.8em; padding: 0.1em 0.8em 0.25em 0.8em; background-color: #ccc; } #toolbar { display: inline; margin: 0 0.25em; } #toolbar li { width: 10em; list-style: none; display: inline; padding: 0.25em; font-weight: bold; color: #913; } #toolbar a, #toolbar a:visited { color: #000; text-decoration: none; } #toolbar a:hover { color: #913; text-decoration: underline; } #bd { min-height: 20em; padding: 0; } #bd h1 { margin: 0 -0.6em 0.5em -0.6em; padding: 0.1em 0.6em; background-color: #333; color: #ccc; } #bd h1 a, #bd h1 a:visited { color: #ccc; text-decoration: none; display: block; } #bd h1 a:hover { color: #ea1; } #results_info { margin: 1em 0; padding: 0.25em; background-color: #eee; } #sample_search { margin-top: 1em; font-size: 77%; } #pubmed_search_q { width: 23em; } #pubmed_search_submit, #build_bibliome_submit { } ol#results li { margin: 0.5em 0; } #bibliome_status { padding: 1em; border: 2px solid #913; color: #913; font-weight: bold; } .age, .count { font-size: 85%; color: #666; white-space: nowrap; } .citation { margin-bottom: 1em; } .citation .title { font-size: 108%; font-weight: bold; } .citation .source { font-size: 85%; } .top_neighbors { width: 19em; min-height: 19em; float: left; +} + +#period_tab { + display: inline; + margin: 0; +} +#period_tab li { + width: 10em; + list-style: none; + display: inline; + padding: 0.25em; + color: #913; +} +#period_tab li.current { + font-weight: bold; } \ No newline at end of file
seouri/medvane3
57c06d38447afb5a2ec803366e26c9ee2aee67cb
added period parameter
diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index 97bf65b..b5123a1 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -1,89 +1,89 @@ class AuthorsController < ApplicationController # GET /authors # GET /authors.xml def index - @authors = @bibliome.authors.period("all").paginate(:page => params[:page], :per_page => 10) + @authors = @bibliome.authors.period(@period).paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @authors } end end # GET /authors/1 # GET /authors/1.xml def show @author = Author.find(params[:id]) - @journals = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) - @coauthors = Coauthorship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:coauthor, :bibliome]) - @subjects = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total_direct desc", :limit => 10, :include => [:subject, :bibliome]) - @pubtypes = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) + @journals = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) + @coauthors = Coauthorship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:coauthor, :bibliome]) + @subjects = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total_direct desc", :limit => 10, :include => [:subject, :bibliome]) + @pubtypes = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @author } end end # GET /authors/new # GET /authors/new.xml def new @author = Author.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @author } end end # GET /authors/1/edit def edit @author = Author.find(params[:id]) end # POST /authors # POST /authors.xml def create @author = Author.new(params[:author]) respond_to do |format| if @author.save flash[:notice] = 'Author was successfully created.' format.html { redirect_to(@author) } format.xml { render :xml => @author, :status => :created, :location => @author } else format.html { render :action => "new" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # PUT /authors/1 # PUT /authors/1.xml def update @author = Author.find(params[:id]) respond_to do |format| if @author.update_attributes(params[:author]) flash[:notice] = 'Author was successfully updated.' format.html { redirect_to(@author) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # DELETE /authors/1 # DELETE /authors/1.xml def destroy @author = Author.find(params[:id]) @author.destroy respond_to do |format| format.html { redirect_to(authors_url) } format.xml { head :ok } end end end diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 6c22084..1b20c24 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -1,87 +1,87 @@ class JournalsController < ApplicationController # GET /journals # GET /journals.xml def index - @journals = @bibliome.journals.period("all").paginate(:page => params[:page], :per_page => 10) + @journals = @bibliome.journals.period(@period).paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @journals } end end # GET /journals/1 # GET /journals/1.xml def show @journal = Journal.find(params[:id]) - @authors = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) - @subjects = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "direct desc", :limit => 10, :include => [:subject, :bibliome]) - @pubtypes = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) + @authors = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) + @subjects = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => @period}, :order => "direct desc", :limit => 10, :include => [:subject, :bibliome]) + @pubtypes = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @journal } end end # GET /journals/new # GET /journals/new.xml def new @journal = Journal.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @journal } end end # GET /journals/1/edit def edit @journal = Journal.find(params[:id]) end # POST /journals # POST /journals.xml def create @journal = Journal.new(params[:journal]) respond_to do |format| if @journal.save flash[:notice] = 'Journal was successfully created.' format.html { redirect_to(@journal) } format.xml { render :xml => @journal, :status => :created, :location => @journal } else format.html { render :action => "new" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # PUT /journals/1 # PUT /journals/1.xml def update @journal = Journal.find(params[:id]) respond_to do |format| if @journal.update_attributes(params[:journal]) flash[:notice] = 'Journal was successfully updated.' format.html { redirect_to(@journal) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # DELETE /journals/1 # DELETE /journals/1.xml def destroy @journal = Journal.find(params[:id]) @journal.destroy respond_to do |format| format.html { redirect_to(journals_url) } format.xml { head :ok } end end end diff --git a/app/controllers/pubtypes_controller.rb b/app/controllers/pubtypes_controller.rb index fb53ad2..c8ab500 100644 --- a/app/controllers/pubtypes_controller.rb +++ b/app/controllers/pubtypes_controller.rb @@ -1,87 +1,87 @@ class PubtypesController < ApplicationController # GET /pubtypes # GET /pubtypes.xml def index - @pubtypes = @bibliome.pubtypes.period("all").paginate(:page => params[:page], :per_page => 10) + @pubtypes = @bibliome.pubtypes.period(@period).paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @pubtypes } end end # GET /pubtypes/1 # GET /pubtypes/1.xml def show @pubtype = Pubtype.find(params[:id]) - @journals = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) - @authors = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) + @journals = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) + @authors = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @pubtype } end end # GET /pubtypes/new # GET /pubtypes/new.xml def new @pubtype = Pubtype.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @pubtype } end end # GET /pubtypes/1/edit def edit @pubtype = Pubtype.find(params[:id]) end # POST /pubtypes # POST /pubtypes.xml def create @pubtype = Pubtype.new(params[:pubtype]) respond_to do |format| if @pubtype.save flash[:notice] = 'Pubtype was successfully created.' format.html { redirect_to(@pubtype) } format.xml { render :xml => @pubtype, :status => :created, :location => @pubtype } else format.html { render :action => "new" } format.xml { render :xml => @pubtype.errors, :status => :unprocessable_entity } end end end # PUT /pubtypes/1 # PUT /pubtypes/1.xml def update @pubtype = Pubtype.find(params[:id]) respond_to do |format| if @pubtype.update_attributes(params[:pubtype]) flash[:notice] = 'Pubtype was successfully updated.' format.html { redirect_to(@pubtype) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @pubtype.errors, :status => :unprocessable_entity } end end end # DELETE /pubtypes/1 # DELETE /pubtypes/1.xml def destroy @pubtype = Pubtype.find(params[:id]) @pubtype.destroy respond_to do |format| format.html { redirect_to(pubtypes_url) } format.xml { head :ok } end end end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index cdf98fd..78c45ee 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,88 +1,88 @@ class SubjectsController < ApplicationController # GET /subjects # GET /subjects.xml def index - @subjects = @bibliome.subjects.period("all").paginate(:page => params[:page], :per_page => 10) + @subjects = @bibliome.subjects.period(@period).paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @subjects } end end # GET /subjects/1 # GET /subjects/1.xml def show @subject = Subject.find(params[:id]) - @journals = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) - @authors = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total_direct desc", :limit => 10, :include => [:author, :bibliome]) - @cosubjects = Cosubjectship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "direct desc", :limit => 10, :include => [:cosubject, :bibliome]) + @journals = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => @period}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) + @authors = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => @period}, :order => "total_direct desc", :limit => 10, :include => [:author, :bibliome]) + @cosubjects = Cosubjectship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => @period}, :order => "direct desc", :limit => 10, :include => [:cosubject, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @subject } end end # GET /subjects/new # GET /subjects/new.xml def new @subject = Subject.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @subject } end end # GET /subjects/1/edit def edit @subject = Subject.find(params[:id]) end # POST /subjects # POST /subjects.xml def create @subject = Subject.new(params[:subject]) respond_to do |format| if @subject.save flash[:notice] = 'Subject was successfully created.' format.html { redirect_to(@subject) } format.xml { render :xml => @subject, :status => :created, :location => @subject } else format.html { render :action => "new" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # PUT /subjects/1 # PUT /subjects/1.xml def update @subject = Subject.find(params[:id]) respond_to do |format| if @subject.update_attributes(params[:subject]) flash[:notice] = 'Subject was successfully updated.' format.html { redirect_to(@subject) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # DELETE /subjects/1 # DELETE /subjects/1.xml def destroy @subject = Subject.find(params[:id]) @subject.destroy respond_to do |format| format.html { redirect_to(subjects_url) } format.xml { head :ok } end end end
seouri/medvane3
c48727ae04948fb6504ff177876732ae45e29981
check if there is a line to change
diff --git a/lib/medline.rb b/lib/medline.rb index 9d7c81f..3379ced 100644 --- a/lib/medline.rb +++ b/lib/medline.rb @@ -1,97 +1,99 @@ module Bio class MEDLINE < NCBIDB MONTH = { "Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12, "Spr" => 3, "Sum" => 6, "Aut" => 9, "Win" => 12, } def initialize(entry) # PMID: 19900898. One MH could span in more than one lines. # In such cases, the second line is recognized as another MH rather than # part of the first line. # To fix this bug, each line should be checked whether it starts with a # tag (new item) or not (wrapped line of the preceding tag). # If it is a wrapped line of the preceding tag, the last character ("\n") # is replaced with a space before the current line is appended. @pubmed = Hash.new('') tag = '' entry.each_line do |line| with_tag = false # bug fix if line =~ /^\w/ tag = line[0,4].strip with_tag = true # bug fix end - @pubmed[tag][-1] = " " unless with_tag # bug fix - @pubmed[tag] += line[6..-1] if line.length > 6 + if line.length > 6 + @pubmed[tag][-1] = " " if @pubmed[tag][-1] and with_tag == false # bug fix + @pubmed[tag] += line[6..-1] + end end end attr_reader :pubmed def jt @pubmed['JT'].gsub(/\s+/, ' ').strip end #TODO: PMID:12895469, Edyta-Krzymanska-Olejnik only last name. AU/FAU don't match def authors authors = [] @pubmed['AU'].strip.split(/\n/).each do |author| name = author.split(/\s+/) suffix = nil if name.length > 2 && name[-2] =~ /^[A-Z]+$/ suffix = name.pop end initials = name.pop author = { "last_name" => name[0], "fore_name" => initials, "initials" => initials, "suffix" => suffix, } authors.push(author) end fau = @pubmed['FAU'].strip.split(/\n/) fau.each_index do |index| last = authors[index]["last_name"] suffix = authors[index]["suffix"] fore = fau[index].gsub(/^#{last},\s+/, "").gsub(/\s+#{suffix}$/, "") authors[index]["fore_name"] = fore end return authors end def major_descriptors #@pubmed['MH'].strip.split(/\n/).select {|m| m.match(/\*/)}.map {|m| m.gsub(/\/.+$/, "")} mh.select {|m| m.match(/\*/)}.map {|m| m.gsub(/\*|\/.+$/, "")} end def pub_month MONTH[dp[5, 3]] || 1 end def pub_day if dp[9,2] && dp[9,2].match(/^\d+$/) dp[9,2] else 1 end end def pubdate sprintf("%04d-%02d-%02d", year || 0, pub_month || 0, pub_day || 0) end end end \ No newline at end of file
seouri/medvane3
37ddcc23d9548093311ba35fcfa12aee3a7c7082
added indices
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index e8c229c..19ca901 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -1,85 +1,85 @@ class ArticlesController < ApplicationController # GET /articles # GET /articles.xml def index - @articles = @bibliome.articles.paginate(:page => params[:page], :per_page => 10) + @articles = @bibliome.articles.paginate(:page => params[:page], :per_page => 10, :include => :authors) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @articles } end end # GET /articles/1 # GET /articles/1.xml def show @article = Article.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @article } end end # GET /articles/new # GET /articles/new.xml def new @article = Article.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @article } end end # GET /articles/1/edit def edit @article = Article.find(params[:id]) end # POST /articles # POST /articles.xml def create @article = Article.new(params[:article]) respond_to do |format| if @article.save flash[:notice] = 'Article was successfully created.' format.html { redirect_to(@article) } format.xml { render :xml => @article, :status => :created, :location => @article } else format.html { render :action => "new" } format.xml { render :xml => @article.errors, :status => :unprocessable_entity } end end end # PUT /articles/1 # PUT /articles/1.xml def update @article = Article.find(params[:id]) respond_to do |format| if @article.update_attributes(params[:article]) flash[:notice] = 'Article was successfully updated.' format.html { redirect_to(@article) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @article.errors, :status => :unprocessable_entity } end end end # DELETE /articles/1 # DELETE /articles/1.xml def destroy @article = Article.find(params[:id]) @article.destroy respond_to do |format| format.html { redirect_to(articles_url) } format.xml { head :ok } end end end diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index 74c64fa..97bf65b 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -1,89 +1,89 @@ class AuthorsController < ApplicationController # GET /authors # GET /authors.xml def index @authors = @bibliome.authors.period("all").paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @authors } end end # GET /authors/1 # GET /authors/1.xml def show @author = Author.find(params[:id]) @journals = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) @coauthors = Coauthorship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:coauthor, :bibliome]) - @subjects = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total_total desc", :limit => 10, :include => [:subject, :bibliome]) + @subjects = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total_direct desc", :limit => 10, :include => [:subject, :bibliome]) @pubtypes = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @author } end end # GET /authors/new # GET /authors/new.xml def new @author = Author.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @author } end end # GET /authors/1/edit def edit @author = Author.find(params[:id]) end # POST /authors # POST /authors.xml def create @author = Author.new(params[:author]) respond_to do |format| if @author.save flash[:notice] = 'Author was successfully created.' format.html { redirect_to(@author) } format.xml { render :xml => @author, :status => :created, :location => @author } else format.html { render :action => "new" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # PUT /authors/1 # PUT /authors/1.xml def update @author = Author.find(params[:id]) respond_to do |format| if @author.update_attributes(params[:author]) flash[:notice] = 'Author was successfully updated.' format.html { redirect_to(@author) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # DELETE /authors/1 # DELETE /authors/1.xml def destroy @author = Author.find(params[:id]) @author.destroy respond_to do |format| format.html { redirect_to(authors_url) } format.xml { head :ok } end end end diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 4f8c29f..6c22084 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -1,87 +1,87 @@ class JournalsController < ApplicationController # GET /journals # GET /journals.xml def index @journals = @bibliome.journals.period("all").paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @journals } end end # GET /journals/1 # GET /journals/1.xml def show @journal = Journal.find(params[:id]) @authors = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) - @subjects = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:subject, :bibliome]) + @subjects = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "direct desc", :limit => 10, :include => [:subject, :bibliome]) @pubtypes = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @journal } end end # GET /journals/new # GET /journals/new.xml def new @journal = Journal.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @journal } end end # GET /journals/1/edit def edit @journal = Journal.find(params[:id]) end # POST /journals # POST /journals.xml def create @journal = Journal.new(params[:journal]) respond_to do |format| if @journal.save flash[:notice] = 'Journal was successfully created.' format.html { redirect_to(@journal) } format.xml { render :xml => @journal, :status => :created, :location => @journal } else format.html { render :action => "new" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # PUT /journals/1 # PUT /journals/1.xml def update @journal = Journal.find(params[:id]) respond_to do |format| if @journal.update_attributes(params[:journal]) flash[:notice] = 'Journal was successfully updated.' format.html { redirect_to(@journal) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # DELETE /journals/1 # DELETE /journals/1.xml def destroy @journal = Journal.find(params[:id]) @journal.destroy respond_to do |format| format.html { redirect_to(journals_url) } format.xml { head :ok } end end end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index ed75846..cdf98fd 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,88 +1,88 @@ class SubjectsController < ApplicationController # GET /subjects # GET /subjects.xml def index @subjects = @bibliome.subjects.period("all").paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @subjects } end end # GET /subjects/1 # GET /subjects/1.xml def show @subject = Subject.find(params[:id]) @journals = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) - @authors = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total_total desc", :limit => 10, :include => [:author, :bibliome]) + @authors = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total_direct desc", :limit => 10, :include => [:author, :bibliome]) @cosubjects = Cosubjectship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "direct desc", :limit => 10, :include => [:cosubject, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @subject } end end # GET /subjects/new # GET /subjects/new.xml def new @subject = Subject.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @subject } end end # GET /subjects/1/edit def edit @subject = Subject.find(params[:id]) end # POST /subjects # POST /subjects.xml def create @subject = Subject.new(params[:subject]) respond_to do |format| if @subject.save flash[:notice] = 'Subject was successfully created.' format.html { redirect_to(@subject) } format.xml { render :xml => @subject, :status => :created, :location => @subject } else format.html { render :action => "new" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # PUT /subjects/1 # PUT /subjects/1.xml def update @subject = Subject.find(params[:id]) respond_to do |format| if @subject.update_attributes(params[:subject]) flash[:notice] = 'Subject was successfully updated.' format.html { redirect_to(@subject) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # DELETE /subjects/1 # DELETE /subjects/1.xml def destroy @subject = Subject.find(params[:id]) @subject.destroy respond_to do |format| format.html { redirect_to(subjects_url) } format.xml { head :ok } end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1c196eb..6ffe334 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,35 +1,35 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper def page_title(title) content_for(:title) {title} end def has_chart content_for(:has_chart) {true} end def sparkline(dat) dat = [[1999, 5], [2001, 10], [2002, 3], [2006, 12]] end def count(val, type="article") content_tag(:span, "(" + pluralize(number_with_delimiter(val), type) + ")", :class => "count") end def top_neighbors(neigbors, klass) unless neigbors.blank? div = [] div.push(content_tag(:h3, "Top #{klass.pluralize.titleize}")) - count_col = ["total", "total_total"].select {|c| neigbors.first.respond_to?(c) }.first + count_col = ["direct", "total_direct", "total"].select {|c| neigbors.first.respond_to?(c) }.first li = neigbors.map {|item| content_tag(:li, link_to_item(item, klass) + " " + count(item.send(count_col)))} ol = content_tag(:ol, li.join("\n")) div.push(ol) content_tag(:div, div.join("\n"), :class => "top_neighbors", :id => "top_#{klass}") end end def link_to_item(item, klass) path_class = klass.gsub(/^co/, "") link_to(item.send(klass).to_l, send("bibliome_#{path_class}_path", item.bibliome, item.send(klass))) end end diff --git a/db/migrate/20091221210317_create_author_journals.rb b/db/migrate/20091221210317_create_author_journals.rb index e53307b..55cfcd9 100644 --- a/db/migrate/20091221210317_create_author_journals.rb +++ b/db/migrate/20091221210317_create_author_journals.rb @@ -1,20 +1,21 @@ class CreateAuthorJournals < ActiveRecord::Migration def self.up create_table :author_journals do |t| t.integer :bibliome_id t.integer :author_id t.integer :journal_id t.string :year t.integer :first, :default => 0 t.integer :last, :default => 0 t.integer :middle, :default => 0 t.integer :total, :default => 0 end add_index :author_journals, [:bibliome_id, :author_id, :year, :journal_id], :name => 'index_author_journals_on_bibliome_id_author_id_year_journal_id' - add_index :author_journals, [:bibliome_id, :journal_id, :year] + add_index :author_journals, [:bibliome_id, :journal_id, :year, :total], :name => 'index_author_journals_on_bibliome_id_journal_id_year_total' + add_index :author_journals, [:bibliome_id, :author_id, :year, :total], :name => 'index_author_journals_on_bibliome_id_author_id_year_total' end def self.down drop_table :author_journals end end diff --git a/db/migrate/20091221210427_create_author_pubtypes.rb b/db/migrate/20091221210427_create_author_pubtypes.rb index 2a69fff..8918f5e 100644 --- a/db/migrate/20091221210427_create_author_pubtypes.rb +++ b/db/migrate/20091221210427_create_author_pubtypes.rb @@ -1,20 +1,21 @@ class CreateAuthorPubtypes < ActiveRecord::Migration def self.up create_table :author_pubtypes do |t| t.integer :bibliome_id t.integer :author_id t.integer :pubtype_id t.string :year t.integer :first, :default => 0 t.integer :last, :default => 0 t.integer :middle, :default => 0 t.integer :total, :default => 0 end add_index :author_pubtypes, [:bibliome_id, :author_id, :year, :pubtype_id], :name => 'index_author_pubtypes_on_bibliome_id_author_id_year_pubtype_id' - add_index :author_pubtypes, [:bibliome_id, :pubtype_id, :year] + add_index :author_pubtypes, [:bibliome_id, :pubtype_id, :year, :total], :name => 'index_author_pubtypes_on_bibliome_id_pubtype_id_year_total' + add_index :author_pubtypes, [:bibliome_id, :author_id, :year, :total], :name => 'index_author_pubtypes_on_bibliome_id_author_id_year_total' end def self.down drop_table :author_pubtypes end end diff --git a/db/migrate/20091221210647_create_journal_pubtypes.rb b/db/migrate/20091221210647_create_journal_pubtypes.rb index 239d2d4..4fb50ea 100644 --- a/db/migrate/20091221210647_create_journal_pubtypes.rb +++ b/db/migrate/20091221210647_create_journal_pubtypes.rb @@ -1,17 +1,18 @@ class CreateJournalPubtypes < ActiveRecord::Migration def self.up create_table :journal_pubtypes do |t| t.integer :bibliome_id t.integer :journal_id t.integer :pubtype_id t.string :year t.integer :total, :default => 0 end add_index :journal_pubtypes, [:bibliome_id, :journal_id, :year, :pubtype_id], :name => 'index_journal_pubtypes_on_bibliome_journal_year_pubtype' - add_index :journal_pubtypes, [:bibliome_id, :pubtype_id, :year] + add_index :journal_pubtypes, [:bibliome_id, :pubtype_id, :year, :total], :name => 'index_journal_pubtypes_on_bibliome_id_pubtype_id_year_total' + add_index :journal_pubtypes, [:bibliome_id, :journal_id, :year, :total], :name => 'index_journal_pubtypes_on_bibliome_id_journal_id_year_total' end def self.down drop_table :journal_pubtypes end end diff --git a/db/migrate/20091221210747_create_coauthorships.rb b/db/migrate/20091221210747_create_coauthorships.rb index 3d3c527..8066eb9 100644 --- a/db/migrate/20091221210747_create_coauthorships.rb +++ b/db/migrate/20091221210747_create_coauthorships.rb @@ -1,19 +1,20 @@ class CreateCoauthorships < ActiveRecord::Migration def self.up create_table :coauthorships do |t| t.integer :bibliome_id t.integer :author_id t.integer :coauthor_id t.string :year t.integer :first, :default => 0 t.integer :last, :default => 0 t.integer :middle, :default => 0 t.integer :total, :default => 0 end add_index :coauthorships, [:bibliome_id, :author_id, :year, :coauthor_id], :name => 'index_coauthorships_on_bibliome_id_author_id_year_coauthor_id' + add_index :coauthorships, [:bibliome_id, :author_id, :year, :total], :name => 'index_coauthorships_on_bibliome_id_author_id_year_total' end def self.down drop_table :coauthorships end end diff --git a/db/migrate/20091221211045_create_journal_subjects.rb b/db/migrate/20091221211045_create_journal_subjects.rb index 63a0e09..fa4871d 100644 --- a/db/migrate/20091221211045_create_journal_subjects.rb +++ b/db/migrate/20091221211045_create_journal_subjects.rb @@ -1,19 +1,20 @@ class CreateJournalSubjects < ActiveRecord::Migration def self.up create_table :journal_subjects do |t| t.integer :bibliome_id t.integer :journal_id t.integer :subject_id t.string :year t.integer :direct, :default => 0 t.integer :descendant, :default => 0 t.integer :total, :default => 0 end add_index :journal_subjects, [:bibliome_id, :journal_id, :year, :subject_id], :name => 'index_journal_subjects_on_bibliome_journal_year_subject' - add_index :journal_subjects, [:bibliome_id, :subject_id, :year] + add_index :journal_subjects, [:bibliome_id, :subject_id, :year, :direct], :name => 'index_journal_subjects_on_bibliome_id_subject_id_year_direct' + add_index :journal_subjects, [:bibliome_id, :journal_id, :year, :direct], :name => 'index_journal_subjects_on_bibliome_id_journal_id_year_direct' end def self.down drop_table :journal_subjects end end diff --git a/db/migrate/20091221212457_create_author_subjects.rb b/db/migrate/20091221212457_create_author_subjects.rb index 0f59648..32fde17 100644 --- a/db/migrate/20091221212457_create_author_subjects.rb +++ b/db/migrate/20091221212457_create_author_subjects.rb @@ -1,28 +1,29 @@ class CreateAuthorSubjects < ActiveRecord::Migration def self.up create_table :author_subjects do |t| t.integer :bibliome_id t.integer :author_id t.integer :subject_id t.string :year t.integer :first_direct, :default => 0 t.integer :first_descendant, :default => 0 t.integer :first_total, :default => 0 t.integer :last_direct, :default => 0 t.integer :last_descendant, :default => 0 t.integer :last_total, :default => 0 t.integer :middle_direct, :default => 0 t.integer :middle_descendant, :default => 0 t.integer :middle_total, :default => 0 t.integer :total_direct, :default => 0 t.integer :total_descendant, :default => 0 t.integer :total_total, :default => 0 end add_index :author_subjects, [:bibliome_id, :author_id, :year, :subject_id], :name => 'index_author_subjects_on_bibliome_id_author_id_year_subject_id' - add_index :author_subjects, [:bibliome_id, :subject_id, :year] + add_index :author_subjects, [:bibliome_id, :subject_id, :year, :total_direct], :name => 'index_author_subjects_on_bibliome_subject_year_total_direct' + add_index :author_subjects, [:bibliome_id, :author_id, :year, :total_direct], :name => 'index_author_subjects_on_bibliome_author_year_total_direct' end def self.down drop_table :author_subjects end end diff --git a/db/migrate/20091221215134_create_cosubjectships.rb b/db/migrate/20091221215134_create_cosubjectships.rb index 6dfc337..a0c6051 100644 --- a/db/migrate/20091221215134_create_cosubjectships.rb +++ b/db/migrate/20091221215134_create_cosubjectships.rb @@ -1,18 +1,19 @@ class CreateCosubjectships < ActiveRecord::Migration def self.up create_table :cosubjectships do |t| t.integer :bibliome_id t.integer :subject_id t.integer :cosubject_id t.string :year t.integer :direct, :default => 0 t.integer :descendant, :default => 0 t.integer :total, :default => 0 end add_index :cosubjectships, [:bibliome_id, :subject_id, :year, :cosubject_id], :name => 'index_cosubjectships_on_bibliome_subject_year_cosubject' + add_index :cosubjectships, [:bibliome_id, :subject_id, :year, :direct], :name => 'index_cosubjectships_on_bibliome_subject_year_direct' end def self.down drop_table :cosubjectships end end diff --git a/db/schema.rb b/db/schema.rb index 98d2534..ce3b4d6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,304 +1,311 @@ # This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your database schema. If you need # to create the application database on another system, you should be using db:schema:load, not running # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. ActiveRecord::Schema.define(:version => 20091226023507) do create_table "article_types", :force => true do |t| t.integer "article_id" t.integer "pubtype_id" end add_index "article_types", ["article_id"], :name => "index_article_types_on_article_id" create_table "articles", :force => true do |t| t.integer "journal_id" t.date "pubdate" t.text "title" t.text "affiliation" t.string "source" t.integer "bibliomes_count", :default => 0 end add_index "articles", ["journal_id", "pubdate"], :name => "index_articles_on_journal_id_and_pubdate" add_index "articles", ["pubdate"], :name => "index_articles_on_pubdate" create_table "author_journals", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "journal_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_journals", ["bibliome_id", "author_id", "year", "journal_id"], :name => "index_author_journals_on_bibliome_id_author_id_year_journal_id" - add_index "author_journals", ["bibliome_id", "journal_id", "year"], :name => "index_author_journals_on_bibliome_id_and_journal_id_and_year" + add_index "author_journals", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_author_id_year_total" + add_index "author_journals", ["bibliome_id", "journal_id", "year", "total"], :name => "index_author_journals_on_bibliome_id_journal_id_year_total" create_table "author_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "pubtype_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "pubtype_id"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_pubtype_id" - add_index "author_pubtypes", ["bibliome_id", "pubtype_id", "year"], :name => "index_author_pubtypes_on_bibliome_id_and_pubtype_id_and_year" + add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_total" + add_index "author_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_author_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "author_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "subject_id" t.string "year" t.integer "first_direct", :default => 0 t.integer "first_descendant", :default => 0 t.integer "first_total", :default => 0 t.integer "last_direct", :default => 0 t.integer "last_descendant", :default => 0 t.integer "last_total", :default => 0 t.integer "middle_direct", :default => 0 t.integer "middle_descendant", :default => 0 t.integer "middle_total", :default => 0 t.integer "total_direct", :default => 0 t.integer "total_descendant", :default => 0 t.integer "total_total", :default => 0 end add_index "author_subjects", ["bibliome_id", "author_id", "year", "subject_id"], :name => "index_author_subjects_on_bibliome_id_author_id_year_subject_id" - add_index "author_subjects", ["bibliome_id", "subject_id", "year"], :name => "index_author_subjects_on_bibliome_id_and_subject_id_and_year" + add_index "author_subjects", ["bibliome_id", "author_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_author_year_total_direct" + add_index "author_subjects", ["bibliome_id", "subject_id", "year", "total_direct"], :name => "index_author_subjects_on_bibliome_subject_year_total_direct" create_table "authors", :force => true do |t| t.string "last_name" t.string "fore_name" t.string "initials" t.string "suffix" end add_index "authors", ["last_name", "fore_name", "initials", "suffix"], :name => "index_authors_on_last_name_fore_name_initials_suffix", :unique => true add_index "authors", ["last_name", "initials"], :name => "index_authors_on_last_name_and_initials" create_table "authorships", :force => true do |t| t.integer "article_id" t.integer "author_id" t.integer "position" t.integer "last_position" end add_index "authorships", ["article_id", "position"], :name => "index_authorships_on_article_id_and_position" add_index "authorships", ["author_id"], :name => "index_authorships_on_author_id" create_table "bibliome_articles", :force => true do |t| t.integer "bibliome_id" t.integer "article_id" t.date "pubdate" end add_index "bibliome_articles", ["bibliome_id", "pubdate", "article_id"], :name => "index_bibliome_articles_on_bibliome_id_pubdate_article_id" create_table "bibliome_authors", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_authors", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_authors_on_bibliome_id_year_articles_count" add_index "bibliome_authors", ["bibliome_id", "year", "author_id"], :name => "index_bibliome_authors_on_bibliome_id_and_year_and_author_id" create_table "bibliome_genes", :force => true do |t| t.integer "bibliome_id" t.integer "gene_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_genes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_articles_count" add_index "bibliome_genes", ["bibliome_id", "year", "gene_id"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_gene_id" create_table "bibliome_journals", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_journals", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_journals_on_bibliome_id_year_articles_count" add_index "bibliome_journals", ["bibliome_id", "year", "journal_id"], :name => "index_bibliome_journals_on_bibliome_id_and_year_and_journal_id" create_table "bibliome_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "pubtype_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_pubtypes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_pubtypes_on_bibliome_id_year_articles_count" add_index "bibliome_pubtypes", ["bibliome_id", "year", "pubtype_id"], :name => "index_bibliome_pubtypes_on_bibliome_id_and_year_and_pubtype_id" create_table "bibliome_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_subjects", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_subjects_on_bibliome_id_year_articles_count" add_index "bibliome_subjects", ["bibliome_id", "year", "subject_id"], :name => "index_bibliome_subjects_on_bibliome_id_and_year_and_subject_id" create_table "bibliomes", :force => true do |t| t.string "name" t.text "query" t.integer "articles_count", :default => 0 t.integer "all_journals_count", :default => 0 t.integer "all_authors_count", :default => 0 t.integer "all_subjects_count", :default => 0 t.integer "all_genes_count", :default => 0 t.integer "all_pubtypes_count", :default => 0 t.integer "one_journals_count", :default => 0 t.integer "one_authors_count", :default => 0 t.integer "one_subjects_count", :default => 0 t.integer "one_genes_count", :default => 0 t.integer "one_pubtypes_count", :default => 0 t.integer "five_journals_count", :default => 0 t.integer "five_authors_count", :default => 0 t.integer "five_subjects_count", :default => 0 t.integer "five_genes_count", :default => 0 t.integer "five_pubtypes_count", :default => 0 t.integer "ten_journals_count", :default => 0 t.integer "ten_authors_count", :default => 0 t.integer "ten_subjects_count", :default => 0 t.integer "ten_genes_count", :default => 0 t.integer "ten_pubtypes_count", :default => 0 t.integer "total_articles", :default => 0 t.integer "hits", :default => 0 t.boolean "built", :default => false t.datetime "started_at" t.datetime "built_at" t.datetime "delete_at" t.datetime "created_at" t.datetime "updated_at" end add_index "bibliomes", ["built", "built_at"], :name => "index_bibliomes_on_built_and_built_at" add_index "bibliomes", ["hits"], :name => "index_bibliomes_on_hits" add_index "bibliomes", ["name"], :name => "index_bibliomes_on_name", :unique => true create_table "coauthorships", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "coauthor_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "coauthorships", ["bibliome_id", "author_id", "year", "coauthor_id"], :name => "index_coauthorships_on_bibliome_id_author_id_year_coauthor_id" + add_index "coauthorships", ["bibliome_id", "author_id", "year", "total"], :name => "index_coauthorships_on_bibliome_id_author_id_year_total" create_table "cosubjectships", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.integer "cosubject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "cosubject_id"], :name => "index_cosubjectships_on_bibliome_subject_year_cosubject" + add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_cosubjectships_on_bibliome_subject_year_direct" create_table "delayed_jobs", :force => true do |t| t.integer "priority", :default => 0 t.integer "attempts", :default => 0 t.text "handler" t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" t.string "locked_by" t.datetime "created_at" t.datetime "updated_at" end create_table "journal_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "pubtype_id" t.string "year" t.integer "total", :default => 0 end add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "pubtype_id"], :name => "index_journal_pubtypes_on_bibliome_journal_year_pubtype" - add_index "journal_pubtypes", ["bibliome_id", "pubtype_id", "year"], :name => "index_journal_pubtypes_on_bibliome_id_and_pubtype_id_and_year" + add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_journal_id_year_total" + add_index "journal_pubtypes", ["bibliome_id", "pubtype_id", "year", "total"], :name => "index_journal_pubtypes_on_bibliome_id_pubtype_id_year_total" create_table "journal_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "subject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end + add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_journal_id_year_direct" add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "subject_id"], :name => "index_journal_subjects_on_bibliome_journal_year_subject" - add_index "journal_subjects", ["bibliome_id", "subject_id", "year"], :name => "index_journal_subjects_on_bibliome_id_and_subject_id_and_year" + add_index "journal_subjects", ["bibliome_id", "subject_id", "year", "direct"], :name => "index_journal_subjects_on_bibliome_id_subject_id_year_direct" create_table "journals", :force => true do |t| t.string "title" t.string "abbr" end add_index "journals", ["abbr", "title"], :name => "index_journals_on_abbr_and_title" create_table "mesh_ancestors", :force => true do |t| t.integer "subject_id" t.integer "ancestor_id" end add_index "mesh_ancestors", ["subject_id"], :name => "index_mesh_ancestors_on_subject_id" create_table "mesh_trees", :force => true do |t| t.string "tree_number" t.integer "subject_id" t.integer "parent_id" end add_index "mesh_trees", ["parent_id"], :name => "index_mesh_trees_on_parent_id" add_index "mesh_trees", ["subject_id"], :name => "index_mesh_trees_on_subject_id" add_index "mesh_trees", ["tree_number"], :name => "index_mesh_trees_on_tree_number", :unique => true create_table "pubtypes", :force => true do |t| t.string "term" end add_index "pubtypes", ["term"], :name => "index_pubtypes_on_term" create_table "subjects", :force => true do |t| t.string "term" end add_index "subjects", ["term"], :name => "index_subjects_on_term", :unique => true create_table "topics", :force => true do |t| t.integer "article_id" t.integer "subject_id" end add_index "topics", ["article_id"], :name => "index_topics_on_article_id" end
seouri/medvane3
a6294ca3c954b43e07a8ea82323ea83e67edef0c
eagerload bibliome
diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index 6128367..74c64fa 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -1,89 +1,89 @@ class AuthorsController < ApplicationController # GET /authors # GET /authors.xml def index @authors = @bibliome.authors.period("all").paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @authors } end end # GET /authors/1 # GET /authors/1.xml def show @author = Author.find(params[:id]) - @journals = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :journal) - @coauthors = Coauthorship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :coauthor) - @subjects = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total_total desc", :limit => 10, :include => :subject) - @pubtypes = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :pubtype) + @journals = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) + @coauthors = Coauthorship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:coauthor, :bibliome]) + @subjects = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total_total desc", :limit => 10, :include => [:subject, :bibliome]) + @pubtypes = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :author_id => @author.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @author } end end # GET /authors/new # GET /authors/new.xml def new @author = Author.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @author } end end # GET /authors/1/edit def edit @author = Author.find(params[:id]) end # POST /authors # POST /authors.xml def create @author = Author.new(params[:author]) respond_to do |format| if @author.save flash[:notice] = 'Author was successfully created.' format.html { redirect_to(@author) } format.xml { render :xml => @author, :status => :created, :location => @author } else format.html { render :action => "new" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # PUT /authors/1 # PUT /authors/1.xml def update @author = Author.find(params[:id]) respond_to do |format| if @author.update_attributes(params[:author]) flash[:notice] = 'Author was successfully updated.' format.html { redirect_to(@author) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @author.errors, :status => :unprocessable_entity } end end end # DELETE /authors/1 # DELETE /authors/1.xml def destroy @author = Author.find(params[:id]) @author.destroy respond_to do |format| format.html { redirect_to(authors_url) } format.xml { head :ok } end end end diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 61408ea..4f8c29f 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -1,87 +1,87 @@ class JournalsController < ApplicationController # GET /journals # GET /journals.xml def index @journals = @bibliome.journals.period("all").paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @journals } end end # GET /journals/1 # GET /journals/1.xml def show @journal = Journal.find(params[:id]) - @authors = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :author) - @subjects = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :subject) - @pubtypes = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :pubtype) + @authors = AuthorJournal.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) + @subjects = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:subject, :bibliome]) + @pubtypes = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :journal_id => @journal.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:pubtype, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @journal } end end # GET /journals/new # GET /journals/new.xml def new @journal = Journal.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @journal } end end # GET /journals/1/edit def edit @journal = Journal.find(params[:id]) end # POST /journals # POST /journals.xml def create @journal = Journal.new(params[:journal]) respond_to do |format| if @journal.save flash[:notice] = 'Journal was successfully created.' format.html { redirect_to(@journal) } format.xml { render :xml => @journal, :status => :created, :location => @journal } else format.html { render :action => "new" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # PUT /journals/1 # PUT /journals/1.xml def update @journal = Journal.find(params[:id]) respond_to do |format| if @journal.update_attributes(params[:journal]) flash[:notice] = 'Journal was successfully updated.' format.html { redirect_to(@journal) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @journal.errors, :status => :unprocessable_entity } end end end # DELETE /journals/1 # DELETE /journals/1.xml def destroy @journal = Journal.find(params[:id]) @journal.destroy respond_to do |format| format.html { redirect_to(journals_url) } format.xml { head :ok } end end end diff --git a/app/controllers/pubtypes_controller.rb b/app/controllers/pubtypes_controller.rb index e08e516..fb53ad2 100644 --- a/app/controllers/pubtypes_controller.rb +++ b/app/controllers/pubtypes_controller.rb @@ -1,87 +1,87 @@ class PubtypesController < ApplicationController # GET /pubtypes # GET /pubtypes.xml def index @pubtypes = @bibliome.pubtypes.period("all").paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @pubtypes } end end # GET /pubtypes/1 # GET /pubtypes/1.xml def show @pubtype = Pubtype.find(params[:id]) - @journals = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :journal) - @authors = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :author) + @journals = JournalPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) + @authors = AuthorPubtype.find(:all, :conditions => {:bibliome_id => @bibliome.id, :pubtype_id => @pubtype.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:author, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @pubtype } end end # GET /pubtypes/new # GET /pubtypes/new.xml def new @pubtype = Pubtype.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @pubtype } end end # GET /pubtypes/1/edit def edit @pubtype = Pubtype.find(params[:id]) end # POST /pubtypes # POST /pubtypes.xml def create @pubtype = Pubtype.new(params[:pubtype]) respond_to do |format| if @pubtype.save flash[:notice] = 'Pubtype was successfully created.' format.html { redirect_to(@pubtype) } format.xml { render :xml => @pubtype, :status => :created, :location => @pubtype } else format.html { render :action => "new" } format.xml { render :xml => @pubtype.errors, :status => :unprocessable_entity } end end end # PUT /pubtypes/1 # PUT /pubtypes/1.xml def update @pubtype = Pubtype.find(params[:id]) respond_to do |format| if @pubtype.update_attributes(params[:pubtype]) flash[:notice] = 'Pubtype was successfully updated.' format.html { redirect_to(@pubtype) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @pubtype.errors, :status => :unprocessable_entity } end end end # DELETE /pubtypes/1 # DELETE /pubtypes/1.xml def destroy @pubtype = Pubtype.find(params[:id]) @pubtype.destroy respond_to do |format| format.html { redirect_to(pubtypes_url) } format.xml { head :ok } end end end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 2d1f0bf..ed75846 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,88 +1,88 @@ class SubjectsController < ApplicationController # GET /subjects # GET /subjects.xml def index @subjects = @bibliome.subjects.period("all").paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @subjects } end end # GET /subjects/1 # GET /subjects/1.xml def show @subject = Subject.find(params[:id]) - @journals = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total desc", :limit => 10, :include => :journal) - @authors = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total_total desc", :limit => 10, :include => :author) - @cosubjects = Cosubjectship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "direct desc", :limit => 10, :include => :cosubject) + @journals = JournalSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total desc", :limit => 10, :include => [:journal, :bibliome]) + @authors = AuthorSubject.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "total_total desc", :limit => 10, :include => [:author, :bibliome]) + @cosubjects = Cosubjectship.find(:all, :conditions => {:bibliome_id => @bibliome.id, :subject_id => @subject.id, :year => "all"}, :order => "direct desc", :limit => 10, :include => [:cosubject, :bibliome]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @subject } end end # GET /subjects/new # GET /subjects/new.xml def new @subject = Subject.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @subject } end end # GET /subjects/1/edit def edit @subject = Subject.find(params[:id]) end # POST /subjects # POST /subjects.xml def create @subject = Subject.new(params[:subject]) respond_to do |format| if @subject.save flash[:notice] = 'Subject was successfully created.' format.html { redirect_to(@subject) } format.xml { render :xml => @subject, :status => :created, :location => @subject } else format.html { render :action => "new" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # PUT /subjects/1 # PUT /subjects/1.xml def update @subject = Subject.find(params[:id]) respond_to do |format| if @subject.update_attributes(params[:subject]) flash[:notice] = 'Subject was successfully updated.' format.html { redirect_to(@subject) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @subject.errors, :status => :unprocessable_entity } end end end # DELETE /subjects/1 # DELETE /subjects/1.xml def destroy @subject = Subject.find(params[:id]) @subject.destroy respond_to do |format| format.html { redirect_to(subjects_url) } format.xml { head :ok } end end end
seouri/medvane3
bf6393db1e90ee1fc0801eeac38f70efc6f9451b
make link only when there are more items to show
diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index 976db0e..fedebd1 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,34 +1,34 @@ <% page_title("Biomedical Research at a Glance") -%> <h2>Build Your Own Bibliome</h2> <% form_tag new_bibliome_path, :method => "get", :id => "pubmed_search" do %> <%= text_field_tag('q', @q, :id => "pubmed_search_q") %> <%= hidden_field_tag('count', @count, :name => nil) %> <%= submit_tag "Search PubMed", :name => nil, :disable_with => "Searching PubMed ...", :id => "pubmed_search_submit" %> <div id="sample_search"> Try these queries: <%= link_to("Rett Syndrome", new_bibliome_path(:q => "Rett Syndrome"))%> <%= link_to("plos med[jour]", new_bibliome_path(:q => "plos med[jour]"))%> </div><!-- #sample_search --> <% end -%> <% if [email protected]? -%> <h2>Recent Bibliomes</h2> <ul> <% for item in @recent -%> <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= item.total_articles %> articles, <%= age(item) %>)</span></li> <% end -%> </ul> -<%= link_to("See more recent bibliomes", recent_bibliomes_path) %> +<%= link_to("See more recent bibliomes", recent_bibliomes_path) if (@recent.size > 5) %> <% end -%> <% if [email protected]? -%> <h2>Popular Bibliomes</h2> <ul> <% for item in @popular -%> <li><%= link_to(h(item.query), bibliome_path(item))%> <span class="age">(<%= item.total_articles %> articles, <%= age(item) %>)</span></li> <% end -%> </ul> -<%= link_to("See more popular bibliomes", popular_bibliomes_path) %> +<%= link_to("See more popular bibliomes", popular_bibliomes_path) if (@popular.size > 5) %> <% end -%> \ No newline at end of file
seouri/medvane3
be0ac4d938964d5aa02cc869445ccaf47012606d
too long autogenerated index name
diff --git a/db/schema.rb b/db/schema.rb index c57b03e..98d2534 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,304 +1,304 @@ # This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your database schema. If you need # to create the application database on another system, you should be using db:schema:load, not running # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. ActiveRecord::Schema.define(:version => 20091226023507) do create_table "article_types", :force => true do |t| t.integer "article_id" t.integer "pubtype_id" end add_index "article_types", ["article_id"], :name => "index_article_types_on_article_id" create_table "articles", :force => true do |t| t.integer "journal_id" t.date "pubdate" t.text "title" t.text "affiliation" t.string "source" t.integer "bibliomes_count", :default => 0 end add_index "articles", ["journal_id", "pubdate"], :name => "index_articles_on_journal_id_and_pubdate" add_index "articles", ["pubdate"], :name => "index_articles_on_pubdate" create_table "author_journals", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "journal_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_journals", ["bibliome_id", "author_id", "year", "journal_id"], :name => "index_author_journals_on_bibliome_id_author_id_year_journal_id" add_index "author_journals", ["bibliome_id", "journal_id", "year"], :name => "index_author_journals_on_bibliome_id_and_journal_id_and_year" create_table "author_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "pubtype_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "author_pubtypes", ["bibliome_id", "author_id", "year", "pubtype_id"], :name => "index_author_pubtypes_on_bibliome_id_author_id_year_pubtype_id" add_index "author_pubtypes", ["bibliome_id", "pubtype_id", "year"], :name => "index_author_pubtypes_on_bibliome_id_and_pubtype_id_and_year" create_table "author_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "subject_id" t.string "year" t.integer "first_direct", :default => 0 t.integer "first_descendant", :default => 0 t.integer "first_total", :default => 0 t.integer "last_direct", :default => 0 t.integer "last_descendant", :default => 0 t.integer "last_total", :default => 0 t.integer "middle_direct", :default => 0 t.integer "middle_descendant", :default => 0 t.integer "middle_total", :default => 0 t.integer "total_direct", :default => 0 t.integer "total_descendant", :default => 0 t.integer "total_total", :default => 0 end add_index "author_subjects", ["bibliome_id", "author_id", "year", "subject_id"], :name => "index_author_subjects_on_bibliome_id_author_id_year_subject_id" add_index "author_subjects", ["bibliome_id", "subject_id", "year"], :name => "index_author_subjects_on_bibliome_id_and_subject_id_and_year" create_table "authors", :force => true do |t| t.string "last_name" t.string "fore_name" t.string "initials" t.string "suffix" end - add_index "authors", ["last_name", "fore_name", "initials", "suffix"], :name => "index_authors_on_last_name_and_fore_name_and_initials_and_suffix", :unique => true + add_index "authors", ["last_name", "fore_name", "initials", "suffix"], :name => "index_authors_on_last_name_fore_name_initials_suffix", :unique => true add_index "authors", ["last_name", "initials"], :name => "index_authors_on_last_name_and_initials" create_table "authorships", :force => true do |t| t.integer "article_id" t.integer "author_id" t.integer "position" t.integer "last_position" end add_index "authorships", ["article_id", "position"], :name => "index_authorships_on_article_id_and_position" add_index "authorships", ["author_id"], :name => "index_authorships_on_author_id" create_table "bibliome_articles", :force => true do |t| t.integer "bibliome_id" t.integer "article_id" t.date "pubdate" end add_index "bibliome_articles", ["bibliome_id", "pubdate", "article_id"], :name => "index_bibliome_articles_on_bibliome_id_pubdate_article_id" create_table "bibliome_authors", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_authors", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_authors_on_bibliome_id_year_articles_count" add_index "bibliome_authors", ["bibliome_id", "year", "author_id"], :name => "index_bibliome_authors_on_bibliome_id_and_year_and_author_id" create_table "bibliome_genes", :force => true do |t| t.integer "bibliome_id" t.integer "gene_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_genes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_articles_count" add_index "bibliome_genes", ["bibliome_id", "year", "gene_id"], :name => "index_bibliome_genes_on_bibliome_id_and_year_and_gene_id" create_table "bibliome_journals", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_journals", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_journals_on_bibliome_id_year_articles_count" add_index "bibliome_journals", ["bibliome_id", "year", "journal_id"], :name => "index_bibliome_journals_on_bibliome_id_and_year_and_journal_id" create_table "bibliome_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "pubtype_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_pubtypes", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_pubtypes_on_bibliome_id_year_articles_count" add_index "bibliome_pubtypes", ["bibliome_id", "year", "pubtype_id"], :name => "index_bibliome_pubtypes_on_bibliome_id_and_year_and_pubtype_id" create_table "bibliome_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.string "year" t.integer "articles_count", :default => 0 end add_index "bibliome_subjects", ["bibliome_id", "year", "articles_count"], :name => "index_bibliome_subjects_on_bibliome_id_year_articles_count" add_index "bibliome_subjects", ["bibliome_id", "year", "subject_id"], :name => "index_bibliome_subjects_on_bibliome_id_and_year_and_subject_id" create_table "bibliomes", :force => true do |t| t.string "name" t.text "query" t.integer "articles_count", :default => 0 t.integer "all_journals_count", :default => 0 t.integer "all_authors_count", :default => 0 t.integer "all_subjects_count", :default => 0 t.integer "all_genes_count", :default => 0 t.integer "all_pubtypes_count", :default => 0 t.integer "one_journals_count", :default => 0 t.integer "one_authors_count", :default => 0 t.integer "one_subjects_count", :default => 0 t.integer "one_genes_count", :default => 0 t.integer "one_pubtypes_count", :default => 0 t.integer "five_journals_count", :default => 0 t.integer "five_authors_count", :default => 0 t.integer "five_subjects_count", :default => 0 t.integer "five_genes_count", :default => 0 t.integer "five_pubtypes_count", :default => 0 t.integer "ten_journals_count", :default => 0 t.integer "ten_authors_count", :default => 0 t.integer "ten_subjects_count", :default => 0 t.integer "ten_genes_count", :default => 0 t.integer "ten_pubtypes_count", :default => 0 t.integer "total_articles", :default => 0 t.integer "hits", :default => 0 t.boolean "built", :default => false t.datetime "started_at" t.datetime "built_at" t.datetime "delete_at" t.datetime "created_at" t.datetime "updated_at" end add_index "bibliomes", ["built", "built_at"], :name => "index_bibliomes_on_built_and_built_at" add_index "bibliomes", ["hits"], :name => "index_bibliomes_on_hits" add_index "bibliomes", ["name"], :name => "index_bibliomes_on_name", :unique => true create_table "coauthorships", :force => true do |t| t.integer "bibliome_id" t.integer "author_id" t.integer "coauthor_id" t.string "year" t.integer "first", :default => 0 t.integer "last", :default => 0 t.integer "middle", :default => 0 t.integer "total", :default => 0 end add_index "coauthorships", ["bibliome_id", "author_id", "year", "coauthor_id"], :name => "index_coauthorships_on_bibliome_id_author_id_year_coauthor_id" create_table "cosubjectships", :force => true do |t| t.integer "bibliome_id" t.integer "subject_id" t.integer "cosubject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end - add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "cosubject_id"], :name => "index_cosubjectships_on_bibliome_id_subject_id_year_cosubject_id" + add_index "cosubjectships", ["bibliome_id", "subject_id", "year", "cosubject_id"], :name => "index_cosubjectships_on_bibliome_subject_year_cosubject" create_table "delayed_jobs", :force => true do |t| t.integer "priority", :default => 0 t.integer "attempts", :default => 0 t.text "handler" t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" t.string "locked_by" t.datetime "created_at" t.datetime "updated_at" end create_table "journal_pubtypes", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "pubtype_id" t.string "year" t.integer "total", :default => 0 end - add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "pubtype_id"], :name => "index_journal_pubtypes_on_bibliome_id_journal_id_year_pubtype_id" + add_index "journal_pubtypes", ["bibliome_id", "journal_id", "year", "pubtype_id"], :name => "index_journal_pubtypes_on_bibliome_journal_year_pubtype" add_index "journal_pubtypes", ["bibliome_id", "pubtype_id", "year"], :name => "index_journal_pubtypes_on_bibliome_id_and_pubtype_id_and_year" create_table "journal_subjects", :force => true do |t| t.integer "bibliome_id" t.integer "journal_id" t.integer "subject_id" t.string "year" t.integer "direct", :default => 0 t.integer "descendant", :default => 0 t.integer "total", :default => 0 end - add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "subject_id"], :name => "index_journal_subjects_on_bibliome_id_journal_id_year_subject_id" + add_index "journal_subjects", ["bibliome_id", "journal_id", "year", "subject_id"], :name => "index_journal_subjects_on_bibliome_journal_year_subject" add_index "journal_subjects", ["bibliome_id", "subject_id", "year"], :name => "index_journal_subjects_on_bibliome_id_and_subject_id_and_year" create_table "journals", :force => true do |t| t.string "title" t.string "abbr" end add_index "journals", ["abbr", "title"], :name => "index_journals_on_abbr_and_title" create_table "mesh_ancestors", :force => true do |t| t.integer "subject_id" t.integer "ancestor_id" end add_index "mesh_ancestors", ["subject_id"], :name => "index_mesh_ancestors_on_subject_id" create_table "mesh_trees", :force => true do |t| t.string "tree_number" t.integer "subject_id" t.integer "parent_id" end add_index "mesh_trees", ["parent_id"], :name => "index_mesh_trees_on_parent_id" add_index "mesh_trees", ["subject_id"], :name => "index_mesh_trees_on_subject_id" add_index "mesh_trees", ["tree_number"], :name => "index_mesh_trees_on_tree_number", :unique => true create_table "pubtypes", :force => true do |t| t.string "term" end add_index "pubtypes", ["term"], :name => "index_pubtypes_on_term" create_table "subjects", :force => true do |t| t.string "term" end add_index "subjects", ["term"], :name => "index_subjects_on_term", :unique => true create_table "topics", :force => true do |t| t.integer "article_id" t.integer "subject_id" end add_index "topics", ["article_id"], :name => "index_topics_on_article_id" end
seouri/medvane3
afbf46c6b0a26682b5e8753a5bab9882744624c2
too long autogenerated index name
diff --git a/db/migrate/20091215164444_create_authors.rb b/db/migrate/20091215164444_create_authors.rb index 44bc97b..ac556ad 100644 --- a/db/migrate/20091215164444_create_authors.rb +++ b/db/migrate/20091215164444_create_authors.rb @@ -1,16 +1,16 @@ class CreateAuthors < ActiveRecord::Migration def self.up create_table :authors do |t| t.string :last_name t.string :fore_name t.string :initials t.string :suffix end - add_index :authors, [:last_name, :fore_name, :initials, :suffix], :unique => true + add_index :authors, [:last_name, :fore_name, :initials, :suffix], :unique => true, :name => 'index_authors_on_last_name_fore_name_initials_suffix' add_index :authors, [:last_name, :initials] end def self.down drop_table :authors end end diff --git a/db/migrate/20091221210647_create_journal_pubtypes.rb b/db/migrate/20091221210647_create_journal_pubtypes.rb index 1b7df1a..239d2d4 100644 --- a/db/migrate/20091221210647_create_journal_pubtypes.rb +++ b/db/migrate/20091221210647_create_journal_pubtypes.rb @@ -1,17 +1,17 @@ class CreateJournalPubtypes < ActiveRecord::Migration def self.up create_table :journal_pubtypes do |t| t.integer :bibliome_id t.integer :journal_id t.integer :pubtype_id t.string :year t.integer :total, :default => 0 end - add_index :journal_pubtypes, [:bibliome_id, :journal_id, :year, :pubtype_id], :name => 'index_journal_pubtypes_on_bibliome_id_journal_id_year_pubtype_id' + add_index :journal_pubtypes, [:bibliome_id, :journal_id, :year, :pubtype_id], :name => 'index_journal_pubtypes_on_bibliome_journal_year_pubtype' add_index :journal_pubtypes, [:bibliome_id, :pubtype_id, :year] end def self.down drop_table :journal_pubtypes end end diff --git a/db/migrate/20091221215134_create_cosubjectships.rb b/db/migrate/20091221215134_create_cosubjectships.rb index 91a81c3..6dfc337 100644 --- a/db/migrate/20091221215134_create_cosubjectships.rb +++ b/db/migrate/20091221215134_create_cosubjectships.rb @@ -1,18 +1,18 @@ class CreateCosubjectships < ActiveRecord::Migration def self.up create_table :cosubjectships do |t| t.integer :bibliome_id t.integer :subject_id t.integer :cosubject_id t.string :year t.integer :direct, :default => 0 t.integer :descendant, :default => 0 t.integer :total, :default => 0 end - add_index :cosubjectships, [:bibliome_id, :subject_id, :year, :cosubject_id], :name => 'index_cosubjectships_on_bibliome_id_subject_id_year_cosubject_id' + add_index :cosubjectships, [:bibliome_id, :subject_id, :year, :cosubject_id], :name => 'index_cosubjectships_on_bibliome_subject_year_cosubject' end def self.down drop_table :cosubjectships end end
seouri/medvane3
08480d8c21a89d3ee69366aa940b3cbf09140dc9
too long autogenerated index name
diff --git a/db/migrate/20091221211045_create_journal_subjects.rb b/db/migrate/20091221211045_create_journal_subjects.rb index 7aab8bd..63a0e09 100644 --- a/db/migrate/20091221211045_create_journal_subjects.rb +++ b/db/migrate/20091221211045_create_journal_subjects.rb @@ -1,19 +1,19 @@ class CreateJournalSubjects < ActiveRecord::Migration def self.up create_table :journal_subjects do |t| t.integer :bibliome_id t.integer :journal_id t.integer :subject_id t.string :year t.integer :direct, :default => 0 t.integer :descendant, :default => 0 t.integer :total, :default => 0 end - add_index :journal_subjects, [:bibliome_id, :journal_id, :year, :subject_id], :name => 'index_journal_subjects_on_bibliome_id_journal_id_year_subject_id' + add_index :journal_subjects, [:bibliome_id, :journal_id, :year, :subject_id], :name => 'index_journal_subjects_on_bibliome_journal_year_subject' add_index :journal_subjects, [:bibliome_id, :subject_id, :year] end def self.down drop_table :journal_subjects end end
seouri/medvane3
ec0ad47c0885eed510c26a2be6589eb96325074c
set period
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b59cec3..351490c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,24 +1,32 @@ # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base - before_filter :find_bibliome + before_filter :find_bibliome, :set_period helper :all # include all helpers, all the time helper_method :is_iphone_request? protect_from_forgery # See ActionController::RequestForgeryProtection for details # Scrub sensitive parameters from your log # filter_parameter_logging :password def is_iphone_request? request.user_agent =~ /(Mobile\/.+Safari)/ end private def find_bibliome if params[:bibliome_id] @bibliome = Bibliome.find(params[:bibliome_id]) @bibliome.hit! end end + + def set_period + if ["one", "five", "ten", "all"].include?(params[:period]) + @period = params[:period] + else + @period = "all" + end + end end
seouri/medvane3
251812edcc7b5e81b934ea50684e11af16ac4428
process 500 articles per job
diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index 506d6ce..faf610d 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,221 +1,221 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) - RETMAX = 1000 + RETMAX = 500 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") unless medline.size > 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| unless article_ids.include?(m.pmid.to_i) # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} pubtypes = m.pt.map {|p| Pubtype.find_by_term(p)} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end # bibliome_journals periods.each do |year| bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end bibliome.articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) if bibliome.articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end
seouri/medvane3
d055f5b0a69aa9ec5297fc33d9ade7b820e96550
make compatible with postgresql
diff --git a/app/models/bibliome_author.rb b/app/models/bibliome_author.rb index 2c56023..eef2c58 100644 --- a/app/models/bibliome_author.rb +++ b/app/models/bibliome_author.rb @@ -1,10 +1,10 @@ class BibliomeAuthor < ActiveRecord::Base belongs_to :bibliome belongs_to :author validates_uniqueness_of :author_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| - { :conditions => { :year => range }, :order => "`articles_count` desc"} + { :conditions => { :year => range }, :order => "articles_count desc"} } end diff --git a/app/models/bibliome_gene.rb b/app/models/bibliome_gene.rb index 3cea794..4168e8e 100644 --- a/app/models/bibliome_gene.rb +++ b/app/models/bibliome_gene.rb @@ -1,10 +1,10 @@ class BibliomeGene < ActiveRecord::Base belongs_to :bibliome belongs_to :genes validates_uniqueness_of :gene_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| - { :conditions => { :year => range }, :order => "`articles_count` desc"} + { :conditions => { :year => range }, :order => "articles_count desc"} } end diff --git a/app/models/bibliome_journal.rb b/app/models/bibliome_journal.rb index e04657b..77b443f 100644 --- a/app/models/bibliome_journal.rb +++ b/app/models/bibliome_journal.rb @@ -1,13 +1,13 @@ class BibliomeJournal < ActiveRecord::Base belongs_to :bibliome belongs_to :journal has_many :author_journals has_many :journal_subjects has_many :journal_pubtypes validates_uniqueness_of :journal_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| - { :conditions => { :year => range }, :order => "`articles_count` desc"} + { :conditions => { :year => range }, :order => "articles_count desc"} } end diff --git a/app/models/bibliome_pubtype.rb b/app/models/bibliome_pubtype.rb index b9dffb8..296755b 100644 --- a/app/models/bibliome_pubtype.rb +++ b/app/models/bibliome_pubtype.rb @@ -1,10 +1,10 @@ class BibliomePubtype < ActiveRecord::Base belongs_to :bibliome belongs_to :pubtype validates_uniqueness_of :pubtype_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| - { :conditions => { :year => range }, :order => "`articles_count` desc"} + { :conditions => { :year => range }, :order => "articles_count desc"} } end diff --git a/app/models/bibliome_subject.rb b/app/models/bibliome_subject.rb index d8c1089..afe4f43 100644 --- a/app/models/bibliome_subject.rb +++ b/app/models/bibliome_subject.rb @@ -1,10 +1,10 @@ class BibliomeSubject < ActiveRecord::Base belongs_to :bibliome belongs_to :subject validates_uniqueness_of :subject_id, :scope => [:bibliome_id, :year] named_scope :period, lambda {|range| - { :conditions => { :year => range }, :order => "`articles_count` desc"} + { :conditions => { :year => range }, :order => "articles_count desc"} } end
seouri/medvane3
ac19e12df19d52b798ee889a5b6f35b0a6aed96a
the current bibliome object is not up-to-date with articles_count. recalculate first, then compare with total_articles
diff --git a/lib/pubmed_import.rb b/lib/pubmed_import.rb index 05ab8c3..506d6ce 100644 --- a/lib/pubmed_import.rb +++ b/lib/pubmed_import.rb @@ -1,220 +1,221 @@ require 'cgi' require 'net/http' require 'uri' require 'medline' # 1. get 5000 PMIDs for a given search # 2. select PMIDs not in Article # 3. fetch articles in step 2 in MEDLINE format # 4. repeat 1-3 until all articles are received class PubmedImport < Struct.new(:bibliome_id, :webenv, :retstart) RETMAX = 1000 ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60 FIVE_YEARS_IN_SECONDS = 5 * ONE_YEAR_IN_SECONDS TEN_YEARS_IN_SECONDS = 10 * ONE_YEAR_IN_SECONDS def perform bibliome = Bibliome.find(bibliome_id) bibliome.started_at ||= Time.now # timestamp only once! bibliome.save! article_ids = bibliome.article_ids medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") unless medline.size > 0 # webenv expired webenv, count = Medvane::Eutils.esearch(bibliome.query) medline = Medvane::Eutils.efetch(webenv, retstart, RETMAX, "medline") if count > bibliome.total_articles bibliome.total_articles = count bibliome.save! end end medline.each do |m| unless article_ids.include?(m.pmid.to_i) # do this way rather than medline.reject!{...}.each to save memory # http://www.nlm.nih.gov/bsd/mms/medlineelements.html a = Article.find_or_initialize_by_id(m.pmid) periods = periods(m.pubdate) journal = Journal.find_or_create_by_abbr_and_title(m.ta, m.jt) subjects = m.major_descriptors.map {|d| Subject.find_by_term(d)} ancestors = subjects.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s)} pubtypes = m.pt.map {|p| Pubtype.find_by_term(p)} authors = m.authors.map {|u| Author.find_or_create_by_last_name_and_fore_name_and_initials_and_suffix(u['last_name'], u['fore_name'], u['initials'], u['suffix'])} genes = [] # article if a.new_record? a.journal = journal a.pubdate = m.pubdate a.title = m.ti a.affiliation = m.ad a.source = m.source a.save! subjects.each do |s| a.subjects<<(s) end pubtypes.each do |p| a.pubtypes<<(p) end last_position = authors.size authors.each_index do |i| position = i + 1 authors[i].authorships.create!( :article => a, :position => position, :last_position => last_position ) end a.save! end # bibliome_journals periods.each do |year| bj = BibliomeJournal.find_or_initialize_by_bibliome_id_and_year_and_journal_id(bibliome.id, year, journal.id) bj.increment!(:articles_count) authors.each_index do |i| author = authors[i] position = position_name(i + 1, authors.size) #bibliome.author_journals aj = AuthorJournal.find_or_initialize_by_bibliome_id_and_author_id_and_journal_id_and_year(bibliome.id, author.id, journal.id, year) aj.increment(position) aj.increment(:total) aj.save! #bibliome.coauthorships authors.select {|c| c.id != author.id}.each do |coauthor| ca = Coauthorship.find_or_initialize_by_bibliome_id_and_author_id_and_coauthor_id_and_year(bibliome.id, author.id, coauthor.id, year) ca.increment(position) ca.increment(:total) ca.save! end #bibliome.author_subjects subjects.each do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_direct", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end ## author_subject descendant ancestors.try(:each) do |subject| as = AuthorSubject.find_or_initialize_by_bibliome_id_and_author_id_and_subject_id_and_year(bibliome.id, author.id, subject.id, year) ["_descendant", "_total"].each do |stype| as.increment(position + stype) as.increment("total" + stype) as.save! end end #bibliome.author_pubtypes pubtypes.each do |pubtype| ap = AuthorPubtype.find_or_initialize_by_bibliome_id_and_author_id_and_pubtype_id_and_year(bibliome.id, author.id, pubtype.id, year) ap.increment(position) ap.increment(:total) ap.save! end # bibliome_authors ## TODO: distinguish first/last/middle/total x one/five/ten/all ba = BibliomeAuthor.find_or_initialize_by_bibliome_id_and_year_and_author_id(bibliome.id, year, author.id) ba.increment!(:articles_count) end #bibliome.journal_pubtypes pubtypes.each do |pubtype| jp = JournalPubtype.find_or_initialize_by_bibliome_id_and_journal_id_and_pubtype_id_and_year(bibliome.id, journal.id, pubtype.id, year) jp.increment!(:total) # bibliome_pubtypes bp = BibliomePubtype.find_or_initialize_by_bibliome_id_and_year_and_pubtype_id(bibliome.id, year, pubtype.id) bp.increment!(:articles_count) end #bibliome.journal_subject subjects.each do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, year) js.increment(:direct) js.increment(:total) js.save! #bibliome.cosubjects subjects.reject {|s| s.id == subject.id}.each do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:direct) cs.increment(:total) cs.save! end #cosubjectst descendant subjects.reject {|s| s.id == subject.id}.map {|s| s.ancestors}.flatten.uniq.reject! {|s| subjects.include?(s) || (subject.id == s.id)}.try(:each) do |cosubject| cs = Cosubjectship.find_or_initialize_by_bibliome_id_and_subject_id_and_cosubject_id_and_year(bibliome.id, subject.id, cosubject.id, year) cs.increment(:descendant) cs.increment(:total) cs.save! end # bibliome_subjects # TODO: update schema to distinguish direct/descendant bs = BibliomeSubject.find_or_initialize_by_bibliome_id_and_year_and_subject_id(bibliome.id, year, subject.id) bs.increment!(:articles_count) end ## journal_subject descendant ancestors.try(:each) do |subject| js = JournalSubject.find_or_initialize_by_bibliome_id_and_journal_id_and_subject_id_and_year(bibliome.id, journal.id, subject.id, m.year) js.increment(:descendant) js.increment(:total) js.save! # bibliome_subjects descendants # TODO: update schema to distinguish direct/descendant ## one, five, ten end end BibliomeArticle.find_or_create_by_bibliome_id_and_article_id_and_pubdate(bibliome.id, a.id, a.pubdate) bibliome.save! end end ["all", "one", "five", "ten"].each do |period| ["journals", "authors", "subjects", "pubtypes"].each do |obj| #TODO: genes col = "#{period}_#{obj}_count" val = bibliome.send(obj).period(period).count bibliome.update_attribute(col, val) end end - if bibliome.articles_count == bibliome.total_article + bibliome.articles_count = BibliomeArticle.count('id', :conditions => {:bibliome_id => bibliome.id}) + if bibliome.articles_count == bibliome.total_articles bibliome.built = true bibliome.built_at = Time.now bibliome.delete_at = 2.weeks.from_now bibliome.save! end end def position_name(position, last_position) if position == 1 return "first" elsif position > 1 && position == last_position return "last" else return "middle" end end def periods(pubdate) article_age = (Time.now.to_time - pubdate.to_time).round article_age = 0 if article_age < 0 periods = [pubdate[0, 4], "all"] periods.push("one") if article_age <= ONE_YEAR_IN_SECONDS periods.push("five") if article_age <= FIVE_YEARS_IN_SECONDS periods.push("ten") if article_age <= TEN_YEARS_IN_SECONDS return periods end end
elvisphilipn/RealTimeCygWin
f40277e3baea30f1aeeb85bb01a95454c6ef06dc
Uploaded final code
diff --git a/SEG4145_Assignment4.c b/SEG4145_Assignment4.c index c94a265..de37073 100644 --- a/SEG4145_Assignment4.c +++ b/SEG4145_Assignment4.c @@ -1,169 +1,428 @@ +/* + * Ahmed Ben Messaoud - 4291509 + * Elvis-Philip Niyonkuru - 3441001 + */ + /* ********************************************************************************************************* * uC/OS-II * The Real-Time Kernel * * SEG4145: Real-Time and Embedded System Design * * Assignment #4 Skeleton * * (c) Copyright 2010- Stejarel C. Veres, [email protected] * Portions adapted after Jean J. Labrosse * * As is, this program will create a main (startup) task which will in turn * spawn two children. One of them will count odd numbers, the other - even ones. ********************************************************************************************************* */ #include "includes.h" /* ********************************************************************************************************* * CONSTANTS ********************************************************************************************************* */ -#define TASK_STK_SIZE 512 /* Size of start task's stacks */ -#define TASK_START_PRIO 0 /* Priority of your startup task */ -#define N_TASKS 2 /* Number of (child) tasks to spawn */ +#define TASK_STK_SIZE 512 /* Size of start task's stacks */ +#define TASK_START_PRIO 0 /* Priority of your startup task */ +#define TASK_MOTORS_PRIO 1 /* Priority of your motors task */ +#define TASK_DISPLAY_PRIO 2 /* Priority of your display task */ +#define Q_SIZE 10 /* The length of the queue */ + +enum MotorEnum { MoveForward, MoveBackward, Turn90CW, Turn90CCW, + Stopped, PerformCircle, ChangeDirection, IncreaseRadius }; /* ********************************************************************************************************* * VARIABLES ********************************************************************************************************* */ -OS_STK TaskStartStk[TASK_STK_SIZE]; /* Start task's stack */ -OS_STK TaskStk[N_TASKS][TASK_STK_SIZE]; /* Stacks for other (child) tasks */ -INT8U TaskData[N_TASKS]; /* Parameters to pass to each task */ +INT8U Mode; /* The current mode of the robot */ +INT8U Direction; /* The current direction of the robot */ +OS_STK TaskStartStk[TASK_STK_SIZE]; /* Start task's stack */ +OS_STK TaskMotorsStk[TASK_STK_SIZE]; /* Motors task stack */ +OS_STK TaskDisplayStk[TASK_STK_SIZE]; /* Motors task stack */ + +/* Queue Events Pointers */ +OS_EVENT *MotorsEvent; +OS_EVENT *DisplayEvent; + +/* Semaphores */ +OS_EVENT *SemMode; +OS_EVENT *SemDirection; + +/* Message Queues */ +void *MessageStorageMotors[Q_SIZE]; +void *MessageStorageDisplay[Q_SIZE]; /* ********************************************************************************************************* * FUNCTION PROTOTYPES ********************************************************************************************************* */ -void TaskStart(void *data); /* Startup task */ -static void TaskStartCreateTasks(void); /* Will be used to create all the child tasks */ -void Task(void*); /* The body of each child task */ +void TaskStart(void *data); /* Startup task */ +void TaskMotors(void *data); /* Motors task */ +void TaskDisplay(void *data); /* Display task */ +void SW0Pressed(); +void SW1Pressed(); +void SW2Pressed(); +void SW3Pressed(); +static void testResult(INT8U result); +static void sendMessage(OS_EVENT *event, const INT8U msg); +void Motors(INT8U action); +void Lcd(INT8U action, INT8U mode); +void SevSegDisplay(INT8U mode); +void Led(INT8U action); /* ********************************************************************************************************* * MAIN FUNCTION ********************************************************************************************************* */ int main(void) { OSInit(); /* Initialize uC/OS-II */ /* * Create and initialize any semaphores, mailboxes etc. here */ - OSTaskCreate(TaskStart, (void *) 0, - &TaskStartStk[TASK_STK_SIZE - 1], TASK_START_PRIO); /* Create the startup task */ + MotorsEvent = OSQCreate((void**)&MessageStorageMotors, Q_SIZE); /* Motors Queue Initialize */ + DisplayEvent = OSQCreate((void**)&MessageStorageDisplay, Q_SIZE); /* Display Queue Initialize */ + + SemMode = OSSemCreate(1); + SemDirection = OSSemCreate(1); + + if( !MotorsEvent && !DisplayEvent) + { + printf("Unable to create queues\n"); + exit(0); + } + + OSTaskCreate(TaskStart, NULL, + &TaskStartStk[TASK_STK_SIZE - 1], TASK_START_PRIO); /* Create the startup task */ OSStart(); /* Start multitasking */ return 0; } /* ********************************************************************************************************* * STARTUP TASK ********************************************************************************************************* */ void TaskStart(void *pdata) -{ INT16S key; +{ pdata = pdata; /* Prevent compiler warning */ #if OS_TASK_STAT_EN OSStatInit(); /* Initialize uC/OS-II's statistics */ #endif /* * Display version information */ printf("Startup (Main) Task:\n"); printf("--------------------\n"); printf("Running under uC/OS-II V%4.2f (with WIN32 port V%4.2f).\n", ((FP32) OSVersion())/100, ((FP32)OSPortVersion())/100); - printf("Press the Escape key to stop.\n\n"); + + /* + * Spawn Motor and Display Tasks + */ + testResult(OSTaskCreate(TaskMotors, NULL, + &TaskMotorsStk[TASK_STK_SIZE - 1], TASK_MOTORS_PRIO)); /* Create the Motors task */ + + testResult(OSTaskCreate(TaskDisplay, NULL, + &TaskDisplayStk[TASK_STK_SIZE - 1], TASK_DISPLAY_PRIO)); /* Create the Display task */ + + printf("Press the Escape key to stop.\n\n"); /* - * Here we create all other tasks (threads) + * Check input characters */ - TaskStartCreateTasks(); + INT16S key; + while (1) /* Startup task's infinite loop */ + { + if (PC_GetKey(&key) == TRUE) { /* See if key has been pressed */ + switch(key) + { + case 0x30: + SW0Pressed(); + break; + case 0x31: + SW1Pressed(); + break; + case 0x32: + SW2Pressed(); + break; + case 0x33: + SW3Pressed(); + break; + case 0x1B: + exit(0); + break; + default: + break; + } + } + + /* + * Don't forget to call the uC/OS-II scheduler with OSTimeDly(), + * to give other tasks a chance to run + */ + + OSTimeDly(10); /* Wait 10 ticks */ + } +} - while (1) /* Startup task's infinite loop */ - { - /* - * Place additional code for your startup task here - * or before the loop, as needed - */ - - if (PC_GetKey(&key) == TRUE) { /* See if key has been pressed */ - if (key == 0x1B) { /* If yes, see if it's the ESCAPE key */ - exit(0); /* End program */ - } - } - - /* - * Don't forget to call the uC/OS-II scheduler with OSTimeDly(), - * to give other tasks a chance to run - */ - - OSTimeDly(10); /* Wait 10 ticks */ - } +void SW0Pressed() +{ + if(!Mode) + { + // Mode 1 + // Send to the Motor + sendMessage(MotorsEvent, MoveForward); + + // Send to the Display + sendMessage(DisplayEvent, MoveForward); + } + else + { + // Mode 2 + // No resource is updated + } +} + +void SW1Pressed() +{ + if(!Mode) + { + // Mode 1 + // Send to the Motor + sendMessage(MotorsEvent, MoveBackward); + + // Send to the Display + sendMessage(DisplayEvent, MoveBackward); + } + else + { + // Mode 2 + // Changing Direction of Circle + INT8U err; + OSSemPend(SemDirection, 0, &err); + Direction = !Direction; + OSSemPost(SemDirection); + } +} + +void SW2Pressed() +{ + if(!Mode) + { + // Mode 1 + // Send to the Motor + sendMessage(MotorsEvent, Turn90CW); + + // Send to the Display + sendMessage(DisplayEvent, Turn90CW); + } + else + { + // Mode 2 + // Send to the Motor + sendMessage(MotorsEvent, PerformCircle); + + // Send to the Display + sendMessage(DisplayEvent, PerformCircle); + } +} + +void SW3Pressed() +{ + INT8U err; + + OSSemPend(SemMode, 0, &err); + Mode = !Mode; + OSSemPost(SemMode); + + sendMessage(DisplayEvent, Stopped); +} + +static void testResult(INT8U result) +{ + switch(result) + { + case OS_ERR_NONE: + return; + case OS_ERR_Q_FULL: + printf("OS_ERR_Q_FULL"); + break; + case OS_ERR_EVENT_TYPE: + printf("OS_ERR_EVENT_TYPE"); + break; + case OS_ERR_PEVENT_NULL: + printf("OS_ERR_PEVENT_NULL"); + break; + default: + printf("An Error Occurred - %uu", result); + } + exit(0); +} + +static void sendMessage(OS_EVENT *event, const INT8U msg) +{ + INT8U *msgNew = malloc(sizeof(INT8U)); + *msgNew = msg; + + // Send to device + testResult(OSQPost(event, (void*)msgNew)); } /* ********************************************************************************************************* -* CREATE TASKS +* Motors ********************************************************************************************************* */ +void TaskMotors(void *pdata) +{ + printf("Startup (Motors) Task\n"); + INT8U *msg = NULL; + INT8U err; + while(1) + { + // blocking operation, waits until an msg is available + msg = OSQPend(MotorsEvent, 0, &err); + + // Send to motors resource + Motors((INT8U)*msg); + + // free the string + free(msg); + } +} -static void TaskStartCreateTasks(void) +/* +********************************************************************************************************* +* Display +********************************************************************************************************* +*/ +void TaskDisplay(void *pdata) { - INT8U i; - INT8U prio; - - for (i = 0; i < N_TASKS; i++) { - prio = i + 1; - TaskData[i] = prio; - OSTaskCreateExt(Task, - (void *) &TaskData[i], - &TaskStk[i][TASK_STK_SIZE - 1], - prio, - 0, - &TaskStk[i][0], - TASK_STK_SIZE, - (void *) 0, - OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR | OS_TASK_OPT_SAVE_FP); - } + printf("Startup (Display) Task\n\n"); + INT8U *msg = NULL; + INT8U err; + while(1) + { + // blocking operation, waits until an msg is available + msg = OSQPend(DisplayEvent, 0, &err); + + // Send to all display resource + OSSemPend(SemMode, 0, &err); + Lcd( (INT8U)*msg, Mode ); + SevSegDisplay(Mode); + Led( (INT8U)*msg ); + OSSemPost(SemMode); + } } /* ********************************************************************************************************* -* TASKS +* Resources ********************************************************************************************************* */ +void Motors(INT8U action) +{ + switch(action) + { + case MoveForward: + printf("[Motor Subsystem] - Moving Forward\n"); + break; + case MoveBackward: + printf("[Motor Subsystem] - Moving Backward\n"); + break; + case Turn90CW: + printf("[Motor Subsystem] - Turning 90 degrees Clockwise\n"); + break; + case Turn90CCW: + printf("[Motor Subsystem] - Turning 90 degrees Counter Clockwise\n"); + break; + case PerformCircle: + printf("[Motor Subsystem] - Performing Circle\n"); + OSTimeDly(300); /* Longer delay for the circle */ + break; + } + + OSTimeDly(100); /* Wait 100 ticks */ + printf("[Motor Subsystem] - Motors Stopped\n"); + sendMessage(DisplayEvent, Stopped); /* Send Message to Display */ +} -void Task(void *pdata) +void Lcd(INT8U action, INT8U mode) { - INT8U whoami = *(int*) pdata; - INT8U counter = whoami % 2; + printf("[Display Subsystem] LCD Resource Display - Line 1 - Mode = %d\n", mode+1); + printf("[Display Subsystem] LCD Resource Display - Line 2 - "); + switch(action) + { + case MoveForward: + printf("Moving FWD\n"); + break; + case MoveBackward: + printf("Moving BK\n"); + break; + case Turn90CW: + printf("Turning CW\n"); + break; + case Turn90CCW: + printf("Turning Turning CCW\n"); + break; + case Stopped: + printf("Stopped\n"); + break; + case PerformCircle: + printf("Performing Circle\n"); + break; + } +} - while (1) { - printf("I am task #%d and my counter is at %d.\n", - whoami, counter); - counter += 2; +void SevSegDisplay(INT8U mode) +{ + printf("[Display Subsystem] Seven Segment Resource Display - %d\n", mode+1); +} - OSTimeDly(50); - } +void Led(INT8U action) +{ + printf("[Display Subsystem] LED Resource Display - "); + + switch(action) + { + case MoveForward: + printf("01010101\n"); + break; + case MoveBackward: + printf("11001100\n"); + break; + case Turn90CW: + printf("00111100\n"); + break; + case Turn90CCW: + printf("11000011\n"); + break; + case Stopped: + printf("00000000\n"); + break; + } }
elvisphilipn/RealTimeCygWin
e157a26a100f87cea64215e8f382e5c4dbd29874
Added Eclipse project files so that it can build properly in Eclipse
diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..5af0820 --- /dev/null +++ b/.cproject @@ -0,0 +1,673 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?> + +<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> +<storageModule moduleId="org.eclipse.cdt.core.settings"> +<cconfiguration id="0.1324855428"> +<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1324855428" moduleId="org.eclipse.cdt.core.settings" name="Default"> +<externalSettings/> +<extensions> +<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +</extensions> +</storageModule> +<storageModule moduleId="cdtBuildSystem" version="4.0.0"> +<configuration artifactName="Ass4" buildProperties="" description="" id="0.1324855428" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg"> +<folderInfo id="0.1324855428." name="/" resourcePath=""> +<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.192661419" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> +<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.192661419.1781016255" name=""/> +<builder arguments="-f ./makefile" buildPath="${workspace_loc:/Ass4}" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.792069179" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> +<tool id="org.eclipse.cdt.build.core.settings.holder.libs.698363853" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> +<tool id="org.eclipse.cdt.build.core.settings.holder.892104188" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.2103270160" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +<tool id="org.eclipse.cdt.build.core.settings.holder.701705579" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.387408560" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +<tool id="org.eclipse.cdt.build.core.settings.holder.299194190" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.935909472" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +</toolChain> +</folderInfo> +</configuration> +</storageModule> +<storageModule moduleId="scannerConfiguration"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<scannerConfigBuildInfo instanceId="0.1324855428"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +</scannerConfigBuildInfo> +</storageModule> +<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> +<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> +<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> +<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"> +<buildTargets> +<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f ./makefile</buildArguments> +<buildTarget>clean</buildTarget> +<stopOnError>true</stopOnError> +<useDefaultCommand>true</useDefaultCommand> +<runAllBuilders>true</runAllBuilders> +</target> +<target name="mrproper" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f ./makefile</buildArguments> +<buildTarget>mrproper</buildTarget> +<stopOnError>true</stopOnError> +<useDefaultCommand>true</useDefaultCommand> +<runAllBuilders>true</runAllBuilders> +</target> +</buildTargets> +</storageModule> +</cconfiguration> +<cconfiguration id="0.1324855428.824675287"> +<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1324855428.824675287" moduleId="org.eclipse.cdt.core.settings" name="clean"> +<externalSettings/> +<extensions> +<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +</extensions> +</storageModule> +<storageModule moduleId="cdtBuildSystem" version="4.0.0"> +<configuration artifactName="Ass4" buildProperties="" description="Cleans object and backup files" id="0.1324855428.824675287" name="clean" parent="org.eclipse.cdt.build.core.prefbase.cfg"> +<folderInfo id="0.1324855428.824675287." name="/" resourcePath=""> +<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1385041927" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> +<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1385041927.2109187053" name=""/> +<builder arguments="-f ./makefile" buildPath="${workspace_loc:/Ass4}" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.309190476" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> +<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1844155560" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> +<tool id="org.eclipse.cdt.build.core.settings.holder.1855021610" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.536739031" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +<tool id="org.eclipse.cdt.build.core.settings.holder.343808727" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1120429344" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +<tool id="org.eclipse.cdt.build.core.settings.holder.2098738887" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.867008690" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +</toolChain> +</folderInfo> +</configuration> +</storageModule> +<storageModule moduleId="scannerConfiguration"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<scannerConfigBuildInfo instanceId="0.1324855428"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +</scannerConfigBuildInfo> +</storageModule> +<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> +<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> +<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> +<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"> +<buildTargets> +<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f ./makefile</buildArguments> +<buildTarget>clean</buildTarget> +<stopOnError>true</stopOnError> +<useDefaultCommand>true</useDefaultCommand> +<runAllBuilders>true</runAllBuilders> +</target> +<target name="mrproper" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f ./makefile</buildArguments> +<buildTarget>mrproper</buildTarget> +<stopOnError>true</stopOnError> +<useDefaultCommand>true</useDefaultCommand> +<runAllBuilders>true</runAllBuilders> +</target> +</buildTargets> +</storageModule> +</cconfiguration> +<cconfiguration id="0.1324855428.258600044"> +<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1324855428.258600044" moduleId="org.eclipse.cdt.core.settings" name="mrproper"> +<externalSettings/> +<extensions> +<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> +</extensions> +</storageModule> +<storageModule moduleId="cdtBuildSystem" version="4.0.0"> +<configuration artifactName="Ass4" buildProperties="" description="Cleans everything" id="0.1324855428.258600044" name="mrproper" parent="org.eclipse.cdt.build.core.prefbase.cfg"> +<folderInfo id="0.1324855428.258600044." name="/" resourcePath=""> +<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1778304184" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> +<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1778304184.809324197" name=""/> +<builder arguments="-f ./makefile" buildPath="${workspace_loc:/Ass4}" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.243691617" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> +<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1112958851" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> +<tool id="org.eclipse.cdt.build.core.settings.holder.2140526969" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1695326207" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +<tool id="org.eclipse.cdt.build.core.settings.holder.1802963897" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.2023740517" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +<tool id="org.eclipse.cdt.build.core.settings.holder.406881219" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> +<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1732287675" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> +</tool> +</toolChain> +</folderInfo> +</configuration> +</storageModule> +<storageModule moduleId="scannerConfiguration"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<scannerConfigBuildInfo instanceId="0.1324855428"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +</scannerConfigBuildInfo> +</storageModule> +<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> +<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> +<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> +<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"> +<buildTargets> +<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f ./makefile</buildArguments> +<buildTarget>clean</buildTarget> +<stopOnError>true</stopOnError> +<useDefaultCommand>true</useDefaultCommand> +<runAllBuilders>true</runAllBuilders> +</target> +<target name="mrproper" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> +<buildCommand>make</buildCommand> +<buildArguments>-f ./makefile</buildArguments> +<buildTarget>mrproper</buildTarget> +<stopOnError>true</stopOnError> +<useDefaultCommand>true</useDefaultCommand> +<runAllBuilders>true</runAllBuilders> +</target> +</buildTargets> +</storageModule> +</cconfiguration> +</storageModule> +<storageModule moduleId="cdtBuildSystem" version="4.0.0"> +<project id="Ass4.null.1038253555" name="Ass4"/> +</storageModule> +</cproject> diff --git a/.gitignore b/.gitignore index 57f3029..64fa96d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -*.exe -*.o +*.exe +*.o *.a \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..4ae4fc9 --- /dev/null +++ b/.project @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Ass4</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <triggers>clean,full,incremental,</triggers> + <arguments> + <dictionary> + <key>?name?</key> + <value></value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.append_environment</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.autoBuildTarget</key> + <value>all</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.buildArguments</key> + <value>-f ./makefile</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.buildCommand</key> + <value>make</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.buildLocation</key> + <value>${workspace_loc:/Ass4}</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.cleanBuildTarget</key> + <value>clean</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.contents</key> + <value>org.eclipse.cdt.make.core.activeConfigSettings</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableAutoBuild</key> + <value>false</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableCleanBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableFullBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.fullBuildTarget</key> + <value>all</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.stopOnError</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> + <value>false</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + </natures> +</projectDescription> diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000..339ab01 --- /dev/null +++ b/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,3 @@ +#Tue Apr 06 14:16:56 EDT 2010 +eclipse.preferences.version=1 +environment/project/0.1324855428=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<environment append\="true" appendContributed\="false">\r\n<variable delimiter\=";" name\="PATH" operation\="append" value\=";C\:\\\\cygwin\\bin;"/>\r\n</environment>\r\n diff --git a/Makefile b/Makefile index 5001a8e..d96c6df 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,39 @@ ########## The following definition must be set for uCOS >= V2.8x ############# CFLAGS=-DNO_TYPEDEF_OS_FLAGS ########## Path for uCOS-II core source files ################################# UCOS_SRC=./ucosii ########## Path for uCOS-II WIN32 port source files ########################### UCOS_PORT_SRC=./ucosii_port ########## Path for uCOS-II WIN32 example source files ######################## UCOS_PORT_EX=. ########## Path for uCOS-II WIN32 port library file ########################### UCOS_PORT_LIB=$(UCOS_PORT_EX) ########## Name of Example source file ######################################## EXAMPLE=SEG4145_Assignment4 all: $(EXAMPLE).c app_cfg.h os_cfg.h includes.h $(UCOS_PORT_LIB)/ucos_ii.a Makefile @echo --- Recompiling the application --- @gcc -D__WIN32__ $(CFLAGS) -I$(UCOS_SRC) -I$(UCOS_PORT_SRC) -I$(UCOS_PORT_EX) $(EXAMPLE).c $(UCOS_PORT_LIB)/ucos_ii.a /usr/lib/w32api/libwinmm.a /usr/lib/mingw/libcoldname.a -o $(EXAMPLE).exe + @echo --- All Done! --- $(UCOS_PORT_LIB)/ucos_ii.a: os_cfg.h @echo --- Recompiling library ucos_ii.a --- @gcc -c -D__WIN32__ $(CFLAGS) -I$(UCOS_SRC) -I$(UCOS_PORT_SRC) -I$(UCOS_PORT_EX) $(UCOS_SRC)/ucos_ii.c $(UCOS_PORT_SRC)/pc.c $(UCOS_PORT_SRC)/os_cpu_c.c @ar -r $(UCOS_PORT_LIB)/ucos_ii.a ucos_ii.o os_cpu_c.o pc.o clean: @rm -f *.o @rm -f *.bak mrproper: distclean distclean: @rm -f *.o @rm -f *.bak @rm -f *.a @rm -f *.exe
elvisphilipn/RealTimeCygWin
2d39a4aedad451f54d0e628d7c1196cb08485e7a
Oups forgot to add ignore file
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57f3029 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.exe +*.o +*.a \ No newline at end of file
jjk/XamhainII
f5f48839236031aff2af7f3aaa36d328ba992c56
Don't "internet enable" the generated disk image.
diff --git a/Info.plist b/Info.plist index b97c63d..d44cc6c 100644 --- a/Info.plist +++ b/Info.plist @@ -1,28 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIconFile</key> - <string></string> + <string>XamhainII</string> + <key>CFBundleDisplayName</key> + <string>XamhainII</string> <key>CFBundleIdentifier</key> <string>de.earrame.${PRODUCT_NAME:identifier}</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>${PRODUCT_NAME}</string> <key>CFBundlePackageType</key> <string>BNDL</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>1.0</string> <key>NSPrincipalClass</key> <string>XamhainView</string> </dict> </plist> diff --git a/XamhainII.xcodeproj/project.pbxproj b/XamhainII.xcodeproj/project.pbxproj index 0005457..6a34b8f 100644 --- a/XamhainII.xcodeproj/project.pbxproj +++ b/XamhainII.xcodeproj/project.pbxproj @@ -1,752 +1,756 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 45; objects = { /* Begin PBXAggregateTarget section */ 000D03D61089C45F003F010E /* XamhainII.dmg */ = { isa = PBXAggregateTarget; buildConfigurationList = 000D03DC1089C467003F010E /* Build configuration list for PBXAggregateTarget "XamhainII.dmg" */; buildPhases = ( 000D03D51089C45F003F010E /* ShellScript */, ); dependencies = ( 000D03DA1089C465003F010E /* PBXTargetDependency */, ); name = XamhainII.dmg; productName = XamhainII.dmg; }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ 002438561098D6E100E8A351 /* KnotStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002438541098D6E100E8A351 /* KnotStyle.cpp */; }; 0032D326108A30770033FA87 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0032D325108A30770033FA87 /* OpenGL.framework */; }; + 004532EF10A5E5540073D7EA /* XamhainII.icns in Resources */ = {isa = PBXBuildFile; fileRef = 004532EE10A5E5540073D7EA /* XamhainII.icns */; }; 00790DBF10996796007ABF04 /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = 00790DBE10996796007ABF04 /* COPYING */; }; 00791844108B081B00156D67 /* XamhainPreferences.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00791842108B081B00156D67 /* XamhainPreferences.mm */; }; 007C512B108A29BE00ED3242 /* RandomColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007C5127108A29BE00ED3242 /* RandomColor.cpp */; }; 007CBA0310A596B6004F3B49 /* XamhainConfigureSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 007CBA0210A596B6004F3B49 /* XamhainConfigureSheet.xib */; }; 007ED8661090CD6800B01235 /* CircularKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8581090CD6800B01235 /* CircularKnot.cpp */; }; 007ED8681090CD6800B01235 /* ClosedKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */; }; 007ED86A1090CD6800B01235 /* HorizontalKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */; }; 007ED86C1090CD6800B01235 /* RandomKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85E1090CD6800B01235 /* RandomKnot.cpp */; }; 007ED86E1090CD6800B01235 /* RectangularKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8601090CD6800B01235 /* RectangularKnot.cpp */; }; 007ED8701090CD6800B01235 /* TiledKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8621090CD6800B01235 /* TiledKnot.cpp */; }; 007ED8721090CD6800B01235 /* VerticalKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8641090CD6800B01235 /* VerticalKnot.cpp */; }; 00926762109A0BF600B2EF52 /* defaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 00926761109A0BF600B2EF52 /* defaults.plist */; }; 0096345E109B5B6700B26FC2 /* XamhainUserDefaultsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */; }; 009D8964108E251800A416CF /* Stroke.mm in Sources */ = {isa = PBXBuildFile; fileRef = 009D8962108E251800A416CF /* Stroke.mm */; }; 009D897C108E28C800A416CF /* StrokeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D897A108E28C800A416CF /* StrokeSet.cpp */; }; 00D188B11094BA31004E4496 /* XamhainGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */; }; 00D7B656108F8E9A00432E90 /* KnotSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00D7B654108F8E9A00432E90 /* KnotSection.cpp */; }; 00DA7802107A728C0094FCAB /* broad_fill_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */; }; 00DA7803107A728C0094FCAB /* broad_fill_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */; }; 00DA7804107A728C0094FCAB /* broad_fill_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */; }; 00DA7805107A728C0094FCAB /* broad_fill_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */; }; 00DA7806107A728C0094FCAB /* broad_fill_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */; }; 00DA7807107A728C0094FCAB /* broad_fill_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */; }; 00DA7808107A728C0094FCAB /* broad_fill_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */; }; 00DA7809107A728C0094FCAB /* broad_fill_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */; }; 00DA780A107A728C0094FCAB /* broad_fill_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */; }; 00DA780B107A728C0094FCAB /* broad_fill_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */; }; 00DA780C107A728C0094FCAB /* broad_fill_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */; }; 00DA780D107A728C0094FCAB /* broad_outline_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */; }; 00DA780E107A728C0094FCAB /* broad_outline_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */; }; 00DA780F107A728C0094FCAB /* broad_outline_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */; }; 00DA7810107A728C0094FCAB /* broad_outline_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */; }; 00DA7811107A728C0094FCAB /* broad_outline_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */; }; 00DA7812107A728C0094FCAB /* broad_outline_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */; }; 00DA7813107A728C0094FCAB /* broad_outline_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */; }; 00DA7814107A728C0094FCAB /* broad_outline_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */; }; 00DA7815107A728C0094FCAB /* broad_outline_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */; }; 00DA7816107A728C0094FCAB /* broad_outline_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */; }; 00DA7817107A728C0094FCAB /* broad_outline_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */; }; 00DA7818107A728C0094FCAB /* slender_fill_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */; }; 00DA7819107A728C0094FCAB /* slender_fill_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */; }; 00DA781A107A728C0094FCAB /* slender_fill_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */; }; 00DA781B107A728C0094FCAB /* slender_fill_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */; }; 00DA781C107A728C0094FCAB /* slender_fill_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */; }; 00DA781D107A728C0094FCAB /* slender_fill_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */; }; 00DA781E107A728C0094FCAB /* slender_fill_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */; }; 00DA781F107A728C0094FCAB /* slender_fill_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */; }; 00DA7820107A728C0094FCAB /* slender_fill_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */; }; 00DA7821107A728C0094FCAB /* slender_fill_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */; }; 00DA7822107A728C0094FCAB /* slender_fill_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */; }; 00DA7823107A728C0094FCAB /* slender_outline_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */; }; 00DA7824107A728C0094FCAB /* slender_outline_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */; }; 00DA7825107A728C0094FCAB /* slender_outline_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */; }; 00DA7826107A728C0094FCAB /* slender_outline_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */; }; 00DA7827107A728C0094FCAB /* slender_outline_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */; }; 00DA7828107A728C0094FCAB /* slender_outline_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */; }; 00DA7829107A728C0094FCAB /* slender_outline_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */; }; 00DA782A107A728C0094FCAB /* slender_outline_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */; }; 00DA782B107A728C0094FCAB /* slender_outline_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */; }; 00DA782C107A728C0094FCAB /* slender_outline_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */; }; 00DA782D107A728C0094FCAB /* slender_outline_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */; }; 00DA7838107A73320094FCAB /* XamhainView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00DA7836107A73320094FCAB /* XamhainView.mm */; }; 8D255ACA0486D3F9007BF209 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 8D255ACE0486D3F9007BF209 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; 8D255ACF0486D3F9007BF209 /* ScreenSaver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 000D03D91089C465003F010E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 089C1669FE841209C02AAC07 /* Project object */; proxyType = 1; remoteGlobalIDString = 8D255AC50486D3F9007BF209; remoteInfo = XamhainII; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 000AE53A109B577E00DCDFD0 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; 000AE53D109B57FC00DCDFD0 /* CREDITS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CREDITS; sourceTree = "<group>"; }; 00151B99109A2BAA00CFFD7F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/XamhainConfigureSheet.xib; sourceTree = "<group>"; }; 001EA1D5109365FC00D05EFB /* XamhainGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainGLView.h; path = "screen saving/XamhainGLView.h"; sourceTree = "<group>"; }; 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainGLView.mm; path = "screen saving/XamhainGLView.mm"; sourceTree = "<group>"; }; 002438531098D6E100E8A351 /* KnotStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KnotStyle.h; path = "knot engine/KnotStyle.h"; sourceTree = "<group>"; }; 002438541098D6E100E8A351 /* KnotStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KnotStyle.cpp; path = "knot engine/KnotStyle.cpp"; sourceTree = "<group>"; }; 0032D325108A30770033FA87 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; + 004532EE10A5E5540073D7EA /* XamhainII.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = XamhainII.icns; path = misc/XamhainII.icns; sourceTree = "<group>"; }; 00790DBE10996796007ABF04 /* COPYING */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = COPYING; sourceTree = "<group>"; }; 00791842108B081B00156D67 /* XamhainPreferences.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainPreferences.mm; path = "screen saving/XamhainPreferences.mm"; sourceTree = "<group>"; }; 00791843108B081B00156D67 /* XamhainPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainPreferences.h; path = "screen saving/XamhainPreferences.h"; sourceTree = "<group>"; }; 007C5126108A29BE00ED3242 /* Position.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Position.h; path = utility/Position.h; sourceTree = "<group>"; }; 007C5127108A29BE00ED3242 /* RandomColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RandomColor.cpp; path = utility/RandomColor.cpp; sourceTree = "<group>"; }; 007C5128108A29BE00ED3242 /* RandomColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomColor.h; path = utility/RandomColor.h; sourceTree = "<group>"; }; 007C5129108A29BE00ED3242 /* RandomNumbers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomNumbers.h; path = utility/RandomNumbers.h; sourceTree = "<group>"; }; 007ED8581090CD6800B01235 /* CircularKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CircularKnot.cpp; path = "knot engine/CircularKnot.cpp"; sourceTree = "<group>"; }; 007ED8591090CD6800B01235 /* CircularKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CircularKnot.h; path = "knot engine/CircularKnot.h"; sourceTree = "<group>"; }; 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClosedKnot.cpp; path = "knot engine/ClosedKnot.cpp"; sourceTree = "<group>"; }; 007ED85B1090CD6800B01235 /* ClosedKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClosedKnot.h; path = "knot engine/ClosedKnot.h"; sourceTree = "<group>"; }; 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HorizontalKnot.cpp; path = "knot engine/HorizontalKnot.cpp"; sourceTree = "<group>"; }; 007ED85D1090CD6800B01235 /* HorizontalKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HorizontalKnot.h; path = "knot engine/HorizontalKnot.h"; sourceTree = "<group>"; }; 007ED85E1090CD6800B01235 /* RandomKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RandomKnot.cpp; path = "knot engine/RandomKnot.cpp"; sourceTree = "<group>"; }; 007ED85F1090CD6800B01235 /* RandomKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomKnot.h; path = "knot engine/RandomKnot.h"; sourceTree = "<group>"; }; 007ED8601090CD6800B01235 /* RectangularKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RectangularKnot.cpp; path = "knot engine/RectangularKnot.cpp"; sourceTree = "<group>"; }; 007ED8611090CD6800B01235 /* RectangularKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RectangularKnot.h; path = "knot engine/RectangularKnot.h"; sourceTree = "<group>"; }; 007ED8621090CD6800B01235 /* TiledKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TiledKnot.cpp; path = "knot engine/TiledKnot.cpp"; sourceTree = "<group>"; }; 007ED8631090CD6800B01235 /* TiledKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiledKnot.h; path = "knot engine/TiledKnot.h"; sourceTree = "<group>"; }; 007ED8641090CD6800B01235 /* VerticalKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VerticalKnot.cpp; path = "knot engine/VerticalKnot.cpp"; sourceTree = "<group>"; }; 007ED8651090CD6800B01235 /* VerticalKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VerticalKnot.h; path = "knot engine/VerticalKnot.h"; sourceTree = "<group>"; }; 00926761109A0BF600B2EF52 /* defaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = defaults.plist; sourceTree = "<group>"; }; 0096345B109B5B6700B26FC2 /* XamhainUserDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainUserDefaultsController.h; path = "screen saving/XamhainUserDefaultsController.h"; sourceTree = "<group>"; }; 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainUserDefaultsController.mm; path = "screen saving/XamhainUserDefaultsController.mm"; sourceTree = "<group>"; }; 009D8962108E251800A416CF /* Stroke.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Stroke.mm; path = "knot engine/Stroke.mm"; sourceTree = "<group>"; }; 009D8963108E251800A416CF /* Stroke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stroke.h; path = "knot engine/Stroke.h"; sourceTree = "<group>"; }; 009D897A108E28C800A416CF /* StrokeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StrokeSet.cpp; path = "knot engine/StrokeSet.cpp"; sourceTree = "<group>"; }; 009D897B108E28C800A416CF /* StrokeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrokeSet.h; path = "knot engine/StrokeSet.h"; sourceTree = "<group>"; }; 00D7B654108F8E9A00432E90 /* KnotSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KnotSection.cpp; path = "knot engine/KnotSection.cpp"; sourceTree = "<group>"; }; 00D7B655108F8E9A00432E90 /* KnotSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KnotSection.h; path = "knot engine/KnotSection.h"; sourceTree = "<group>"; }; 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_corner.pdf; sourceTree = "<group>"; }; 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DDD.pdf; sourceTree = "<group>"; }; 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHD.pdf; sourceTree = "<group>"; }; 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHH.pdf; sourceTree = "<group>"; }; 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHV.pdf; sourceTree = "<group>"; }; 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDD.pdf; sourceTree = "<group>"; }; 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDH.pdf; sourceTree = "<group>"; }; 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDV.pdf; sourceTree = "<group>"; }; 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HHH.pdf; sourceTree = "<group>"; }; 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HHV.pdf; sourceTree = "<group>"; }; 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HVV.pdf; sourceTree = "<group>"; }; 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_corner.pdf; sourceTree = "<group>"; }; 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DDD.pdf; sourceTree = "<group>"; }; 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHD.pdf; sourceTree = "<group>"; }; 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHH.pdf; sourceTree = "<group>"; }; 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHV.pdf; sourceTree = "<group>"; }; 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDD.pdf; sourceTree = "<group>"; }; 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDH.pdf; sourceTree = "<group>"; }; 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDV.pdf; sourceTree = "<group>"; }; 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HHH.pdf; sourceTree = "<group>"; }; 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HHV.pdf; sourceTree = "<group>"; }; 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HVV.pdf; sourceTree = "<group>"; }; 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_corner.pdf; sourceTree = "<group>"; }; 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DDD.pdf; sourceTree = "<group>"; }; 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHD.pdf; sourceTree = "<group>"; }; 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHH.pdf; sourceTree = "<group>"; }; 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHV.pdf; sourceTree = "<group>"; }; 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDD.pdf; sourceTree = "<group>"; }; 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDH.pdf; sourceTree = "<group>"; }; 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDV.pdf; sourceTree = "<group>"; }; 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HHH.pdf; sourceTree = "<group>"; }; 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HHV.pdf; sourceTree = "<group>"; }; 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HVV.pdf; sourceTree = "<group>"; }; 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_corner.pdf; sourceTree = "<group>"; }; 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DDD.pdf; sourceTree = "<group>"; }; 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHD.pdf; sourceTree = "<group>"; }; 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHH.pdf; sourceTree = "<group>"; }; 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHV.pdf; sourceTree = "<group>"; }; 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDD.pdf; sourceTree = "<group>"; }; 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDH.pdf; sourceTree = "<group>"; }; 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDV.pdf; sourceTree = "<group>"; }; 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HHH.pdf; sourceTree = "<group>"; }; 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HHV.pdf; sourceTree = "<group>"; }; 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HVV.pdf; sourceTree = "<group>"; }; 00DA7835107A73320094FCAB /* XamhainView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainView.h; path = "screen saving/XamhainView.h"; sourceTree = "<group>"; }; 00DA7836107A73320094FCAB /* XamhainView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainView.mm; path = "screen saving/XamhainView.mm"; sourceTree = "<group>"; }; 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScreenSaver.framework; path = /System/Library/Frameworks/ScreenSaver.framework; sourceTree = "<absolute>"; }; 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 089C167EFE841241C02AAC07 /* en */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XamhainII_Prefix.pch; sourceTree = "<group>"; }; 8D255AD20486D3F9007BF209 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D255AD30486D3F9007BF209 /* XamhainII.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XamhainII.saver; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D255ACD0486D3F9007BF209 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D255ACE0486D3F9007BF209 /* Cocoa.framework in Frameworks */, 8D255ACF0486D3F9007BF209 /* ScreenSaver.framework in Frameworks */, 0032D326108A30770033FA87 /* OpenGL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 007C5125108A299800ED3242 /* Utility */ = { isa = PBXGroup; children = ( 007C5126108A29BE00ED3242 /* Position.h */, 007C5127108A29BE00ED3242 /* RandomColor.cpp */, 007C5128108A29BE00ED3242 /* RandomColor.h */, 007C5129108A29BE00ED3242 /* RandomNumbers.h */, ); name = Utility; sourceTree = "<group>"; }; 009D8961108E24ED00A416CF /* Knot Engine */ = { isa = PBXGroup; children = ( 002438531098D6E100E8A351 /* KnotStyle.h */, 002438541098D6E100E8A351 /* KnotStyle.cpp */, 007ED8581090CD6800B01235 /* CircularKnot.cpp */, 007ED8591090CD6800B01235 /* CircularKnot.h */, 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */, 007ED85B1090CD6800B01235 /* ClosedKnot.h */, 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */, 007ED85D1090CD6800B01235 /* HorizontalKnot.h */, 007ED85E1090CD6800B01235 /* RandomKnot.cpp */, 007ED85F1090CD6800B01235 /* RandomKnot.h */, 007ED8601090CD6800B01235 /* RectangularKnot.cpp */, 007ED8611090CD6800B01235 /* RectangularKnot.h */, 007ED8621090CD6800B01235 /* TiledKnot.cpp */, 007ED8631090CD6800B01235 /* TiledKnot.h */, 007ED8641090CD6800B01235 /* VerticalKnot.cpp */, 007ED8651090CD6800B01235 /* VerticalKnot.h */, 00D7B654108F8E9A00432E90 /* KnotSection.cpp */, 00D7B655108F8E9A00432E90 /* KnotSection.h */, 009D897A108E28C800A416CF /* StrokeSet.cpp */, 009D897B108E28C800A416CF /* StrokeSet.h */, 009D8962108E251800A416CF /* Stroke.mm */, 009D8963108E251800A416CF /* Stroke.h */, ); name = "Knot Engine"; sourceTree = "<group>"; }; 00DA77D5107A728C0094FCAB /* Strokes */ = { isa = PBXGroup; children = ( 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */, 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */, 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */, 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */, 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */, 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */, 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */, 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */, 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */, 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */, 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */, 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */, 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */, 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */, 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */, 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */, 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */, 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */, 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */, 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */, 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */, 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */, 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */, 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */, 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */, 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */, 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */, 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */, 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */, 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */, 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */, 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */, 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */, 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */, 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */, 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */, 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */, 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */, 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */, 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */, 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */, 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */, 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */, 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */, ); name = Strokes; path = strokes; sourceTree = "<group>"; }; 00DA7833107A72F00094FCAB /* Screen Saving */ = { isa = PBXGroup; children = ( 001EA1D5109365FC00D05EFB /* XamhainGLView.h */, 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */, 00791842108B081B00156D67 /* XamhainPreferences.mm */, 00791843108B081B00156D67 /* XamhainPreferences.h */, 00DA7835107A73320094FCAB /* XamhainView.h */, 00DA7836107A73320094FCAB /* XamhainView.mm */, 0096345B109B5B6700B26FC2 /* XamhainUserDefaultsController.h */, 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */, ); name = "Screen Saving"; sourceTree = "<group>"; }; 089C166AFE841209C02AAC07 /* XamhainII */ = { isa = PBXGroup; children = ( 009D8961108E24ED00A416CF /* Knot Engine */, 00DA7833107A72F00094FCAB /* Screen Saving */, 007C5125108A299800ED3242 /* Utility */, 32DBCFA70370C4F300C91783 /* Other Sources */, 089C167CFE841241C02AAC07 /* Resources */, 089C1671FE841209C02AAC07 /* Frameworks and Libraries */, 19C28FB8FE9D52D311CA2CBB /* Products */, ); name = XamhainII; sourceTree = "<group>"; }; 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { isa = PBXGroup; children = ( 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, ); name = "Frameworks and Libraries"; sourceTree = "<group>"; }; 089C167CFE841241C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( + 004532EE10A5E5540073D7EA /* XamhainII.icns */, 000AE53D109B57FC00DCDFD0 /* CREDITS */, 00926761109A0BF600B2EF52 /* defaults.plist */, 00790DBE10996796007ABF04 /* COPYING */, 00DA77D5107A728C0094FCAB /* Strokes */, 8D255AD20486D3F9007BF209 /* Info.plist */, 089C167DFE841241C02AAC07 /* InfoPlist.strings */, 007CBA0210A596B6004F3B49 /* XamhainConfigureSheet.xib */, 000AE53A109B577E00DCDFD0 /* README */, ); name = Resources; sourceTree = "<group>"; }; 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, 0032D325108A30770033FA87 /* OpenGL.framework */, 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; }; 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 089C1672FE841209C02AAC07 /* Foundation.framework */, 089C167FFE841241C02AAC07 /* AppKit.framework */, ); name = "Other Frameworks"; sourceTree = "<group>"; }; 19C28FB8FE9D52D311CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D255AD30486D3F9007BF209 /* XamhainII.saver */, ); name = Products; sourceTree = "<group>"; }; 32DBCFA70370C4F300C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */, ); name = "Other Sources"; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8D255AC60486D3F9007BF209 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8D255AC50486D3F9007BF209 /* XamhainII */ = { isa = PBXNativeTarget; buildConfigurationList = EF7AD72D08BB986600CE4634 /* Build configuration list for PBXNativeTarget "XamhainII" */; buildPhases = ( 8D255AC60486D3F9007BF209 /* Headers */, 8D255AC90486D3F9007BF209 /* Resources */, 8D255ACB0486D3F9007BF209 /* Sources */, 8D255ACD0486D3F9007BF209 /* Frameworks */, 8D255AD00486D3F9007BF209 /* Rez */, ); buildRules = ( ); dependencies = ( ); name = XamhainII; productInstallPath = "$(HOME)/Library/Screen Savers"; productName = XamhainII; productReference = 8D255AD30486D3F9007BF209 /* XamhainII.saver */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = EF7AD73108BB986600CE4634 /* Build configuration list for PBXProject "XamhainII" */; compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 089C166AFE841209C02AAC07 /* XamhainII */; projectDirPath = ""; projectRoot = ""; targets = ( 8D255AC50486D3F9007BF209 /* XamhainII */, 000D03D61089C45F003F010E /* XamhainII.dmg */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D255AC90486D3F9007BF209 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D255ACA0486D3F9007BF209 /* InfoPlist.strings in Resources */, 00DA7802107A728C0094FCAB /* broad_fill_corner.pdf in Resources */, 00DA7803107A728C0094FCAB /* broad_fill_DDD.pdf in Resources */, 00DA7804107A728C0094FCAB /* broad_fill_DHD.pdf in Resources */, 00DA7805107A728C0094FCAB /* broad_fill_DHH.pdf in Resources */, 00DA7806107A728C0094FCAB /* broad_fill_DHV.pdf in Resources */, 00DA7807107A728C0094FCAB /* broad_fill_HDD.pdf in Resources */, 00DA7808107A728C0094FCAB /* broad_fill_HDH.pdf in Resources */, 00DA7809107A728C0094FCAB /* broad_fill_HDV.pdf in Resources */, 00DA780A107A728C0094FCAB /* broad_fill_HHH.pdf in Resources */, 00DA780B107A728C0094FCAB /* broad_fill_HHV.pdf in Resources */, 00DA780C107A728C0094FCAB /* broad_fill_HVV.pdf in Resources */, 00DA780D107A728C0094FCAB /* broad_outline_corner.pdf in Resources */, 00DA780E107A728C0094FCAB /* broad_outline_DDD.pdf in Resources */, 00DA780F107A728C0094FCAB /* broad_outline_DHD.pdf in Resources */, 00DA7810107A728C0094FCAB /* broad_outline_DHH.pdf in Resources */, 00DA7811107A728C0094FCAB /* broad_outline_DHV.pdf in Resources */, 00DA7812107A728C0094FCAB /* broad_outline_HDD.pdf in Resources */, 00DA7813107A728C0094FCAB /* broad_outline_HDH.pdf in Resources */, 00DA7814107A728C0094FCAB /* broad_outline_HDV.pdf in Resources */, 00DA7815107A728C0094FCAB /* broad_outline_HHH.pdf in Resources */, 00DA7816107A728C0094FCAB /* broad_outline_HHV.pdf in Resources */, 00DA7817107A728C0094FCAB /* broad_outline_HVV.pdf in Resources */, 00DA7818107A728C0094FCAB /* slender_fill_corner.pdf in Resources */, 00DA7819107A728C0094FCAB /* slender_fill_DDD.pdf in Resources */, 00DA781A107A728C0094FCAB /* slender_fill_DHD.pdf in Resources */, 00DA781B107A728C0094FCAB /* slender_fill_DHH.pdf in Resources */, 00DA781C107A728C0094FCAB /* slender_fill_DHV.pdf in Resources */, 00DA781D107A728C0094FCAB /* slender_fill_HDD.pdf in Resources */, 00DA781E107A728C0094FCAB /* slender_fill_HDH.pdf in Resources */, 00DA781F107A728C0094FCAB /* slender_fill_HDV.pdf in Resources */, 00DA7820107A728C0094FCAB /* slender_fill_HHH.pdf in Resources */, 00DA7821107A728C0094FCAB /* slender_fill_HHV.pdf in Resources */, 00DA7822107A728C0094FCAB /* slender_fill_HVV.pdf in Resources */, 00DA7823107A728C0094FCAB /* slender_outline_corner.pdf in Resources */, 00DA7824107A728C0094FCAB /* slender_outline_DDD.pdf in Resources */, 00DA7825107A728C0094FCAB /* slender_outline_DHD.pdf in Resources */, 00DA7826107A728C0094FCAB /* slender_outline_DHH.pdf in Resources */, 00DA7827107A728C0094FCAB /* slender_outline_DHV.pdf in Resources */, 00DA7828107A728C0094FCAB /* slender_outline_HDD.pdf in Resources */, 00DA7829107A728C0094FCAB /* slender_outline_HDH.pdf in Resources */, 00DA782A107A728C0094FCAB /* slender_outline_HDV.pdf in Resources */, 00DA782B107A728C0094FCAB /* slender_outline_HHH.pdf in Resources */, 00DA782C107A728C0094FCAB /* slender_outline_HHV.pdf in Resources */, 00DA782D107A728C0094FCAB /* slender_outline_HVV.pdf in Resources */, 00790DBF10996796007ABF04 /* COPYING in Resources */, 00926762109A0BF600B2EF52 /* defaults.plist in Resources */, 007CBA0310A596B6004F3B49 /* XamhainConfigureSheet.xib in Resources */, + 004532EF10A5E5540073D7EA /* XamhainII.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXRezBuildPhase section */ 8D255AD00486D3F9007BF209 /* Rez */ = { isa = PBXRezBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXRezBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 000D03D51089C45F003F010E /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(SRCROOT)/$(PROJECT_NAME)-orig.dmg", "$(BUILT_PRODUCTS_DIR)/$(PROJECT_NAME).saver", "$(SRCROOT)/COPYING", "$(SRCROOT)/CREDITS", "$(SRCROOT)/README", ); outputPaths = ( "$(BUILT_PRODUCTS_DIR)/$(PROJECT_NAME).dmg", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# See http://jwz.livejournal.com/608927.html?thread=11477151#t11477151\n# for the basic idea behind this. Originally based on a script by Rob Mayoff\n# which did it rather differently.\n\nset -ex\n\n[ \"$ACTION\" = build ] || exit 0\n[ \"$BUILD_VARIANTS\" = \"normal\" ] || exit 0\n\norig=\"$SRCROOT/misc/$PROJECT_NAME-orig.dmg\"\ndmg=\"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg\"\nmnt=\"/Volumes/$PROJECT_NAME\"\n\n[ -e $mnt ] && exit 1\n\n# Attach the original image\nhdiutil attach -shadow $orig.shadow $orig\n\n# Copy files\nrsync -avE \"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.saver\" $mnt\ncp \"$SRCROOT/COPYING\" $mnt/Info\ncp \"$SRCROOT/CREDITS\" $mnt/Info\ncp \"$SRCROOT/README\" $mnt/Info\n\n# Detach the image\nhdiutil detach $mnt\n\n# Now convert to a compressed read-only image\nhdiutil convert -ov -format UDZO -o $dmg -shadow $orig.shadow $orig\nhdiutil internet-enable -yes \"$dmg\"\nrm -f $orig.shadow\n"; + shellScript = "# See http://jwz.livejournal.com/608927.html?thread=11477151#t11477151\n# for the basic idea behind this. Originally based on a script by Rob Mayoff\n# which did it rather differently.\n\nset -ex\n\n[ \"$ACTION\" = build ] || exit 0\n[ \"$BUILD_VARIANTS\" = \"normal\" ] || exit 0\n\norig=\"$SRCROOT/misc/$PROJECT_NAME-orig.dmg\"\ndmg=\"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg\"\nmnt=\"/Volumes/$PROJECT_NAME\"\n\n[ -e $mnt ] && exit 1\n\n# Attach the original image\nhdiutil attach -shadow $orig.shadow $orig\n\n# Copy files\nrsync -avE \"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.saver\" $mnt\ncp \"$SRCROOT/COPYING\" $mnt/Info\ncp \"$SRCROOT/CREDITS\" $mnt/Info\ncp \"$SRCROOT/README\" $mnt/Info\n\n# Detach the image\nhdiutil detach $mnt\n\n# Now convert to a compressed read-only image\nhdiutil convert -ov -format UDZO -o $dmg -shadow $orig.shadow $orig\nrm -f $orig.shadow\n"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D255ACB0486D3F9007BF209 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 00DA7838107A73320094FCAB /* XamhainView.mm in Sources */, 007C512B108A29BE00ED3242 /* RandomColor.cpp in Sources */, 00791844108B081B00156D67 /* XamhainPreferences.mm in Sources */, 009D8964108E251800A416CF /* Stroke.mm in Sources */, 009D897C108E28C800A416CF /* StrokeSet.cpp in Sources */, 00D7B656108F8E9A00432E90 /* KnotSection.cpp in Sources */, 007ED8661090CD6800B01235 /* CircularKnot.cpp in Sources */, 007ED8681090CD6800B01235 /* ClosedKnot.cpp in Sources */, 007ED86A1090CD6800B01235 /* HorizontalKnot.cpp in Sources */, 007ED86C1090CD6800B01235 /* RandomKnot.cpp in Sources */, 007ED86E1090CD6800B01235 /* RectangularKnot.cpp in Sources */, 007ED8701090CD6800B01235 /* TiledKnot.cpp in Sources */, 007ED8721090CD6800B01235 /* VerticalKnot.cpp in Sources */, 00D188B11094BA31004E4496 /* XamhainGLView.mm in Sources */, 002438561098D6E100E8A351 /* KnotStyle.cpp in Sources */, 0096345E109B5B6700B26FC2 /* XamhainUserDefaultsController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 000D03DA1089C465003F010E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 8D255AC50486D3F9007BF209 /* XamhainII */; targetProxy = 000D03D91089C465003F010E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 007CBA0210A596B6004F3B49 /* XamhainConfigureSheet.xib */ = { isa = PBXVariantGroup; children = ( 00151B99109A2BAA00CFFD7F /* en */, ); name = XamhainConfigureSheet.xib; sourceTree = "<group>"; }; 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 089C167EFE841241C02AAC07 /* en */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 000D03D71089C45F003F010E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; PRODUCT_NAME = XamhainII.dmg; }; name = Debug; }; 000D03D81089C45F003F010E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; PRODUCT_NAME = XamhainII.dmg; ZERO_LINK = NO; }; name = Release; }; EF7AD72E08BB986600CE4634 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_ENABLE_OBJC_GC = required; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = XamhainII_Prefix.pch; GCC_STRICT_ALIASING = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; PRODUCT_NAME = XamhainII; WRAPPER_EXTENSION = saver; ZERO_LINK = YES; }; name = Debug; }; EF7AD72F08BB986600CE4634 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_OBJC_GC = required; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = XamhainII_Prefix.pch; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; PRODUCT_NAME = XamhainII; WRAPPER_EXTENSION = saver; }; name = Release; }; EF7AD73208BB986600CE4634 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = NO; PREBINDING = NO; SDKROOT = macosx10.6; }; name = Debug; }; EF7AD73308BB986600CE4634 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; SDKROOT = macosx10.6; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 000D03DC1089C467003F010E /* Build configuration list for PBXAggregateTarget "XamhainII.dmg" */ = { isa = XCConfigurationList; buildConfigurations = ( 000D03D71089C45F003F010E /* Debug */, 000D03D81089C45F003F010E /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; EF7AD72D08BB986600CE4634 /* Build configuration list for PBXNativeTarget "XamhainII" */ = { isa = XCConfigurationList; buildConfigurations = ( EF7AD72E08BB986600CE4634 /* Debug */, EF7AD72F08BB986600CE4634 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; EF7AD73108BB986600CE4634 /* Build configuration list for PBXProject "XamhainII" */ = { isa = XCConfigurationList; buildConfigurations = ( EF7AD73208BB986600CE4634 /* Debug */, EF7AD73308BB986600CE4634 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 089C1669FE841209C02AAC07 /* Project object */; }
jjk/XamhainII
7a347cfad3c313def802d995009b18de3d0c3ced
Provide custom icon for mounting the disk image.
diff --git a/misc/DiskImage.icns b/misc/DiskImage.icns new file mode 100644 index 0000000..d3b918d Binary files /dev/null and b/misc/DiskImage.icns differ diff --git a/misc/DiskImage.png b/misc/DiskImage.png new file mode 100644 index 0000000..c4a6f27 Binary files /dev/null and b/misc/DiskImage.png differ diff --git a/misc/DiskImage.qtz b/misc/DiskImage.qtz new file mode 100644 index 0000000..1191597 Binary files /dev/null and b/misc/DiskImage.qtz differ diff --git a/misc/GenericDiskImage.png b/misc/GenericDiskImage.png new file mode 100644 index 0000000..9d0e2ee Binary files /dev/null and b/misc/GenericDiskImage.png differ diff --git a/misc/XamhainII-orig.dmg b/misc/XamhainII-orig.dmg index 70178c6..ddd4f90 100644 Binary files a/misc/XamhainII-orig.dmg and b/misc/XamhainII-orig.dmg differ diff --git a/misc/XamhainII.icns b/misc/XamhainII.icns new file mode 100644 index 0000000..06abcb9 Binary files /dev/null and b/misc/XamhainII.icns differ diff --git a/misc/XamhainII.png b/misc/XamhainII.png new file mode 100644 index 0000000..57e7d35 Binary files /dev/null and b/misc/XamhainII.png differ
jjk/XamhainII
3ba2c234d32c1509e531a18d23180962fbf85e30
Use proper language name and make UI localizable.
diff --git a/Info.plist b/Info.plist index 2888dc2..b97c63d 100644 --- a/Info.plist +++ b/Info.plist @@ -1,28 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> - <string>English</string> + <string>en</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIconFile</key> <string></string> <key>CFBundleIdentifier</key> <string>de.earrame.${PRODUCT_NAME:identifier}</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>${PRODUCT_NAME}</string> <key>CFBundlePackageType</key> <string>BNDL</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>1.0</string> <key>NSPrincipalClass</key> <string>XamhainView</string> </dict> </plist> diff --git a/XamhainII.xcodeproj/default.pbxuser b/XamhainII.xcodeproj/default.pbxuser index 72122b6..d9f9568 100644 --- a/XamhainII.xcodeproj/default.pbxuser +++ b/XamhainII.xcodeproj/default.pbxuser @@ -1,286 +1,286 @@ // !$*UTF8*$! { 00758B321089BA5B009D6C40 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */; }; 00758B331089BA5B009D6C40 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 089C167EFE841241C02AAC07 /* English */; + fRef = 089C167EFE841241C02AAC07 /* en */; name = "InfoPlist.strings: 17"; rLen = 0; rLoc = 717; rType = 0; vrLen = 717; vrLoc = 0; }; 00758B341089BA5B009D6C40 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D255AD20486D3F9007BF209 /* Info.plist */; fallbackIsa = PBXBookmark; isK = 0; kPath = ( ); name = /Users/jjk/Projects/XamhainII/Info.plist; rLen = 0; rLoc = 9223372036854775808; }; 00758B351089BA5B009D6C40 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */; }; 00758B361089BA5B009D6C40 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 00DA7836107A73320094FCAB /* XamhainView.m */; name = "XamhainView.m: 3"; rLen = 0; rLoc = 36; rType = 0; vrLen = 1002; vrLoc = 0; }; 00758B371089BA5B009D6C40 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 00DA7835107A73320094FCAB /* XamhainView.h */; name = "XamhainView.h: 3"; rLen = 0; rLoc = 36; rType = 0; vrLen = 866; vrLoc = 0; }; 007A96301089B7BD00036720 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */; }; 007A96311089B7BD00036720 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */; }; 007A96351089B7BD00036720 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */; }; 007A96361089B7BD00036720 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */; }; 007A96371089B7BD00036720 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */; }; 007A96381089B7BD00036720 /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */; }; 00AE8D621078F42800BF666F /* Source Control */ = { isa = PBXSourceControlManager; fallbackIsa = XCSourceControlManager; isSCMEnabled = 0; scmConfiguration = { repositoryNamesForRoots = { "" = ""; }; }; }; 00AE8D631078F42800BF666F /* Code sense */ = { isa = PBXCodeSenseManager; indexTemplatePath = ""; }; 00BBD5D21089BAAE003EFE03 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */; name = "XamhainII_Prefix.pch: 11"; rLen = 0; rLoc = 421; rType = 0; vrLen = 914; vrLoc = 0; }; 00D71816107E721600314C48 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 00D71817107E721600314C48 /* Point.h */; name = "Point.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 957; vrLoc = 0; }; 00D71817107E721600314C48 /* Point.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Point.h; path = "/Users/jjk/Projects/xscreensaver-5.10/hacks/XamhainII/Point.h"; sourceTree = "<absolute>"; }; 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */ = { uiCtxt = { sepNavWindowFrame = "{{15, 263}, {1142, 610}}"; }; }; 00DA7835107A73320094FCAB /* XamhainView.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {856, 377}}"; sepNavSelRange = "{36, 0}"; sepNavVisRange = "{0, 866}"; }; }; 00DA7836107A73320094FCAB /* XamhainView.m */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {856, 858}}"; sepNavSelRange = "{36, 0}"; sepNavVisRange = "{0, 1002}"; sepNavWindowFrame = "{{15, 263}, {1142, 610}}"; }; }; 00DA788E107A76F50094FCAB /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */; }; 00DA788F107A76F50094FCAB /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */; }; 00DA7890107A76F50094FCAB /* PBXBookmark */ = { isa = PBXBookmark; fRef = 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */; }; 00EE9EEC1089BBA7003D3992 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */; name = "XamhainII_Prefix.pch: 11"; rLen = 0; rLoc = 421; rType = 0; vrLen = 914; vrLoc = 0; }; 089C1669FE841209C02AAC07 /* Project object */ = { activeBuildConfigurationName = Debug; activeTarget = 8D255AC50486D3F9007BF209 /* XamhainII */; addToTargets = ( 8D255AC50486D3F9007BF209 /* XamhainII */, ); codeSenseManager = 00AE8D631078F42800BF666F /* Code sense */; perUserDictionary = { PBXConfiguration.PBXFileTableDataSource3.PBXBookmarksDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXBookmarksDataSource_NameID; PBXFileTableDataSourceColumnWidthsKey = ( 200, 200, 488, ); PBXFileTableDataSourceColumnsKey = ( PBXBookmarksDataSource_LocationID, PBXBookmarksDataSource_NameID, PBXBookmarksDataSource_CommentsID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 678, 20, 48, 43, 43, 20, ); PBXFileTableDataSourceColumnsKey = ( PBXFileDataSource_FiletypeID, PBXFileDataSource_Filename_ColumnID, PBXFileDataSource_Built_ColumnID, PBXFileDataSource_ObjectSize_ColumnID, PBXFileDataSource_Errors_ColumnID, PBXFileDataSource_Warnings_ColumnID, PBXFileDataSource_Target_ColumnID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXFindDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXFindDataSource_LocationID; PBXFileTableDataSourceColumnWidthsKey = ( 200, 692, ); PBXFileTableDataSourceColumnsKey = ( PBXFindDataSource_MessageID, PBXFindDataSource_LocationID, ); }; PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 638, 60, 20, 48, 43, 43, ); PBXFileTableDataSourceColumnsKey = ( PBXFileDataSource_FiletypeID, PBXFileDataSource_Filename_ColumnID, PBXTargetDataSource_PrimaryAttribute, PBXFileDataSource_Built_ColumnID, PBXFileDataSource_ObjectSize_ColumnID, PBXFileDataSource_Errors_ColumnID, PBXFileDataSource_Warnings_ColumnID, ); }; PBXPerProjectTemplateStateSaveDate = 277461771; PBXWorkspaceStateSaveDate = 277461771; }; perUserProjectItems = { 00758B321089BA5B009D6C40 /* PBXBookmark */ = 00758B321089BA5B009D6C40 /* PBXBookmark */; 00758B331089BA5B009D6C40 /* PBXTextBookmark */ = 00758B331089BA5B009D6C40 /* PBXTextBookmark */; 00758B341089BA5B009D6C40 /* PlistBookmark */ = 00758B341089BA5B009D6C40 /* PlistBookmark */; 00758B351089BA5B009D6C40 /* PBXBookmark */ = 00758B351089BA5B009D6C40 /* PBXBookmark */; 00758B361089BA5B009D6C40 /* PBXTextBookmark */ = 00758B361089BA5B009D6C40 /* PBXTextBookmark */; 00758B371089BA5B009D6C40 /* PBXTextBookmark */ = 00758B371089BA5B009D6C40 /* PBXTextBookmark */; 007A96301089B7BD00036720 /* PBXBookmark */ = 007A96301089B7BD00036720 /* PBXBookmark */; 007A96311089B7BD00036720 /* PBXBookmark */ = 007A96311089B7BD00036720 /* PBXBookmark */; 007A96351089B7BD00036720 /* PBXBookmark */ = 007A96351089B7BD00036720 /* PBXBookmark */; 007A96361089B7BD00036720 /* PBXBookmark */ = 007A96361089B7BD00036720 /* PBXBookmark */; 007A96371089B7BD00036720 /* PBXBookmark */ = 007A96371089B7BD00036720 /* PBXBookmark */; 007A96381089B7BD00036720 /* PBXBookmark */ = 007A96381089B7BD00036720 /* PBXBookmark */; 00BBD5D21089BAAE003EFE03 /* PBXTextBookmark */ = 00BBD5D21089BAAE003EFE03 /* PBXTextBookmark */; 00D71816107E721600314C48 /* PBXTextBookmark */ = 00D71816107E721600314C48 /* PBXTextBookmark */; 00DA788E107A76F50094FCAB /* PBXBookmark */ = 00DA788E107A76F50094FCAB /* PBXBookmark */; 00DA788F107A76F50094FCAB /* PBXBookmark */ = 00DA788F107A76F50094FCAB /* PBXBookmark */; 00DA7890107A76F50094FCAB /* PBXBookmark */ = 00DA7890107A76F50094FCAB /* PBXBookmark */; 00EE9EEC1089BBA7003D3992 /* PBXTextBookmark */ = 00EE9EEC1089BBA7003D3992 /* PBXTextBookmark */; }; sourceControlManager = 00AE8D621078F42800BF666F /* Source Control */; userBuildSettings = { }; }; - 089C167EFE841241C02AAC07 /* English */ = { + 089C167EFE841241C02AAC07 /* en */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {856, 377}}"; sepNavSelRange = "{717, 0}"; sepNavVisRange = "{0, 717}"; }; }; 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {856, 361}}"; sepNavSelRange = "{421, 0}"; sepNavVisRange = "{0, 914}"; }; }; 8D255AC50486D3F9007BF209 /* XamhainII */ = { activeExec = 0; }; 8D255AD20486D3F9007BF209 /* Info.plist */ = { uiCtxt = { sepNavWindowFrame = "{{28, 265}, {750, 558}}"; }; }; } diff --git a/XamhainII.xcodeproj/project.pbxproj b/XamhainII.xcodeproj/project.pbxproj index 2dd1bb3..0005457 100644 --- a/XamhainII.xcodeproj/project.pbxproj +++ b/XamhainII.xcodeproj/project.pbxproj @@ -1,744 +1,752 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 45; objects = { /* Begin PBXAggregateTarget section */ 000D03D61089C45F003F010E /* XamhainII.dmg */ = { isa = PBXAggregateTarget; buildConfigurationList = 000D03DC1089C467003F010E /* Build configuration list for PBXAggregateTarget "XamhainII.dmg" */; buildPhases = ( 000D03D51089C45F003F010E /* ShellScript */, ); dependencies = ( 000D03DA1089C465003F010E /* PBXTargetDependency */, ); name = XamhainII.dmg; productName = XamhainII.dmg; }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ - 00151B9A109A2BAA00CFFD7F /* XamhainConfigureSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 00151B99109A2BAA00CFFD7F /* XamhainConfigureSheet.xib */; }; 002438561098D6E100E8A351 /* KnotStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002438541098D6E100E8A351 /* KnotStyle.cpp */; }; 0032D326108A30770033FA87 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0032D325108A30770033FA87 /* OpenGL.framework */; }; 00790DBF10996796007ABF04 /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = 00790DBE10996796007ABF04 /* COPYING */; }; 00791844108B081B00156D67 /* XamhainPreferences.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00791842108B081B00156D67 /* XamhainPreferences.mm */; }; 007C512B108A29BE00ED3242 /* RandomColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007C5127108A29BE00ED3242 /* RandomColor.cpp */; }; + 007CBA0310A596B6004F3B49 /* XamhainConfigureSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 007CBA0210A596B6004F3B49 /* XamhainConfigureSheet.xib */; }; 007ED8661090CD6800B01235 /* CircularKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8581090CD6800B01235 /* CircularKnot.cpp */; }; 007ED8681090CD6800B01235 /* ClosedKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */; }; 007ED86A1090CD6800B01235 /* HorizontalKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */; }; 007ED86C1090CD6800B01235 /* RandomKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85E1090CD6800B01235 /* RandomKnot.cpp */; }; 007ED86E1090CD6800B01235 /* RectangularKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8601090CD6800B01235 /* RectangularKnot.cpp */; }; 007ED8701090CD6800B01235 /* TiledKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8621090CD6800B01235 /* TiledKnot.cpp */; }; 007ED8721090CD6800B01235 /* VerticalKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8641090CD6800B01235 /* VerticalKnot.cpp */; }; 00926762109A0BF600B2EF52 /* defaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 00926761109A0BF600B2EF52 /* defaults.plist */; }; 0096345E109B5B6700B26FC2 /* XamhainUserDefaultsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */; }; 009D8964108E251800A416CF /* Stroke.mm in Sources */ = {isa = PBXBuildFile; fileRef = 009D8962108E251800A416CF /* Stroke.mm */; }; 009D897C108E28C800A416CF /* StrokeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D897A108E28C800A416CF /* StrokeSet.cpp */; }; 00D188B11094BA31004E4496 /* XamhainGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */; }; 00D7B656108F8E9A00432E90 /* KnotSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00D7B654108F8E9A00432E90 /* KnotSection.cpp */; }; 00DA7802107A728C0094FCAB /* broad_fill_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */; }; 00DA7803107A728C0094FCAB /* broad_fill_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */; }; 00DA7804107A728C0094FCAB /* broad_fill_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */; }; 00DA7805107A728C0094FCAB /* broad_fill_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */; }; 00DA7806107A728C0094FCAB /* broad_fill_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */; }; 00DA7807107A728C0094FCAB /* broad_fill_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */; }; 00DA7808107A728C0094FCAB /* broad_fill_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */; }; 00DA7809107A728C0094FCAB /* broad_fill_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */; }; 00DA780A107A728C0094FCAB /* broad_fill_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */; }; 00DA780B107A728C0094FCAB /* broad_fill_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */; }; 00DA780C107A728C0094FCAB /* broad_fill_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */; }; 00DA780D107A728C0094FCAB /* broad_outline_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */; }; 00DA780E107A728C0094FCAB /* broad_outline_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */; }; 00DA780F107A728C0094FCAB /* broad_outline_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */; }; 00DA7810107A728C0094FCAB /* broad_outline_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */; }; 00DA7811107A728C0094FCAB /* broad_outline_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */; }; 00DA7812107A728C0094FCAB /* broad_outline_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */; }; 00DA7813107A728C0094FCAB /* broad_outline_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */; }; 00DA7814107A728C0094FCAB /* broad_outline_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */; }; 00DA7815107A728C0094FCAB /* broad_outline_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */; }; 00DA7816107A728C0094FCAB /* broad_outline_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */; }; 00DA7817107A728C0094FCAB /* broad_outline_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */; }; 00DA7818107A728C0094FCAB /* slender_fill_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */; }; 00DA7819107A728C0094FCAB /* slender_fill_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */; }; 00DA781A107A728C0094FCAB /* slender_fill_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */; }; 00DA781B107A728C0094FCAB /* slender_fill_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */; }; 00DA781C107A728C0094FCAB /* slender_fill_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */; }; 00DA781D107A728C0094FCAB /* slender_fill_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */; }; 00DA781E107A728C0094FCAB /* slender_fill_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */; }; 00DA781F107A728C0094FCAB /* slender_fill_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */; }; 00DA7820107A728C0094FCAB /* slender_fill_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */; }; 00DA7821107A728C0094FCAB /* slender_fill_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */; }; 00DA7822107A728C0094FCAB /* slender_fill_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */; }; 00DA7823107A728C0094FCAB /* slender_outline_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */; }; 00DA7824107A728C0094FCAB /* slender_outline_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */; }; 00DA7825107A728C0094FCAB /* slender_outline_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */; }; 00DA7826107A728C0094FCAB /* slender_outline_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */; }; 00DA7827107A728C0094FCAB /* slender_outline_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */; }; 00DA7828107A728C0094FCAB /* slender_outline_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */; }; 00DA7829107A728C0094FCAB /* slender_outline_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */; }; 00DA782A107A728C0094FCAB /* slender_outline_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */; }; 00DA782B107A728C0094FCAB /* slender_outline_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */; }; 00DA782C107A728C0094FCAB /* slender_outline_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */; }; 00DA782D107A728C0094FCAB /* slender_outline_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */; }; 00DA7838107A73320094FCAB /* XamhainView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00DA7836107A73320094FCAB /* XamhainView.mm */; }; 8D255ACA0486D3F9007BF209 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 8D255ACE0486D3F9007BF209 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; 8D255ACF0486D3F9007BF209 /* ScreenSaver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 000D03D91089C465003F010E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 089C1669FE841209C02AAC07 /* Project object */; proxyType = 1; remoteGlobalIDString = 8D255AC50486D3F9007BF209; remoteInfo = XamhainII; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 000AE53A109B577E00DCDFD0 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; 000AE53D109B57FC00DCDFD0 /* CREDITS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CREDITS; sourceTree = "<group>"; }; - 00151B99109A2BAA00CFFD7F /* XamhainConfigureSheet.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XamhainConfigureSheet.xib; sourceTree = "<group>"; }; + 00151B99109A2BAA00CFFD7F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/XamhainConfigureSheet.xib; sourceTree = "<group>"; }; 001EA1D5109365FC00D05EFB /* XamhainGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainGLView.h; path = "screen saving/XamhainGLView.h"; sourceTree = "<group>"; }; 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainGLView.mm; path = "screen saving/XamhainGLView.mm"; sourceTree = "<group>"; }; 002438531098D6E100E8A351 /* KnotStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KnotStyle.h; path = "knot engine/KnotStyle.h"; sourceTree = "<group>"; }; 002438541098D6E100E8A351 /* KnotStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KnotStyle.cpp; path = "knot engine/KnotStyle.cpp"; sourceTree = "<group>"; }; 0032D325108A30770033FA87 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; 00790DBE10996796007ABF04 /* COPYING */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = COPYING; sourceTree = "<group>"; }; 00791842108B081B00156D67 /* XamhainPreferences.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainPreferences.mm; path = "screen saving/XamhainPreferences.mm"; sourceTree = "<group>"; }; 00791843108B081B00156D67 /* XamhainPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainPreferences.h; path = "screen saving/XamhainPreferences.h"; sourceTree = "<group>"; }; 007C5126108A29BE00ED3242 /* Position.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Position.h; path = utility/Position.h; sourceTree = "<group>"; }; 007C5127108A29BE00ED3242 /* RandomColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RandomColor.cpp; path = utility/RandomColor.cpp; sourceTree = "<group>"; }; 007C5128108A29BE00ED3242 /* RandomColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomColor.h; path = utility/RandomColor.h; sourceTree = "<group>"; }; 007C5129108A29BE00ED3242 /* RandomNumbers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomNumbers.h; path = utility/RandomNumbers.h; sourceTree = "<group>"; }; 007ED8581090CD6800B01235 /* CircularKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CircularKnot.cpp; path = "knot engine/CircularKnot.cpp"; sourceTree = "<group>"; }; 007ED8591090CD6800B01235 /* CircularKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CircularKnot.h; path = "knot engine/CircularKnot.h"; sourceTree = "<group>"; }; 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClosedKnot.cpp; path = "knot engine/ClosedKnot.cpp"; sourceTree = "<group>"; }; 007ED85B1090CD6800B01235 /* ClosedKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClosedKnot.h; path = "knot engine/ClosedKnot.h"; sourceTree = "<group>"; }; 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HorizontalKnot.cpp; path = "knot engine/HorizontalKnot.cpp"; sourceTree = "<group>"; }; 007ED85D1090CD6800B01235 /* HorizontalKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HorizontalKnot.h; path = "knot engine/HorizontalKnot.h"; sourceTree = "<group>"; }; 007ED85E1090CD6800B01235 /* RandomKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RandomKnot.cpp; path = "knot engine/RandomKnot.cpp"; sourceTree = "<group>"; }; 007ED85F1090CD6800B01235 /* RandomKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomKnot.h; path = "knot engine/RandomKnot.h"; sourceTree = "<group>"; }; 007ED8601090CD6800B01235 /* RectangularKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RectangularKnot.cpp; path = "knot engine/RectangularKnot.cpp"; sourceTree = "<group>"; }; 007ED8611090CD6800B01235 /* RectangularKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RectangularKnot.h; path = "knot engine/RectangularKnot.h"; sourceTree = "<group>"; }; 007ED8621090CD6800B01235 /* TiledKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TiledKnot.cpp; path = "knot engine/TiledKnot.cpp"; sourceTree = "<group>"; }; 007ED8631090CD6800B01235 /* TiledKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiledKnot.h; path = "knot engine/TiledKnot.h"; sourceTree = "<group>"; }; 007ED8641090CD6800B01235 /* VerticalKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VerticalKnot.cpp; path = "knot engine/VerticalKnot.cpp"; sourceTree = "<group>"; }; 007ED8651090CD6800B01235 /* VerticalKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VerticalKnot.h; path = "knot engine/VerticalKnot.h"; sourceTree = "<group>"; }; 00926761109A0BF600B2EF52 /* defaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = defaults.plist; sourceTree = "<group>"; }; 0096345B109B5B6700B26FC2 /* XamhainUserDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainUserDefaultsController.h; path = "screen saving/XamhainUserDefaultsController.h"; sourceTree = "<group>"; }; 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainUserDefaultsController.mm; path = "screen saving/XamhainUserDefaultsController.mm"; sourceTree = "<group>"; }; 009D8962108E251800A416CF /* Stroke.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Stroke.mm; path = "knot engine/Stroke.mm"; sourceTree = "<group>"; }; 009D8963108E251800A416CF /* Stroke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stroke.h; path = "knot engine/Stroke.h"; sourceTree = "<group>"; }; 009D897A108E28C800A416CF /* StrokeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StrokeSet.cpp; path = "knot engine/StrokeSet.cpp"; sourceTree = "<group>"; }; 009D897B108E28C800A416CF /* StrokeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrokeSet.h; path = "knot engine/StrokeSet.h"; sourceTree = "<group>"; }; 00D7B654108F8E9A00432E90 /* KnotSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KnotSection.cpp; path = "knot engine/KnotSection.cpp"; sourceTree = "<group>"; }; 00D7B655108F8E9A00432E90 /* KnotSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KnotSection.h; path = "knot engine/KnotSection.h"; sourceTree = "<group>"; }; 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_corner.pdf; sourceTree = "<group>"; }; 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DDD.pdf; sourceTree = "<group>"; }; 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHD.pdf; sourceTree = "<group>"; }; 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHH.pdf; sourceTree = "<group>"; }; 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHV.pdf; sourceTree = "<group>"; }; 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDD.pdf; sourceTree = "<group>"; }; 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDH.pdf; sourceTree = "<group>"; }; 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDV.pdf; sourceTree = "<group>"; }; 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HHH.pdf; sourceTree = "<group>"; }; 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HHV.pdf; sourceTree = "<group>"; }; 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HVV.pdf; sourceTree = "<group>"; }; 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_corner.pdf; sourceTree = "<group>"; }; 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DDD.pdf; sourceTree = "<group>"; }; 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHD.pdf; sourceTree = "<group>"; }; 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHH.pdf; sourceTree = "<group>"; }; 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHV.pdf; sourceTree = "<group>"; }; 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDD.pdf; sourceTree = "<group>"; }; 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDH.pdf; sourceTree = "<group>"; }; 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDV.pdf; sourceTree = "<group>"; }; 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HHH.pdf; sourceTree = "<group>"; }; 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HHV.pdf; sourceTree = "<group>"; }; 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HVV.pdf; sourceTree = "<group>"; }; 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_corner.pdf; sourceTree = "<group>"; }; 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DDD.pdf; sourceTree = "<group>"; }; 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHD.pdf; sourceTree = "<group>"; }; 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHH.pdf; sourceTree = "<group>"; }; 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHV.pdf; sourceTree = "<group>"; }; 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDD.pdf; sourceTree = "<group>"; }; 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDH.pdf; sourceTree = "<group>"; }; 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDV.pdf; sourceTree = "<group>"; }; 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HHH.pdf; sourceTree = "<group>"; }; 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HHV.pdf; sourceTree = "<group>"; }; 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HVV.pdf; sourceTree = "<group>"; }; 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_corner.pdf; sourceTree = "<group>"; }; 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DDD.pdf; sourceTree = "<group>"; }; 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHD.pdf; sourceTree = "<group>"; }; 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHH.pdf; sourceTree = "<group>"; }; 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHV.pdf; sourceTree = "<group>"; }; 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDD.pdf; sourceTree = "<group>"; }; 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDH.pdf; sourceTree = "<group>"; }; 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDV.pdf; sourceTree = "<group>"; }; 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HHH.pdf; sourceTree = "<group>"; }; 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HHV.pdf; sourceTree = "<group>"; }; 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HVV.pdf; sourceTree = "<group>"; }; 00DA7835107A73320094FCAB /* XamhainView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainView.h; path = "screen saving/XamhainView.h"; sourceTree = "<group>"; }; 00DA7836107A73320094FCAB /* XamhainView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainView.mm; path = "screen saving/XamhainView.mm"; sourceTree = "<group>"; }; 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScreenSaver.framework; path = /System/Library/Frameworks/ScreenSaver.framework; sourceTree = "<absolute>"; }; 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 089C167EFE841241C02AAC07 /* en */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XamhainII_Prefix.pch; sourceTree = "<group>"; }; 8D255AD20486D3F9007BF209 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D255AD30486D3F9007BF209 /* XamhainII.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XamhainII.saver; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D255ACD0486D3F9007BF209 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D255ACE0486D3F9007BF209 /* Cocoa.framework in Frameworks */, 8D255ACF0486D3F9007BF209 /* ScreenSaver.framework in Frameworks */, 0032D326108A30770033FA87 /* OpenGL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 007C5125108A299800ED3242 /* Utility */ = { isa = PBXGroup; children = ( 007C5126108A29BE00ED3242 /* Position.h */, 007C5127108A29BE00ED3242 /* RandomColor.cpp */, 007C5128108A29BE00ED3242 /* RandomColor.h */, 007C5129108A29BE00ED3242 /* RandomNumbers.h */, ); name = Utility; sourceTree = "<group>"; }; 009D8961108E24ED00A416CF /* Knot Engine */ = { isa = PBXGroup; children = ( 002438531098D6E100E8A351 /* KnotStyle.h */, 002438541098D6E100E8A351 /* KnotStyle.cpp */, 007ED8581090CD6800B01235 /* CircularKnot.cpp */, 007ED8591090CD6800B01235 /* CircularKnot.h */, 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */, 007ED85B1090CD6800B01235 /* ClosedKnot.h */, 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */, 007ED85D1090CD6800B01235 /* HorizontalKnot.h */, 007ED85E1090CD6800B01235 /* RandomKnot.cpp */, 007ED85F1090CD6800B01235 /* RandomKnot.h */, 007ED8601090CD6800B01235 /* RectangularKnot.cpp */, 007ED8611090CD6800B01235 /* RectangularKnot.h */, 007ED8621090CD6800B01235 /* TiledKnot.cpp */, 007ED8631090CD6800B01235 /* TiledKnot.h */, 007ED8641090CD6800B01235 /* VerticalKnot.cpp */, 007ED8651090CD6800B01235 /* VerticalKnot.h */, 00D7B654108F8E9A00432E90 /* KnotSection.cpp */, 00D7B655108F8E9A00432E90 /* KnotSection.h */, 009D897A108E28C800A416CF /* StrokeSet.cpp */, 009D897B108E28C800A416CF /* StrokeSet.h */, 009D8962108E251800A416CF /* Stroke.mm */, 009D8963108E251800A416CF /* Stroke.h */, ); name = "Knot Engine"; sourceTree = "<group>"; }; 00DA77D5107A728C0094FCAB /* Strokes */ = { isa = PBXGroup; children = ( 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */, 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */, 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */, 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */, 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */, 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */, 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */, 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */, 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */, 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */, 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */, 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */, 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */, 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */, 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */, 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */, 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */, 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */, 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */, 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */, 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */, 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */, 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */, 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */, 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */, 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */, 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */, 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */, 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */, 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */, 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */, 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */, 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */, 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */, 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */, 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */, 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */, 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */, 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */, 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */, 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */, 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */, 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */, 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */, ); name = Strokes; path = strokes; sourceTree = "<group>"; }; 00DA7833107A72F00094FCAB /* Screen Saving */ = { isa = PBXGroup; children = ( 001EA1D5109365FC00D05EFB /* XamhainGLView.h */, 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */, 00791842108B081B00156D67 /* XamhainPreferences.mm */, 00791843108B081B00156D67 /* XamhainPreferences.h */, 00DA7835107A73320094FCAB /* XamhainView.h */, 00DA7836107A73320094FCAB /* XamhainView.mm */, 0096345B109B5B6700B26FC2 /* XamhainUserDefaultsController.h */, 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */, ); name = "Screen Saving"; sourceTree = "<group>"; }; 089C166AFE841209C02AAC07 /* XamhainII */ = { isa = PBXGroup; children = ( 009D8961108E24ED00A416CF /* Knot Engine */, 00DA7833107A72F00094FCAB /* Screen Saving */, 007C5125108A299800ED3242 /* Utility */, 32DBCFA70370C4F300C91783 /* Other Sources */, 089C167CFE841241C02AAC07 /* Resources */, 089C1671FE841209C02AAC07 /* Frameworks and Libraries */, 19C28FB8FE9D52D311CA2CBB /* Products */, ); name = XamhainII; sourceTree = "<group>"; }; 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { isa = PBXGroup; children = ( 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, ); name = "Frameworks and Libraries"; sourceTree = "<group>"; }; 089C167CFE841241C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 000AE53D109B57FC00DCDFD0 /* CREDITS */, 00926761109A0BF600B2EF52 /* defaults.plist */, 00790DBE10996796007ABF04 /* COPYING */, 00DA77D5107A728C0094FCAB /* Strokes */, 8D255AD20486D3F9007BF209 /* Info.plist */, 089C167DFE841241C02AAC07 /* InfoPlist.strings */, - 00151B99109A2BAA00CFFD7F /* XamhainConfigureSheet.xib */, + 007CBA0210A596B6004F3B49 /* XamhainConfigureSheet.xib */, 000AE53A109B577E00DCDFD0 /* README */, ); name = Resources; sourceTree = "<group>"; }; 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, 0032D325108A30770033FA87 /* OpenGL.framework */, 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; }; 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 089C1672FE841209C02AAC07 /* Foundation.framework */, 089C167FFE841241C02AAC07 /* AppKit.framework */, ); name = "Other Frameworks"; sourceTree = "<group>"; }; 19C28FB8FE9D52D311CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D255AD30486D3F9007BF209 /* XamhainII.saver */, ); name = Products; sourceTree = "<group>"; }; 32DBCFA70370C4F300C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */, ); name = "Other Sources"; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8D255AC60486D3F9007BF209 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8D255AC50486D3F9007BF209 /* XamhainII */ = { isa = PBXNativeTarget; buildConfigurationList = EF7AD72D08BB986600CE4634 /* Build configuration list for PBXNativeTarget "XamhainII" */; buildPhases = ( 8D255AC60486D3F9007BF209 /* Headers */, 8D255AC90486D3F9007BF209 /* Resources */, 8D255ACB0486D3F9007BF209 /* Sources */, 8D255ACD0486D3F9007BF209 /* Frameworks */, 8D255AD00486D3F9007BF209 /* Rez */, ); buildRules = ( ); dependencies = ( ); name = XamhainII; productInstallPath = "$(HOME)/Library/Screen Savers"; productName = XamhainII; productReference = 8D255AD30486D3F9007BF209 /* XamhainII.saver */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = EF7AD73108BB986600CE4634 /* Build configuration list for PBXProject "XamhainII" */; compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 089C166AFE841209C02AAC07 /* XamhainII */; projectDirPath = ""; projectRoot = ""; targets = ( 8D255AC50486D3F9007BF209 /* XamhainII */, 000D03D61089C45F003F010E /* XamhainII.dmg */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D255AC90486D3F9007BF209 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D255ACA0486D3F9007BF209 /* InfoPlist.strings in Resources */, 00DA7802107A728C0094FCAB /* broad_fill_corner.pdf in Resources */, 00DA7803107A728C0094FCAB /* broad_fill_DDD.pdf in Resources */, 00DA7804107A728C0094FCAB /* broad_fill_DHD.pdf in Resources */, 00DA7805107A728C0094FCAB /* broad_fill_DHH.pdf in Resources */, 00DA7806107A728C0094FCAB /* broad_fill_DHV.pdf in Resources */, 00DA7807107A728C0094FCAB /* broad_fill_HDD.pdf in Resources */, 00DA7808107A728C0094FCAB /* broad_fill_HDH.pdf in Resources */, 00DA7809107A728C0094FCAB /* broad_fill_HDV.pdf in Resources */, 00DA780A107A728C0094FCAB /* broad_fill_HHH.pdf in Resources */, 00DA780B107A728C0094FCAB /* broad_fill_HHV.pdf in Resources */, 00DA780C107A728C0094FCAB /* broad_fill_HVV.pdf in Resources */, 00DA780D107A728C0094FCAB /* broad_outline_corner.pdf in Resources */, 00DA780E107A728C0094FCAB /* broad_outline_DDD.pdf in Resources */, 00DA780F107A728C0094FCAB /* broad_outline_DHD.pdf in Resources */, 00DA7810107A728C0094FCAB /* broad_outline_DHH.pdf in Resources */, 00DA7811107A728C0094FCAB /* broad_outline_DHV.pdf in Resources */, 00DA7812107A728C0094FCAB /* broad_outline_HDD.pdf in Resources */, 00DA7813107A728C0094FCAB /* broad_outline_HDH.pdf in Resources */, 00DA7814107A728C0094FCAB /* broad_outline_HDV.pdf in Resources */, 00DA7815107A728C0094FCAB /* broad_outline_HHH.pdf in Resources */, 00DA7816107A728C0094FCAB /* broad_outline_HHV.pdf in Resources */, 00DA7817107A728C0094FCAB /* broad_outline_HVV.pdf in Resources */, 00DA7818107A728C0094FCAB /* slender_fill_corner.pdf in Resources */, 00DA7819107A728C0094FCAB /* slender_fill_DDD.pdf in Resources */, 00DA781A107A728C0094FCAB /* slender_fill_DHD.pdf in Resources */, 00DA781B107A728C0094FCAB /* slender_fill_DHH.pdf in Resources */, 00DA781C107A728C0094FCAB /* slender_fill_DHV.pdf in Resources */, 00DA781D107A728C0094FCAB /* slender_fill_HDD.pdf in Resources */, 00DA781E107A728C0094FCAB /* slender_fill_HDH.pdf in Resources */, 00DA781F107A728C0094FCAB /* slender_fill_HDV.pdf in Resources */, 00DA7820107A728C0094FCAB /* slender_fill_HHH.pdf in Resources */, 00DA7821107A728C0094FCAB /* slender_fill_HHV.pdf in Resources */, 00DA7822107A728C0094FCAB /* slender_fill_HVV.pdf in Resources */, 00DA7823107A728C0094FCAB /* slender_outline_corner.pdf in Resources */, 00DA7824107A728C0094FCAB /* slender_outline_DDD.pdf in Resources */, 00DA7825107A728C0094FCAB /* slender_outline_DHD.pdf in Resources */, 00DA7826107A728C0094FCAB /* slender_outline_DHH.pdf in Resources */, 00DA7827107A728C0094FCAB /* slender_outline_DHV.pdf in Resources */, 00DA7828107A728C0094FCAB /* slender_outline_HDD.pdf in Resources */, 00DA7829107A728C0094FCAB /* slender_outline_HDH.pdf in Resources */, 00DA782A107A728C0094FCAB /* slender_outline_HDV.pdf in Resources */, 00DA782B107A728C0094FCAB /* slender_outline_HHH.pdf in Resources */, 00DA782C107A728C0094FCAB /* slender_outline_HHV.pdf in Resources */, 00DA782D107A728C0094FCAB /* slender_outline_HVV.pdf in Resources */, 00790DBF10996796007ABF04 /* COPYING in Resources */, 00926762109A0BF600B2EF52 /* defaults.plist in Resources */, - 00151B9A109A2BAA00CFFD7F /* XamhainConfigureSheet.xib in Resources */, + 007CBA0310A596B6004F3B49 /* XamhainConfigureSheet.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXRezBuildPhase section */ 8D255AD00486D3F9007BF209 /* Rez */ = { isa = PBXRezBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXRezBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 000D03D51089C45F003F010E /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(SRCROOT)/$(PROJECT_NAME)-orig.dmg", "$(BUILT_PRODUCTS_DIR)/$(PROJECT_NAME).saver", "$(SRCROOT)/COPYING", "$(SRCROOT)/CREDITS", "$(SRCROOT)/README", ); outputPaths = ( "$(BUILT_PRODUCTS_DIR)/$(PROJECT_NAME).dmg", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "# See http://jwz.livejournal.com/608927.html?thread=11477151#t11477151\n# for the basic idea behind this. Originally based on a script by Rob Mayoff\n# which did it rather differently.\n\nset -ex\n\n[ \"$ACTION\" = build ] || exit 0\n[ \"$BUILD_VARIANTS\" = \"normal\" ] || exit 0\n\norig=\"$SRCROOT/misc/$PROJECT_NAME-orig.dmg\"\ndmg=\"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg\"\nmnt=\"/Volumes/$PROJECT_NAME\"\n\n[ -e $mnt ] && exit 1\n\n# Attach the original image\nhdiutil attach -shadow $orig.shadow $orig\n\n# Copy files\nrsync -avE \"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.saver\" $mnt\ncp \"$SRCROOT/COPYING\" $mnt/Info\ncp \"$SRCROOT/CREDITS\" $mnt/Info\ncp \"$SRCROOT/README\" $mnt/Info\n\n# Detach the image\nhdiutil detach $mnt\n\n# Now convert to a compressed read-only image\nhdiutil convert -ov -format UDZO -o $dmg -shadow $orig.shadow $orig\nhdiutil internet-enable -yes \"$dmg\"\nrm -f $orig.shadow\n"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D255ACB0486D3F9007BF209 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 00DA7838107A73320094FCAB /* XamhainView.mm in Sources */, 007C512B108A29BE00ED3242 /* RandomColor.cpp in Sources */, 00791844108B081B00156D67 /* XamhainPreferences.mm in Sources */, 009D8964108E251800A416CF /* Stroke.mm in Sources */, 009D897C108E28C800A416CF /* StrokeSet.cpp in Sources */, 00D7B656108F8E9A00432E90 /* KnotSection.cpp in Sources */, 007ED8661090CD6800B01235 /* CircularKnot.cpp in Sources */, 007ED8681090CD6800B01235 /* ClosedKnot.cpp in Sources */, 007ED86A1090CD6800B01235 /* HorizontalKnot.cpp in Sources */, 007ED86C1090CD6800B01235 /* RandomKnot.cpp in Sources */, 007ED86E1090CD6800B01235 /* RectangularKnot.cpp in Sources */, 007ED8701090CD6800B01235 /* TiledKnot.cpp in Sources */, 007ED8721090CD6800B01235 /* VerticalKnot.cpp in Sources */, 00D188B11094BA31004E4496 /* XamhainGLView.mm in Sources */, 002438561098D6E100E8A351 /* KnotStyle.cpp in Sources */, 0096345E109B5B6700B26FC2 /* XamhainUserDefaultsController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 000D03DA1089C465003F010E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 8D255AC50486D3F9007BF209 /* XamhainII */; targetProxy = 000D03D91089C465003F010E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 007CBA0210A596B6004F3B49 /* XamhainConfigureSheet.xib */ = { + isa = PBXVariantGroup; + children = ( + 00151B99109A2BAA00CFFD7F /* en */, + ); + name = XamhainConfigureSheet.xib; + sourceTree = "<group>"; + }; 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C167EFE841241C02AAC07 /* English */, + 089C167EFE841241C02AAC07 /* en */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 000D03D71089C45F003F010E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; PRODUCT_NAME = XamhainII.dmg; }; name = Debug; }; 000D03D81089C45F003F010E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; PRODUCT_NAME = XamhainII.dmg; ZERO_LINK = NO; }; name = Release; }; EF7AD72E08BB986600CE4634 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_ENABLE_OBJC_GC = required; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = XamhainII_Prefix.pch; GCC_STRICT_ALIASING = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; PRODUCT_NAME = XamhainII; WRAPPER_EXTENSION = saver; ZERO_LINK = YES; }; name = Debug; }; EF7AD72F08BB986600CE4634 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_OBJC_GC = required; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = XamhainII_Prefix.pch; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; PRODUCT_NAME = XamhainII; WRAPPER_EXTENSION = saver; }; name = Release; }; EF7AD73208BB986600CE4634 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = NO; PREBINDING = NO; SDKROOT = macosx10.6; }; name = Debug; }; EF7AD73308BB986600CE4634 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; SDKROOT = macosx10.6; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 000D03DC1089C467003F010E /* Build configuration list for PBXAggregateTarget "XamhainII.dmg" */ = { isa = XCConfigurationList; buildConfigurations = ( 000D03D71089C45F003F010E /* Debug */, 000D03D81089C45F003F010E /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; EF7AD72D08BB986600CE4634 /* Build configuration list for PBXNativeTarget "XamhainII" */ = { isa = XCConfigurationList; buildConfigurations = ( EF7AD72E08BB986600CE4634 /* Debug */, EF7AD72F08BB986600CE4634 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; EF7AD73108BB986600CE4634 /* Build configuration list for PBXProject "XamhainII" */ = { isa = XCConfigurationList; buildConfigurations = ( EF7AD73208BB986600CE4634 /* Debug */, EF7AD73308BB986600CE4634 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 089C1669FE841209C02AAC07 /* Project object */; } diff --git a/English.lproj/InfoPlist.strings b/en.lproj/InfoPlist.strings similarity index 100% rename from English.lproj/InfoPlist.strings rename to en.lproj/InfoPlist.strings diff --git a/XamhainConfigureSheet.xib b/en.lproj/XamhainConfigureSheet.xib similarity index 100% rename from XamhainConfigureSheet.xib rename to en.lproj/XamhainConfigureSheet.xib
jjk/XamhainII
07ffffda4003caa06b7f75aa01b7124ac5f70362
Build a nice installable package.
diff --git a/XamhainII.xcodeproj/project.pbxproj b/XamhainII.xcodeproj/project.pbxproj index 9e73d03..2dd1bb3 100644 --- a/XamhainII.xcodeproj/project.pbxproj +++ b/XamhainII.xcodeproj/project.pbxproj @@ -7,737 +7,738 @@ objects = { /* Begin PBXAggregateTarget section */ 000D03D61089C45F003F010E /* XamhainII.dmg */ = { isa = PBXAggregateTarget; buildConfigurationList = 000D03DC1089C467003F010E /* Build configuration list for PBXAggregateTarget "XamhainII.dmg" */; buildPhases = ( 000D03D51089C45F003F010E /* ShellScript */, ); dependencies = ( 000D03DA1089C465003F010E /* PBXTargetDependency */, ); name = XamhainII.dmg; productName = XamhainII.dmg; }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ 00151B9A109A2BAA00CFFD7F /* XamhainConfigureSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 00151B99109A2BAA00CFFD7F /* XamhainConfigureSheet.xib */; }; 002438561098D6E100E8A351 /* KnotStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002438541098D6E100E8A351 /* KnotStyle.cpp */; }; 0032D326108A30770033FA87 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0032D325108A30770033FA87 /* OpenGL.framework */; }; 00790DBF10996796007ABF04 /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = 00790DBE10996796007ABF04 /* COPYING */; }; 00791844108B081B00156D67 /* XamhainPreferences.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00791842108B081B00156D67 /* XamhainPreferences.mm */; }; 007C512B108A29BE00ED3242 /* RandomColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007C5127108A29BE00ED3242 /* RandomColor.cpp */; }; 007ED8661090CD6800B01235 /* CircularKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8581090CD6800B01235 /* CircularKnot.cpp */; }; 007ED8681090CD6800B01235 /* ClosedKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */; }; 007ED86A1090CD6800B01235 /* HorizontalKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */; }; 007ED86C1090CD6800B01235 /* RandomKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED85E1090CD6800B01235 /* RandomKnot.cpp */; }; 007ED86E1090CD6800B01235 /* RectangularKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8601090CD6800B01235 /* RectangularKnot.cpp */; }; 007ED8701090CD6800B01235 /* TiledKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8621090CD6800B01235 /* TiledKnot.cpp */; }; 007ED8721090CD6800B01235 /* VerticalKnot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 007ED8641090CD6800B01235 /* VerticalKnot.cpp */; }; 00926762109A0BF600B2EF52 /* defaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 00926761109A0BF600B2EF52 /* defaults.plist */; }; 0096345E109B5B6700B26FC2 /* XamhainUserDefaultsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */; }; 009D8964108E251800A416CF /* Stroke.mm in Sources */ = {isa = PBXBuildFile; fileRef = 009D8962108E251800A416CF /* Stroke.mm */; }; 009D897C108E28C800A416CF /* StrokeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D897A108E28C800A416CF /* StrokeSet.cpp */; }; 00D188B11094BA31004E4496 /* XamhainGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */; }; 00D7B656108F8E9A00432E90 /* KnotSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00D7B654108F8E9A00432E90 /* KnotSection.cpp */; }; 00DA7802107A728C0094FCAB /* broad_fill_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */; }; 00DA7803107A728C0094FCAB /* broad_fill_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */; }; 00DA7804107A728C0094FCAB /* broad_fill_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */; }; 00DA7805107A728C0094FCAB /* broad_fill_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */; }; 00DA7806107A728C0094FCAB /* broad_fill_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */; }; 00DA7807107A728C0094FCAB /* broad_fill_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */; }; 00DA7808107A728C0094FCAB /* broad_fill_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */; }; 00DA7809107A728C0094FCAB /* broad_fill_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */; }; 00DA780A107A728C0094FCAB /* broad_fill_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */; }; 00DA780B107A728C0094FCAB /* broad_fill_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */; }; 00DA780C107A728C0094FCAB /* broad_fill_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */; }; 00DA780D107A728C0094FCAB /* broad_outline_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */; }; 00DA780E107A728C0094FCAB /* broad_outline_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */; }; 00DA780F107A728C0094FCAB /* broad_outline_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */; }; 00DA7810107A728C0094FCAB /* broad_outline_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */; }; 00DA7811107A728C0094FCAB /* broad_outline_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */; }; 00DA7812107A728C0094FCAB /* broad_outline_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */; }; 00DA7813107A728C0094FCAB /* broad_outline_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */; }; 00DA7814107A728C0094FCAB /* broad_outline_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */; }; 00DA7815107A728C0094FCAB /* broad_outline_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */; }; 00DA7816107A728C0094FCAB /* broad_outline_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */; }; 00DA7817107A728C0094FCAB /* broad_outline_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */; }; 00DA7818107A728C0094FCAB /* slender_fill_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */; }; 00DA7819107A728C0094FCAB /* slender_fill_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */; }; 00DA781A107A728C0094FCAB /* slender_fill_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */; }; 00DA781B107A728C0094FCAB /* slender_fill_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */; }; 00DA781C107A728C0094FCAB /* slender_fill_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */; }; 00DA781D107A728C0094FCAB /* slender_fill_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */; }; 00DA781E107A728C0094FCAB /* slender_fill_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */; }; 00DA781F107A728C0094FCAB /* slender_fill_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */; }; 00DA7820107A728C0094FCAB /* slender_fill_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */; }; 00DA7821107A728C0094FCAB /* slender_fill_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */; }; 00DA7822107A728C0094FCAB /* slender_fill_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */; }; 00DA7823107A728C0094FCAB /* slender_outline_corner.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */; }; 00DA7824107A728C0094FCAB /* slender_outline_DDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */; }; 00DA7825107A728C0094FCAB /* slender_outline_DHD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */; }; 00DA7826107A728C0094FCAB /* slender_outline_DHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */; }; 00DA7827107A728C0094FCAB /* slender_outline_DHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */; }; 00DA7828107A728C0094FCAB /* slender_outline_HDD.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */; }; 00DA7829107A728C0094FCAB /* slender_outline_HDH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */; }; 00DA782A107A728C0094FCAB /* slender_outline_HDV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */; }; 00DA782B107A728C0094FCAB /* slender_outline_HHH.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */; }; 00DA782C107A728C0094FCAB /* slender_outline_HHV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */; }; 00DA782D107A728C0094FCAB /* slender_outline_HVV.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */; }; 00DA7838107A73320094FCAB /* XamhainView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00DA7836107A73320094FCAB /* XamhainView.mm */; }; 8D255ACA0486D3F9007BF209 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 8D255ACE0486D3F9007BF209 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; 8D255ACF0486D3F9007BF209 /* ScreenSaver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 000D03D91089C465003F010E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 089C1669FE841209C02AAC07 /* Project object */; proxyType = 1; remoteGlobalIDString = 8D255AC50486D3F9007BF209; remoteInfo = XamhainII; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 000AE53A109B577E00DCDFD0 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; 000AE53D109B57FC00DCDFD0 /* CREDITS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CREDITS; sourceTree = "<group>"; }; 00151B99109A2BAA00CFFD7F /* XamhainConfigureSheet.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XamhainConfigureSheet.xib; sourceTree = "<group>"; }; 001EA1D5109365FC00D05EFB /* XamhainGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainGLView.h; path = "screen saving/XamhainGLView.h"; sourceTree = "<group>"; }; 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainGLView.mm; path = "screen saving/XamhainGLView.mm"; sourceTree = "<group>"; }; 002438531098D6E100E8A351 /* KnotStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KnotStyle.h; path = "knot engine/KnotStyle.h"; sourceTree = "<group>"; }; 002438541098D6E100E8A351 /* KnotStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KnotStyle.cpp; path = "knot engine/KnotStyle.cpp"; sourceTree = "<group>"; }; 0032D325108A30770033FA87 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; 00790DBE10996796007ABF04 /* COPYING */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = COPYING; sourceTree = "<group>"; }; 00791842108B081B00156D67 /* XamhainPreferences.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainPreferences.mm; path = "screen saving/XamhainPreferences.mm"; sourceTree = "<group>"; }; 00791843108B081B00156D67 /* XamhainPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainPreferences.h; path = "screen saving/XamhainPreferences.h"; sourceTree = "<group>"; }; 007C5126108A29BE00ED3242 /* Position.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Position.h; path = utility/Position.h; sourceTree = "<group>"; }; 007C5127108A29BE00ED3242 /* RandomColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RandomColor.cpp; path = utility/RandomColor.cpp; sourceTree = "<group>"; }; 007C5128108A29BE00ED3242 /* RandomColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomColor.h; path = utility/RandomColor.h; sourceTree = "<group>"; }; 007C5129108A29BE00ED3242 /* RandomNumbers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomNumbers.h; path = utility/RandomNumbers.h; sourceTree = "<group>"; }; 007ED8581090CD6800B01235 /* CircularKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CircularKnot.cpp; path = "knot engine/CircularKnot.cpp"; sourceTree = "<group>"; }; 007ED8591090CD6800B01235 /* CircularKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CircularKnot.h; path = "knot engine/CircularKnot.h"; sourceTree = "<group>"; }; 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClosedKnot.cpp; path = "knot engine/ClosedKnot.cpp"; sourceTree = "<group>"; }; 007ED85B1090CD6800B01235 /* ClosedKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClosedKnot.h; path = "knot engine/ClosedKnot.h"; sourceTree = "<group>"; }; 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HorizontalKnot.cpp; path = "knot engine/HorizontalKnot.cpp"; sourceTree = "<group>"; }; 007ED85D1090CD6800B01235 /* HorizontalKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HorizontalKnot.h; path = "knot engine/HorizontalKnot.h"; sourceTree = "<group>"; }; 007ED85E1090CD6800B01235 /* RandomKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RandomKnot.cpp; path = "knot engine/RandomKnot.cpp"; sourceTree = "<group>"; }; 007ED85F1090CD6800B01235 /* RandomKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RandomKnot.h; path = "knot engine/RandomKnot.h"; sourceTree = "<group>"; }; 007ED8601090CD6800B01235 /* RectangularKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RectangularKnot.cpp; path = "knot engine/RectangularKnot.cpp"; sourceTree = "<group>"; }; 007ED8611090CD6800B01235 /* RectangularKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RectangularKnot.h; path = "knot engine/RectangularKnot.h"; sourceTree = "<group>"; }; 007ED8621090CD6800B01235 /* TiledKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TiledKnot.cpp; path = "knot engine/TiledKnot.cpp"; sourceTree = "<group>"; }; 007ED8631090CD6800B01235 /* TiledKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiledKnot.h; path = "knot engine/TiledKnot.h"; sourceTree = "<group>"; }; 007ED8641090CD6800B01235 /* VerticalKnot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VerticalKnot.cpp; path = "knot engine/VerticalKnot.cpp"; sourceTree = "<group>"; }; 007ED8651090CD6800B01235 /* VerticalKnot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VerticalKnot.h; path = "knot engine/VerticalKnot.h"; sourceTree = "<group>"; }; 00926761109A0BF600B2EF52 /* defaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = defaults.plist; sourceTree = "<group>"; }; 0096345B109B5B6700B26FC2 /* XamhainUserDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainUserDefaultsController.h; path = "screen saving/XamhainUserDefaultsController.h"; sourceTree = "<group>"; }; 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainUserDefaultsController.mm; path = "screen saving/XamhainUserDefaultsController.mm"; sourceTree = "<group>"; }; 009D8962108E251800A416CF /* Stroke.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Stroke.mm; path = "knot engine/Stroke.mm"; sourceTree = "<group>"; }; 009D8963108E251800A416CF /* Stroke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stroke.h; path = "knot engine/Stroke.h"; sourceTree = "<group>"; }; 009D897A108E28C800A416CF /* StrokeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StrokeSet.cpp; path = "knot engine/StrokeSet.cpp"; sourceTree = "<group>"; }; 009D897B108E28C800A416CF /* StrokeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StrokeSet.h; path = "knot engine/StrokeSet.h"; sourceTree = "<group>"; }; 00D7B654108F8E9A00432E90 /* KnotSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KnotSection.cpp; path = "knot engine/KnotSection.cpp"; sourceTree = "<group>"; }; 00D7B655108F8E9A00432E90 /* KnotSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KnotSection.h; path = "knot engine/KnotSection.h"; sourceTree = "<group>"; }; 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_corner.pdf; sourceTree = "<group>"; }; 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DDD.pdf; sourceTree = "<group>"; }; 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHD.pdf; sourceTree = "<group>"; }; 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHH.pdf; sourceTree = "<group>"; }; 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_DHV.pdf; sourceTree = "<group>"; }; 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDD.pdf; sourceTree = "<group>"; }; 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDH.pdf; sourceTree = "<group>"; }; 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HDV.pdf; sourceTree = "<group>"; }; 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HHH.pdf; sourceTree = "<group>"; }; 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HHV.pdf; sourceTree = "<group>"; }; 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_fill_HVV.pdf; sourceTree = "<group>"; }; 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_corner.pdf; sourceTree = "<group>"; }; 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DDD.pdf; sourceTree = "<group>"; }; 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHD.pdf; sourceTree = "<group>"; }; 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHH.pdf; sourceTree = "<group>"; }; 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_DHV.pdf; sourceTree = "<group>"; }; 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDD.pdf; sourceTree = "<group>"; }; 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDH.pdf; sourceTree = "<group>"; }; 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HDV.pdf; sourceTree = "<group>"; }; 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HHH.pdf; sourceTree = "<group>"; }; 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HHV.pdf; sourceTree = "<group>"; }; 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = broad_outline_HVV.pdf; sourceTree = "<group>"; }; 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_corner.pdf; sourceTree = "<group>"; }; 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DDD.pdf; sourceTree = "<group>"; }; 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHD.pdf; sourceTree = "<group>"; }; 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHH.pdf; sourceTree = "<group>"; }; 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_DHV.pdf; sourceTree = "<group>"; }; 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDD.pdf; sourceTree = "<group>"; }; 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDH.pdf; sourceTree = "<group>"; }; 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HDV.pdf; sourceTree = "<group>"; }; 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HHH.pdf; sourceTree = "<group>"; }; 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HHV.pdf; sourceTree = "<group>"; }; 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_fill_HVV.pdf; sourceTree = "<group>"; }; 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_corner.pdf; sourceTree = "<group>"; }; 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DDD.pdf; sourceTree = "<group>"; }; 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHD.pdf; sourceTree = "<group>"; }; 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHH.pdf; sourceTree = "<group>"; }; 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_DHV.pdf; sourceTree = "<group>"; }; 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDD.pdf; sourceTree = "<group>"; }; 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDH.pdf; sourceTree = "<group>"; }; 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HDV.pdf; sourceTree = "<group>"; }; 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HHH.pdf; sourceTree = "<group>"; }; 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HHV.pdf; sourceTree = "<group>"; }; 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = slender_outline_HVV.pdf; sourceTree = "<group>"; }; 00DA7835107A73320094FCAB /* XamhainView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XamhainView.h; path = "screen saving/XamhainView.h"; sourceTree = "<group>"; }; 00DA7836107A73320094FCAB /* XamhainView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = XamhainView.mm; path = "screen saving/XamhainView.mm"; sourceTree = "<group>"; }; 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScreenSaver.framework; path = /System/Library/Frameworks/ScreenSaver.framework; sourceTree = "<absolute>"; }; 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XamhainII_Prefix.pch; sourceTree = "<group>"; }; 8D255AD20486D3F9007BF209 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D255AD30486D3F9007BF209 /* XamhainII.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XamhainII.saver; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D255ACD0486D3F9007BF209 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D255ACE0486D3F9007BF209 /* Cocoa.framework in Frameworks */, 8D255ACF0486D3F9007BF209 /* ScreenSaver.framework in Frameworks */, 0032D326108A30770033FA87 /* OpenGL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 007C5125108A299800ED3242 /* Utility */ = { isa = PBXGroup; children = ( 007C5126108A29BE00ED3242 /* Position.h */, 007C5127108A29BE00ED3242 /* RandomColor.cpp */, 007C5128108A29BE00ED3242 /* RandomColor.h */, 007C5129108A29BE00ED3242 /* RandomNumbers.h */, ); name = Utility; sourceTree = "<group>"; }; 009D8961108E24ED00A416CF /* Knot Engine */ = { isa = PBXGroup; children = ( 002438531098D6E100E8A351 /* KnotStyle.h */, 002438541098D6E100E8A351 /* KnotStyle.cpp */, 007ED8581090CD6800B01235 /* CircularKnot.cpp */, 007ED8591090CD6800B01235 /* CircularKnot.h */, 007ED85A1090CD6800B01235 /* ClosedKnot.cpp */, 007ED85B1090CD6800B01235 /* ClosedKnot.h */, 007ED85C1090CD6800B01235 /* HorizontalKnot.cpp */, 007ED85D1090CD6800B01235 /* HorizontalKnot.h */, 007ED85E1090CD6800B01235 /* RandomKnot.cpp */, 007ED85F1090CD6800B01235 /* RandomKnot.h */, 007ED8601090CD6800B01235 /* RectangularKnot.cpp */, 007ED8611090CD6800B01235 /* RectangularKnot.h */, 007ED8621090CD6800B01235 /* TiledKnot.cpp */, 007ED8631090CD6800B01235 /* TiledKnot.h */, 007ED8641090CD6800B01235 /* VerticalKnot.cpp */, 007ED8651090CD6800B01235 /* VerticalKnot.h */, 00D7B654108F8E9A00432E90 /* KnotSection.cpp */, 00D7B655108F8E9A00432E90 /* KnotSection.h */, 009D897A108E28C800A416CF /* StrokeSet.cpp */, 009D897B108E28C800A416CF /* StrokeSet.h */, 009D8962108E251800A416CF /* Stroke.mm */, 009D8963108E251800A416CF /* Stroke.h */, ); name = "Knot Engine"; sourceTree = "<group>"; }; 00DA77D5107A728C0094FCAB /* Strokes */ = { isa = PBXGroup; children = ( 00DA77D6107A728C0094FCAB /* broad_fill_corner.pdf */, 00DA77D7107A728C0094FCAB /* broad_fill_DDD.pdf */, 00DA77D8107A728C0094FCAB /* broad_fill_DHD.pdf */, 00DA77D9107A728C0094FCAB /* broad_fill_DHH.pdf */, 00DA77DA107A728C0094FCAB /* broad_fill_DHV.pdf */, 00DA77DB107A728C0094FCAB /* broad_fill_HDD.pdf */, 00DA77DC107A728C0094FCAB /* broad_fill_HDH.pdf */, 00DA77DD107A728C0094FCAB /* broad_fill_HDV.pdf */, 00DA77DE107A728C0094FCAB /* broad_fill_HHH.pdf */, 00DA77DF107A728C0094FCAB /* broad_fill_HHV.pdf */, 00DA77E0107A728C0094FCAB /* broad_fill_HVV.pdf */, 00DA77E1107A728C0094FCAB /* broad_outline_corner.pdf */, 00DA77E2107A728C0094FCAB /* broad_outline_DDD.pdf */, 00DA77E3107A728C0094FCAB /* broad_outline_DHD.pdf */, 00DA77E4107A728C0094FCAB /* broad_outline_DHH.pdf */, 00DA77E5107A728C0094FCAB /* broad_outline_DHV.pdf */, 00DA77E6107A728C0094FCAB /* broad_outline_HDD.pdf */, 00DA77E7107A728C0094FCAB /* broad_outline_HDH.pdf */, 00DA77E8107A728C0094FCAB /* broad_outline_HDV.pdf */, 00DA77E9107A728C0094FCAB /* broad_outline_HHH.pdf */, 00DA77EA107A728C0094FCAB /* broad_outline_HHV.pdf */, 00DA77EB107A728C0094FCAB /* broad_outline_HVV.pdf */, 00DA77EC107A728C0094FCAB /* slender_fill_corner.pdf */, 00DA77ED107A728C0094FCAB /* slender_fill_DDD.pdf */, 00DA77EE107A728C0094FCAB /* slender_fill_DHD.pdf */, 00DA77EF107A728C0094FCAB /* slender_fill_DHH.pdf */, 00DA77F0107A728C0094FCAB /* slender_fill_DHV.pdf */, 00DA77F1107A728C0094FCAB /* slender_fill_HDD.pdf */, 00DA77F2107A728C0094FCAB /* slender_fill_HDH.pdf */, 00DA77F3107A728C0094FCAB /* slender_fill_HDV.pdf */, 00DA77F4107A728C0094FCAB /* slender_fill_HHH.pdf */, 00DA77F5107A728C0094FCAB /* slender_fill_HHV.pdf */, 00DA77F6107A728C0094FCAB /* slender_fill_HVV.pdf */, 00DA77F7107A728C0094FCAB /* slender_outline_corner.pdf */, 00DA77F8107A728C0094FCAB /* slender_outline_DDD.pdf */, 00DA77F9107A728C0094FCAB /* slender_outline_DHD.pdf */, 00DA77FA107A728C0094FCAB /* slender_outline_DHH.pdf */, 00DA77FB107A728C0094FCAB /* slender_outline_DHV.pdf */, 00DA77FC107A728C0094FCAB /* slender_outline_HDD.pdf */, 00DA77FD107A728C0094FCAB /* slender_outline_HDH.pdf */, 00DA77FE107A728C0094FCAB /* slender_outline_HDV.pdf */, 00DA77FF107A728C0094FCAB /* slender_outline_HHH.pdf */, 00DA7800107A728C0094FCAB /* slender_outline_HHV.pdf */, 00DA7801107A728C0094FCAB /* slender_outline_HVV.pdf */, ); name = Strokes; path = strokes; sourceTree = "<group>"; }; 00DA7833107A72F00094FCAB /* Screen Saving */ = { isa = PBXGroup; children = ( 001EA1D5109365FC00D05EFB /* XamhainGLView.h */, 001EA1D6109365FC00D05EFB /* XamhainGLView.mm */, 00791842108B081B00156D67 /* XamhainPreferences.mm */, 00791843108B081B00156D67 /* XamhainPreferences.h */, 00DA7835107A73320094FCAB /* XamhainView.h */, 00DA7836107A73320094FCAB /* XamhainView.mm */, 0096345B109B5B6700B26FC2 /* XamhainUserDefaultsController.h */, 0096345C109B5B6700B26FC2 /* XamhainUserDefaultsController.mm */, ); name = "Screen Saving"; sourceTree = "<group>"; }; 089C166AFE841209C02AAC07 /* XamhainII */ = { isa = PBXGroup; children = ( 009D8961108E24ED00A416CF /* Knot Engine */, 00DA7833107A72F00094FCAB /* Screen Saving */, 007C5125108A299800ED3242 /* Utility */, 32DBCFA70370C4F300C91783 /* Other Sources */, 089C167CFE841241C02AAC07 /* Resources */, 089C1671FE841209C02AAC07 /* Frameworks and Libraries */, 19C28FB8FE9D52D311CA2CBB /* Products */, ); name = XamhainII; sourceTree = "<group>"; }; 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { isa = PBXGroup; children = ( 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, ); name = "Frameworks and Libraries"; sourceTree = "<group>"; }; 089C167CFE841241C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 000AE53D109B57FC00DCDFD0 /* CREDITS */, 00926761109A0BF600B2EF52 /* defaults.plist */, 00790DBE10996796007ABF04 /* COPYING */, 00DA77D5107A728C0094FCAB /* Strokes */, 8D255AD20486D3F9007BF209 /* Info.plist */, 089C167DFE841241C02AAC07 /* InfoPlist.strings */, 00151B99109A2BAA00CFFD7F /* XamhainConfigureSheet.xib */, 000AE53A109B577E00DCDFD0 /* README */, ); name = Resources; sourceTree = "<group>"; }; 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, 0032D325108A30770033FA87 /* OpenGL.framework */, 06F27B2DFFEEEFEF11CA0E56 /* ScreenSaver.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; }; 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 089C1672FE841209C02AAC07 /* Foundation.framework */, 089C167FFE841241C02AAC07 /* AppKit.framework */, ); name = "Other Frameworks"; sourceTree = "<group>"; }; 19C28FB8FE9D52D311CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D255AD30486D3F9007BF209 /* XamhainII.saver */, ); name = Products; sourceTree = "<group>"; }; 32DBCFA70370C4F300C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 32DBCFA80370C50100C91783 /* XamhainII_Prefix.pch */, ); name = "Other Sources"; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8D255AC60486D3F9007BF209 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8D255AC50486D3F9007BF209 /* XamhainII */ = { isa = PBXNativeTarget; buildConfigurationList = EF7AD72D08BB986600CE4634 /* Build configuration list for PBXNativeTarget "XamhainII" */; buildPhases = ( 8D255AC60486D3F9007BF209 /* Headers */, 8D255AC90486D3F9007BF209 /* Resources */, 8D255ACB0486D3F9007BF209 /* Sources */, 8D255ACD0486D3F9007BF209 /* Frameworks */, 8D255AD00486D3F9007BF209 /* Rez */, ); buildRules = ( ); dependencies = ( ); name = XamhainII; productInstallPath = "$(HOME)/Library/Screen Savers"; productName = XamhainII; productReference = 8D255AD30486D3F9007BF209 /* XamhainII.saver */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = EF7AD73108BB986600CE4634 /* Build configuration list for PBXProject "XamhainII" */; compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 089C166AFE841209C02AAC07 /* XamhainII */; projectDirPath = ""; projectRoot = ""; targets = ( 8D255AC50486D3F9007BF209 /* XamhainII */, 000D03D61089C45F003F010E /* XamhainII.dmg */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D255AC90486D3F9007BF209 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D255ACA0486D3F9007BF209 /* InfoPlist.strings in Resources */, 00DA7802107A728C0094FCAB /* broad_fill_corner.pdf in Resources */, 00DA7803107A728C0094FCAB /* broad_fill_DDD.pdf in Resources */, 00DA7804107A728C0094FCAB /* broad_fill_DHD.pdf in Resources */, 00DA7805107A728C0094FCAB /* broad_fill_DHH.pdf in Resources */, 00DA7806107A728C0094FCAB /* broad_fill_DHV.pdf in Resources */, 00DA7807107A728C0094FCAB /* broad_fill_HDD.pdf in Resources */, 00DA7808107A728C0094FCAB /* broad_fill_HDH.pdf in Resources */, 00DA7809107A728C0094FCAB /* broad_fill_HDV.pdf in Resources */, 00DA780A107A728C0094FCAB /* broad_fill_HHH.pdf in Resources */, 00DA780B107A728C0094FCAB /* broad_fill_HHV.pdf in Resources */, 00DA780C107A728C0094FCAB /* broad_fill_HVV.pdf in Resources */, 00DA780D107A728C0094FCAB /* broad_outline_corner.pdf in Resources */, 00DA780E107A728C0094FCAB /* broad_outline_DDD.pdf in Resources */, 00DA780F107A728C0094FCAB /* broad_outline_DHD.pdf in Resources */, 00DA7810107A728C0094FCAB /* broad_outline_DHH.pdf in Resources */, 00DA7811107A728C0094FCAB /* broad_outline_DHV.pdf in Resources */, 00DA7812107A728C0094FCAB /* broad_outline_HDD.pdf in Resources */, 00DA7813107A728C0094FCAB /* broad_outline_HDH.pdf in Resources */, 00DA7814107A728C0094FCAB /* broad_outline_HDV.pdf in Resources */, 00DA7815107A728C0094FCAB /* broad_outline_HHH.pdf in Resources */, 00DA7816107A728C0094FCAB /* broad_outline_HHV.pdf in Resources */, 00DA7817107A728C0094FCAB /* broad_outline_HVV.pdf in Resources */, 00DA7818107A728C0094FCAB /* slender_fill_corner.pdf in Resources */, 00DA7819107A728C0094FCAB /* slender_fill_DDD.pdf in Resources */, 00DA781A107A728C0094FCAB /* slender_fill_DHD.pdf in Resources */, 00DA781B107A728C0094FCAB /* slender_fill_DHH.pdf in Resources */, 00DA781C107A728C0094FCAB /* slender_fill_DHV.pdf in Resources */, 00DA781D107A728C0094FCAB /* slender_fill_HDD.pdf in Resources */, 00DA781E107A728C0094FCAB /* slender_fill_HDH.pdf in Resources */, 00DA781F107A728C0094FCAB /* slender_fill_HDV.pdf in Resources */, 00DA7820107A728C0094FCAB /* slender_fill_HHH.pdf in Resources */, 00DA7821107A728C0094FCAB /* slender_fill_HHV.pdf in Resources */, 00DA7822107A728C0094FCAB /* slender_fill_HVV.pdf in Resources */, 00DA7823107A728C0094FCAB /* slender_outline_corner.pdf in Resources */, 00DA7824107A728C0094FCAB /* slender_outline_DDD.pdf in Resources */, 00DA7825107A728C0094FCAB /* slender_outline_DHD.pdf in Resources */, 00DA7826107A728C0094FCAB /* slender_outline_DHH.pdf in Resources */, 00DA7827107A728C0094FCAB /* slender_outline_DHV.pdf in Resources */, 00DA7828107A728C0094FCAB /* slender_outline_HDD.pdf in Resources */, 00DA7829107A728C0094FCAB /* slender_outline_HDH.pdf in Resources */, 00DA782A107A728C0094FCAB /* slender_outline_HDV.pdf in Resources */, 00DA782B107A728C0094FCAB /* slender_outline_HHH.pdf in Resources */, 00DA782C107A728C0094FCAB /* slender_outline_HHV.pdf in Resources */, 00DA782D107A728C0094FCAB /* slender_outline_HVV.pdf in Resources */, 00790DBF10996796007ABF04 /* COPYING in Resources */, 00926762109A0BF600B2EF52 /* defaults.plist in Resources */, 00151B9A109A2BAA00CFFD7F /* XamhainConfigureSheet.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXRezBuildPhase section */ 8D255AD00486D3F9007BF209 /* Rez */ = { isa = PBXRezBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXRezBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 000D03D51089C45F003F010E /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "$(BUILT_PRODUCTS_DIR)/XamhainII.saver", + "$(SRCROOT)/$(PROJECT_NAME)-orig.dmg", + "$(BUILT_PRODUCTS_DIR)/$(PROJECT_NAME).saver", "$(SRCROOT)/COPYING", "$(SRCROOT)/CREDITS", "$(SRCROOT)/README", ); outputPaths = ( - "$(BUILT_PRODUCTS_DIR)/XamhainII.dmg", + "$(BUILT_PRODUCTS_DIR)/$(PROJECT_NAME).dmg", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Thanks to Rob Mayoff for explaining how to do this.\n# See http://qwan.org/2007/05/22/using-xcode-to-build-a-disk-image-and-upload-a-web-site/\n\nset -ex\n\n[ \"$ACTION\" = build ] || exit 0\n[ \"$BUILD_VARIANTS\" = \"normal\" ] || exit 0\n\ndir=\"$TEMP_FILES_DIR/disk\"\ndmg=\"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg\"\n\nrm -rf \"$dir\"\nmkdir \"$dir\"\ncp -R \"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.saver\" \"$dir\"\ncp -R \"$SRCROOT/COPYING\" \"$dir\"\ncp -R \"$SRCROOT/CREDITS\" \"$dir\"\ncp -R \"$SRCROOT/README\" \"$dir\"\nrm -f \"$dmg\"\nhdiutil create -srcfolder \"$dir\" -volname \"$PROJECT_NAME\" \"$dmg\"\nhdiutil internet-enable -yes \"$dmg\"\nrm -rf \"$dir\"\n"; + shellScript = "# See http://jwz.livejournal.com/608927.html?thread=11477151#t11477151\n# for the basic idea behind this. Originally based on a script by Rob Mayoff\n# which did it rather differently.\n\nset -ex\n\n[ \"$ACTION\" = build ] || exit 0\n[ \"$BUILD_VARIANTS\" = \"normal\" ] || exit 0\n\norig=\"$SRCROOT/misc/$PROJECT_NAME-orig.dmg\"\ndmg=\"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.dmg\"\nmnt=\"/Volumes/$PROJECT_NAME\"\n\n[ -e $mnt ] && exit 1\n\n# Attach the original image\nhdiutil attach -shadow $orig.shadow $orig\n\n# Copy files\nrsync -avE \"$BUILT_PRODUCTS_DIR/$PROJECT_NAME.saver\" $mnt\ncp \"$SRCROOT/COPYING\" $mnt/Info\ncp \"$SRCROOT/CREDITS\" $mnt/Info\ncp \"$SRCROOT/README\" $mnt/Info\n\n# Detach the image\nhdiutil detach $mnt\n\n# Now convert to a compressed read-only image\nhdiutil convert -ov -format UDZO -o $dmg -shadow $orig.shadow $orig\nhdiutil internet-enable -yes \"$dmg\"\nrm -f $orig.shadow\n"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D255ACB0486D3F9007BF209 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 00DA7838107A73320094FCAB /* XamhainView.mm in Sources */, 007C512B108A29BE00ED3242 /* RandomColor.cpp in Sources */, 00791844108B081B00156D67 /* XamhainPreferences.mm in Sources */, 009D8964108E251800A416CF /* Stroke.mm in Sources */, 009D897C108E28C800A416CF /* StrokeSet.cpp in Sources */, 00D7B656108F8E9A00432E90 /* KnotSection.cpp in Sources */, 007ED8661090CD6800B01235 /* CircularKnot.cpp in Sources */, 007ED8681090CD6800B01235 /* ClosedKnot.cpp in Sources */, 007ED86A1090CD6800B01235 /* HorizontalKnot.cpp in Sources */, 007ED86C1090CD6800B01235 /* RandomKnot.cpp in Sources */, 007ED86E1090CD6800B01235 /* RectangularKnot.cpp in Sources */, 007ED8701090CD6800B01235 /* TiledKnot.cpp in Sources */, 007ED8721090CD6800B01235 /* VerticalKnot.cpp in Sources */, 00D188B11094BA31004E4496 /* XamhainGLView.mm in Sources */, 002438561098D6E100E8A351 /* KnotStyle.cpp in Sources */, 0096345E109B5B6700B26FC2 /* XamhainUserDefaultsController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 000D03DA1089C465003F010E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 8D255AC50486D3F9007BF209 /* XamhainII */; targetProxy = 000D03D91089C465003F010E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 089C167EFE841241C02AAC07 /* English */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 000D03D71089C45F003F010E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; PRODUCT_NAME = XamhainII.dmg; }; name = Debug; }; 000D03D81089C45F003F010E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; PRODUCT_NAME = XamhainII.dmg; ZERO_LINK = NO; }; name = Release; }; EF7AD72E08BB986600CE4634 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_ENABLE_OBJC_GC = required; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = XamhainII_Prefix.pch; GCC_STRICT_ALIASING = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; PRODUCT_NAME = XamhainII; WRAPPER_EXTENSION = saver; ZERO_LINK = YES; }; name = Debug; }; EF7AD72F08BB986600CE4634 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_OBJC_GC = required; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = XamhainII_Prefix.pch; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; PRODUCT_NAME = XamhainII; WRAPPER_EXTENSION = saver; }; name = Release; }; EF7AD73208BB986600CE4634 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = NO; PREBINDING = NO; SDKROOT = macosx10.6; }; name = Debug; }; EF7AD73308BB986600CE4634 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; SDKROOT = macosx10.6; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 000D03DC1089C467003F010E /* Build configuration list for PBXAggregateTarget "XamhainII.dmg" */ = { isa = XCConfigurationList; buildConfigurations = ( 000D03D71089C45F003F010E /* Debug */, 000D03D81089C45F003F010E /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; EF7AD72D08BB986600CE4634 /* Build configuration list for PBXNativeTarget "XamhainII" */ = { isa = XCConfigurationList; buildConfigurations = ( EF7AD72E08BB986600CE4634 /* Debug */, EF7AD72F08BB986600CE4634 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; EF7AD73108BB986600CE4634 /* Build configuration list for PBXProject "XamhainII" */ = { isa = XCConfigurationList; buildConfigurations = ( EF7AD73208BB986600CE4634 /* Debug */, EF7AD73308BB986600CE4634 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 089C1669FE841209C02AAC07 /* Project object */; } diff --git a/misc/FolderBackground.png b/misc/FolderBackground.png new file mode 100644 index 0000000..25ab61e Binary files /dev/null and b/misc/FolderBackground.png differ diff --git a/misc/FolderBackground.qtz b/misc/FolderBackground.qtz new file mode 100644 index 0000000..666e552 Binary files /dev/null and b/misc/FolderBackground.qtz differ diff --git a/misc/FolderBackground2.png b/misc/FolderBackground2.png new file mode 100644 index 0000000..ea141ad Binary files /dev/null and b/misc/FolderBackground2.png differ diff --git a/misc/XamhainII-orig.dmg b/misc/XamhainII-orig.dmg new file mode 100644 index 0000000..70178c6 Binary files /dev/null and b/misc/XamhainII-orig.dmg differ diff --git a/misc/logo-broad.pdf b/misc/logo-broad.pdf new file mode 100644 index 0000000..8ed292a Binary files /dev/null and b/misc/logo-broad.pdf differ diff --git a/misc/logo-slender.pdf b/misc/logo-slender.pdf new file mode 100644 index 0000000..dd96b96 Binary files /dev/null and b/misc/logo-slender.pdf differ
jjk/XamhainII
2caa1165fbbd468e677b07b3ccba92f301adf53c
Touch up the UI a bit.
diff --git a/XamhainConfigureSheet.xib b/XamhainConfigureSheet.xib index 6a28435..abd3e8b 100644 --- a/XamhainConfigureSheet.xib +++ b/XamhainConfigureSheet.xib @@ -1,2740 +1,2863 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1060</int> <string key="IBDocument.SystemVersion">10B504</string> <string key="IBDocument.InterfaceBuilderVersion">732</string> <string key="IBDocument.AppKitVersion">1038.2</string> <string key="IBDocument.HIToolboxVersion">437.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="NS.object.0">732</string> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="149"/> + <integer value="53"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="1001"> <string key="NSClassName">XamhainUserDefaultsController</string> </object> <object class="NSCustomObject" id="1003"> <string key="NSClassName">FirstResponder</string> </object> <object class="NSCustomObject" id="1004"> <string key="NSClassName">NSApplication</string> </object> <object class="NSWindowTemplate" id="1005"> <int key="NSWindowStyleMask">1</int> <int key="NSWindowBacking">2</int> - <string key="NSWindowRect">{{0, 426}, {535, 452}}</string> + <string key="NSWindowRect">{{0, 428}, {530, 450}}</string> <int key="NSWTFlags">1886913536</int> <string key="NSWindowTitle">ConfigurationSheet</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> <object class="NSView" key="NSWindowView" id="1006"> <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSButton" id="1013048762"> <reference key="NSNextResponder" ref="1006"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{425, 12}, {96, 32}}</string> + <string key="NSFrame">{{420, 12}, {96, 32}}</string> <reference key="NSSuperview" ref="1006"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="328796931"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">OK</string> <object class="NSFont" key="NSSupport" id="872788741"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="1013048762"/> <int key="NSButtonFlags">-2037235457</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSButton" id="995501573"> <reference key="NSNextResponder" ref="1006"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{329, 12}, {96, 32}}</string> + <string key="NSFrame">{{320, 12}, {96, 32}}</string> <reference key="NSSuperview" ref="1006"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="770782373"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Cancel</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="995501573"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string type="base64-UTF8" key="NSKeyEquivalent">Gw</string> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSButton" id="654791710"> <reference key="NSNextResponder" ref="1006"/> <int key="NSvFlags">292</int> <string key="NSFrame">{{14, 12}, {148, 32}}</string> <reference key="NSSuperview" ref="1006"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="460152017"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Reset to Defaults</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="654791710"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSTabView" id="230448896"> <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">36</int> - <string key="NSFrame">{{13, 40}, {509, 398}}</string> + <int key="NSvFlags">12</int> + <string key="NSFrame">{{13, 40}, {504, 396}}</string> <reference key="NSSuperview" ref="1006"/> <object class="NSMutableArray" key="NSTabViewItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTabViewItem" id="510341909"> <string key="NSIdentifier">1</string> <object class="NSView" key="NSView" id="95880135"> <reference key="NSNextResponder" ref="230448896"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSBox" id="991520932"> <reference key="NSNextResponder" ref="95880135"/> - <int key="NSvFlags">36</int> + <int key="NSvFlags">12</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSView" id="386728850"> <reference key="NSNextResponder" ref="991520932"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextField" id="509241866"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{15, 91}, {75, 17}}</string> + <string key="NSFrame">{{15, 89}, {75, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="345948081"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Horizontal:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="509241866"/> <object class="NSColor" key="NSBackgroundColor" id="586021249"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlColor</string> <object class="NSColor" key="NSColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> </object> </object> <object class="NSColor" key="NSTextColor" id="671980879"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlTextColor</string> <object class="NSColor" key="NSColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MAA</bytes> </object> </object> </object> </object> <object class="NSTextField" id="1048896611"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{41, 16}, {49, 17}}</string> + <string key="NSFrame">{{41, 14}, {49, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="200609284"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Round:</string> <object class="NSFont" key="NSSupport" id="15919542"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="1048896611"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="282789491"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{224, 66}, {108, 17}}</string> + <string key="NSFrame">{{223, 64}, {108, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="167999035"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Solid vs. Hollow:</string> <reference key="NSSupport" ref="15919542"/> <reference key="NSControlView" ref="282789491"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSSlider" id="157709042"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{93, 37}, {105, 21}}</string> + <string key="NSFrame">{{93, 36}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="119847882"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="157709042"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSTextField" id="518638902"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{35, 64}, {56, 17}}</string> + <string key="NSFrame">{{34, 64}, {56, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="921169719"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Vertical:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="518638902"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="1052486056"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{201, 39}, {131, 17}}</string> + <string key="NSFrame">{{200, 39}, {131, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="902255367"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Straight vs. Skewed:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="1052486056"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSSlider" id="266837115"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{335, 10}, {104, 21}}</string> + <string key="NSFrame">{{334, 11}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="916736093"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="266837115"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSSlider" id="80225576"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{335, 62}, {104, 21}}</string> + <string key="NSFrame">{{334, 61}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="89720965"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="80225576"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSTextField" id="564558037"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{38, 41}, {52, 17}}</string> + <string key="NSFrame">{{38, 39}, {52, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="694139405"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Square:</string> <reference key="NSSupport" ref="15919542"/> <reference key="NSControlView" ref="564558037"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="481078677"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{215, 91}, {117, 17}}</string> + <string key="NSFrame">{{214, 89}, {117, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="598843304"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Slender vs. Broad:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="481078677"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSSlider" id="701649081"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{335, 89}, {104, 21}}</string> + <string key="NSFrame">{{334, 86}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="487908187"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="701649081"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSTextField" id="748740056"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{209, 14}, {123, 17}}</string> + <string key="NSFrame">{{208, 14}, {123, 17}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="674973427"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Fixed vs. Spinning:</string> <reference key="NSSupport" ref="15919542"/> <reference key="NSControlView" ref="748740056"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSSlider" id="929902514"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{93, 89}, {104, 21}}</string> + <string key="NSFrame">{{93, 86}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="110598254"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="929902514"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSSlider" id="242295069"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{93, 12}, {104, 21}}</string> + <string key="NSFrame">{{93, 11}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="686601725"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="242295069"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSSlider" id="770329762"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{94, 62}, {104, 21}}</string> + <string key="NSFrame">{{93, 61}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="1020163194"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="770329762"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSSlider" id="644913919"> <reference key="NSNextResponder" ref="386728850"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{335, 37}, {104, 21}}</string> + <string key="NSFrame">{{334, 36}, {104, 21}}</string> <reference key="NSSuperview" ref="386728850"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="1046562852"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="644913919"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> </object> - <string key="NSFrame">{{1, 1}, {455, 118}}</string> + <string key="NSFrame">{{1, 1}, {454, 116}}</string> <reference key="NSSuperview" ref="991520932"/> </object> </object> - <string key="NSFrame">{{18, 13}, {457, 134}}</string> + <string key="NSFrame">{{14, 13}, {456, 132}}</string> <reference key="NSSuperview" ref="95880135"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">0</int> <string key="NSContents">Knot Types</string> <object class="NSFont" key="NSSupport" id="26"> <string key="NSName">LucidaGrande</string> <double key="NSSize">11</double> <int key="NSfFlags">3100</int> </object> <object class="NSColor" key="NSBackgroundColor" id="445431265"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">textBackgroundColor</string> <object class="NSColor" key="NSColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MQA</bytes> </object> </object> <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> </object> </object> <reference key="NSContentView" ref="386728850"/> <int key="NSBorderType">1</int> <int key="NSBoxType">0</int> <int key="NSTitlePosition">2</int> <bool key="NSTransparent">NO</bool> </object> <object class="NSBox" id="585255460"> <reference key="NSNextResponder" ref="95880135"/> - <int key="NSvFlags">36</int> + <int key="NSvFlags">12</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSView" id="87759421"> <reference key="NSNextResponder" ref="585255460"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSSlider" id="532256007"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{104, 35}, {100, 21}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="993628458"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="532256007"/> <double key="NSMaxValue">10</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSSlider" id="371590425"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{245, 85}, {100, 21}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="41921744"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="371590425"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSTextField" id="307029731"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{207, 39}, {35, 17}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="898541514"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Max:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="307029731"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="95502372"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{27, 64}, {74, 17}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="302770213"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Speed Min:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="95502372"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSSlider" id="925722485"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{104, 85}, {100, 21}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="540516504"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="925722485"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSSlider" id="382885577"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{104, 60}, {100, 21}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="493858441"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="382885577"/> <double key="NSMaxValue">10</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSTextField" id="498595760"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{207, 89}, {35, 17}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="676380058"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Max:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="498595760"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="669058752"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{207, 64}, {35, 17}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="66600519"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Max:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="669058752"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="373610845"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{38, 39}, {63, 17}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="79947852"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Spin Min:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="373610845"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="599827838"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{40, 89}, {61, 17}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="130290391"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Size Min:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="599827838"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSSlider" id="659833234"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{245, 60}, {100, 21}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="404599171"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="659833234"/> <double key="NSMaxValue">10</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSSlider" id="527654156"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{245, 35}, {100, 21}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="747673443"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="527654156"/> <double key="NSMaxValue">10</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.0</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSButton" id="337999651"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{105, 12}, {18, 18}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="316809000"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents">Check</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="337999651"/> <int key="NSButtonFlags">1214534143</int> <int key="NSButtonFlags2">2</int> <object class="NSCustomResource" key="NSNormalImage"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSSwitch</string> </object> <object class="NSButtonImageSource" key="NSAlternateImage"> <string key="NSImageName">NSSwitch</string> </object> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSTextField" id="667726591"> <reference key="NSNextResponder" ref="87759421"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{15, 14}, {87, 17}}</string> <reference key="NSSuperview" ref="87759421"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1037067466"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Multicolored:</string> <reference key="NSSupport" ref="15919542"/> <reference key="NSControlView" ref="667726591"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> </object> - <string key="NSFrame">{{1, 1}, {455, 116}}</string> + <string key="NSFrame">{{1, 1}, {454, 116}}</string> <reference key="NSSuperview" ref="585255460"/> </object> </object> - <string key="NSFrame">{{18, 151}, {457, 132}}</string> + <string key="NSFrame">{{14, 149}, {456, 132}}</string> <reference key="NSSuperview" ref="95880135"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">0</int> <string key="NSContents">Knot Properties</string> <reference key="NSSupport" ref="26"/> <reference key="NSBackgroundColor" ref="445431265"/> <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> </object> </object> <reference key="NSContentView" ref="87759421"/> <int key="NSBorderType">1</int> <int key="NSBoxType">0</int> <int key="NSTitlePosition">2</int> <bool key="NSTransparent">NO</bool> </object> <object class="NSBox" id="724727501"> <reference key="NSNextResponder" ref="95880135"/> - <int key="NSvFlags">36</int> + <int key="NSvFlags">12</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSView" id="642879379"> <reference key="NSNextResponder" ref="724727501"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSSlider" id="461347810"> <reference key="NSNextResponder" ref="642879379"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{343, 13}, {100, 21}}</string> + <string key="NSFrame">{{327, 14}, {100, 21}}</string> <reference key="NSSuperview" ref="642879379"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="575720656"> <int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags2">0</int> <string key="NSContents"/> <reference key="NSControlView" ref="461347810"/> <double key="NSMaxValue">120</double> <double key="NSMinValue">1</double> <double key="NSValue">30</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">0</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">NO</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSTextField" id="415200325"> <reference key="NSNextResponder" ref="642879379"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{15, 17}, {116, 17}}</string> <reference key="NSSuperview" ref="642879379"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="759654285"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">71303168</int> <string key="NSContents">Number of Knots:</string> <reference key="NSSupport" ref="15919542"/> <reference key="NSControlView" ref="415200325"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="38819005"> <reference key="NSNextResponder" ref="642879379"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{136, 14}, {25, 22}}</string> <reference key="NSSuperview" ref="642879379"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="922564724"> <int key="NSCellFlags">343014977</int> <int key="NSCellFlags2">272700480</int> <string key="NSContents">99</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="38819005"/> <bool key="NSDrawsBackground">YES</bool> - <object class="NSColor" key="NSBackgroundColor"> + <object class="NSColor" key="NSBackgroundColor" id="571468162"> <int key="NSColorSpace">1</int> <bytes key="NSRGB">MSAxIDEAA</bytes> </object> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSTextField" id="1007515992"> <reference key="NSNextResponder" ref="642879379"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{252, 17}, {88, 17}}</string> + <string key="NSFrame">{{236, 17}, {88, 17}}</string> <reference key="NSSuperview" ref="642879379"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="55582849"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">71304192</int> <string key="NSContents">Refresh Rate:</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="1007515992"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> <object class="NSStepper" id="392143892"> <reference key="NSNextResponder" ref="642879379"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{166, 11}, {19, 27}}</string> <reference key="NSSuperview" ref="642879379"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSStepperCell" key="NSCell" id="154709998"> <int key="NSCellFlags">917024</int> <int key="NSCellFlags2">0</int> <reference key="NSControlView" ref="392143892"/> <double key="NSValue">8</double> <double key="NSMinValue">1</double> <double key="NSMaxValue">25</double> <double key="NSIncrement">1</double> <bool key="NSAutorepeat">YES</bool> </object> </object> </object> - <string key="NSFrame">{{1, 1}, {459, 46}}</string> + <string key="NSFrame">{{1, 1}, {454, 46}}</string> <reference key="NSSuperview" ref="724727501"/> </object> </object> - <string key="NSFrame">{{14, 287}, {461, 62}}</string> + <string key="NSFrame">{{14, 285}, {456, 62}}</string> <reference key="NSSuperview" ref="95880135"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">0</int> <string key="NSContents">Animation</string> <reference key="NSSupport" ref="26"/> <reference key="NSBackgroundColor" ref="445431265"/> <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> </object> </object> <reference key="NSContentView" ref="642879379"/> <int key="NSBorderType">1</int> <int key="NSBoxType">0</int> <int key="NSTitlePosition">2</int> <bool key="NSTransparent">NO</bool> </object> </object> - <string key="NSFrame">{{10, 33}, {489, 352}}</string> + <string key="NSFrame">{{10, 33}, {484, 350}}</string> <reference key="NSSuperview" ref="230448896"/> </object> <string key="NSLabel">General</string> <reference key="NSColor" ref="586021249"/> <reference key="NSTabView" ref="230448896"/> </object> <object class="NSTabViewItem" id="327961336"> <string key="NSIdentifier">2</string> <object class="NSView" key="NSView" id="962628448"> <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSTextField" id="87774458"> + <object class="NSTextField" id="78351454"> <reference key="NSNextResponder" ref="962628448"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{187, 209}, {114, 17}}</string> + <string key="NSFrame">{{14, 330}, {159, 17}}</string> <reference key="NSSuperview" ref="962628448"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="1063097842"> - <int key="NSCellFlags">68288064</int> - <int key="NSCellFlags2">272630784</int> - <string key="NSContents">Watch This Space</string> - <reference key="NSSupport" ref="872788741"/> - <reference key="NSControlView" ref="87774458"/> + <object class="NSTextFieldCell" key="NSCell" id="867004219"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">71303232</int> + <string key="NSContents">Number of Subdivisions:</string> + <reference key="NSSupport" ref="15919542"/> + <reference key="NSControlView" ref="78351454"/> <reference key="NSBackgroundColor" ref="586021249"/> <reference key="NSTextColor" ref="671980879"/> </object> </object> + <object class="NSTextField" id="810544083"> + <reference key="NSNextResponder" ref="962628448"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{178, 327}, {25, 22}}</string> + <reference key="NSSuperview" ref="962628448"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="449686934"> + <int key="NSCellFlags">343014977</int> + <int key="NSCellFlags2">272700480</int> + <string key="NSContents">99</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="810544083"/> + <bool key="NSDrawsBackground">YES</bool> + <reference key="NSBackgroundColor" ref="571468162"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSStepper" id="526320074"> + <reference key="NSNextResponder" ref="962628448"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{208, 324}, {19, 27}}</string> + <reference key="NSSuperview" ref="962628448"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSStepperCell" key="NSCell" id="969047062"> + <int key="NSCellFlags">917024</int> + <int key="NSCellFlags2">0</int> + <reference key="NSControlView" ref="526320074"/> + <double key="NSValue">8</double> + <double key="NSMinValue">1</double> + <double key="NSMaxValue">25</double> + <double key="NSIncrement">1</double> + <bool key="NSAutorepeat">YES</bool> + </object> + </object> </object> - <string key="NSFrame">{{10, 33}, {489, 352}}</string> + <string key="NSFrame">{{10, 33}, {484, 350}}</string> </object> <string key="NSLabel">Advanced</string> <reference key="NSColor" ref="586021249"/> <reference key="NSTabView" ref="230448896"/> </object> </object> <reference key="NSSelectedTabViewItem" ref="510341909"/> <reference key="NSFont" ref="872788741"/> <int key="NSTvFlags">0</int> <bool key="NSAllowTruncatedLabels">YES</bool> <bool key="NSDrawsBackground">YES</bool> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="95880135"/> </object> </object> </object> - <string key="NSFrameSize">{535, 452}</string> + <string key="NSFrameSize">{530, 450}</string> <reference key="NSSuperview"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> <object class="NSMutableArray" key="connectionRecords"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">mpConfigureSheet</string> <reference key="source" ref="1001"/> <reference key="destination" ref="1005"/> </object> <int key="connectionID">32</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">revertToInitialValues:</string> <reference key="source" ref="1001"/> <reference key="destination" ref="654791710"/> </object> <int key="connectionID">36</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">save:</string> <reference key="source" ref="1001"/> <reference key="destination" ref="1013048762"/> </object> <int key="connectionID">37</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">revert:</string> <reference key="source" ref="1001"/> <reference key="destination" ref="995501573"/> </object> <int key="connectionID">39</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.NumberOfKnots</string> <reference key="source" ref="38819005"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="38819005"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.NumberOfKnots</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.NumberOfKnots</string> <object class="NSDictionary" key="NSOptions"> <string key="NS.key.0">NSAllowsEditingMultipleValuesSelection</string> <boolean value="NO" key="NS.object.0"/> </object> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">49</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.NumberOfKnots</string> <reference key="source" ref="392143892"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="392143892"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.NumberOfKnots</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.NumberOfKnots</string> <object class="NSDictionary" key="NSOptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSAllowsEditingMultipleValuesSelection</string> <string>NSConditionallySetsEnabled</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <boolean value="NO"/> <boolean value="NO"/> </object> </object> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">50</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.TicksPerSecond</string> <reference key="source" ref="461347810"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="461347810"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.TicksPerSecond</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.TicksPerSecond</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">77</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.Technicolor</string> <reference key="source" ref="337999651"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="337999651"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.Technicolor</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.Technicolor</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">83</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.SkewProbability</string> <reference key="source" ref="644913919"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="644913919"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.SkewProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.SkewProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">116</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.SpinProbability</string> <reference key="source" ref="266837115"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="266837115"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.SpinProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.SpinProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">117</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.BroadKnotProbability</string> <reference key="source" ref="701649081"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="701649081"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.BroadKnotProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.BroadKnotProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">118</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.HollowKnotProbability</string> <reference key="source" ref="80225576"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="80225576"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.HollowKnotProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.HollowKnotProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">119</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.HorizontalKnotProbability</string> <reference key="source" ref="929902514"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="929902514"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.HorizontalKnotProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.HorizontalKnotProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">121</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.VerticalKnotProbability</string> <reference key="source" ref="770329762"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="770329762"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.VerticalKnotProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.VerticalKnotProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">122</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.ClosedKnotProbability</string> <reference key="source" ref="157709042"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="157709042"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.ClosedKnotProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.ClosedKnotProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">123</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.CircularKnotProbability</string> <reference key="source" ref="242295069"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="242295069"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.CircularKnotProbability</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.CircularKnotProbability</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">124</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.MinSpeed</string> <reference key="source" ref="382885577"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="382885577"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.MinSpeed</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.MinSpeed</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">166</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.MaxSpeed</string> <reference key="source" ref="659833234"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="659833234"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.MaxSpeed</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.MaxSpeed</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">168</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.MinSpin</string> <reference key="source" ref="532256007"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="532256007"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.MinSpin</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.MinSpin</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">170</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.MaxSpin</string> <reference key="source" ref="527654156"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="527654156"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.MaxSpin</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.MaxSpin</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">172</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.MinSize</string> <reference key="source" ref="925722485"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="925722485"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.MinSize</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.MinSize</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">176</int> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> <string key="label">value: values.MaxSize</string> <reference key="source" ref="371590425"/> <reference key="destination" ref="1001"/> <object class="NSNibBindingConnector" key="connector"> <reference key="NSSource" ref="371590425"/> <reference key="NSDestination" ref="1001"/> <string key="NSLabel">value: values.MaxSize</string> <string key="NSBinding">value</string> <string key="NSKeyPath">values.MaxSize</string> <int key="NSNibBindingConnectorVersion">2</int> </object> </object> <int key="connectionID">177</int> </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.KnotSubdivisions</string> + <reference key="source" ref="810544083"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="810544083"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.KnotSubdivisions</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.KnotSubdivisions</string> + <object class="NSDictionary" key="NSOptions"> + <string key="NS.key.0">NSAllowsEditingMultipleValuesSelection</string> + <boolean value="NO" key="NS.object.0"/> + </object> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">186</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.KnotSubdivisions</string> + <reference key="source" ref="526320074"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="526320074"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.KnotSubdivisions</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.KnotSubdivisions</string> + <object class="NSDictionary" key="NSOptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSAllowsEditingMultipleValuesSelection</string> + <string>NSConditionallySetsEnabled</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <boolean value="NO"/> + <boolean value="NO"/> + </object> + </object> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">187</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> <reference key="object" ref="0"/> <reference key="children" ref="1000"/> <nil key="parent"/> </object> <object class="IBObjectRecord"> <int key="objectID">-2</int> <reference key="object" ref="1001"/> <reference key="parent" ref="0"/> <string key="objectName">File's Owner</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="1003"/> <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="1004"/> <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> <int key="objectID">1</int> <reference key="object" ref="1005"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1006"/> </object> <reference key="parent" ref="0"/> <string key="objectName">ConfigurationSheet</string> </object> <object class="IBObjectRecord"> <int key="objectID">2</int> <reference key="object" ref="1006"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="230448896"/> - <reference ref="654791710"/> - <reference ref="1013048762"/> <reference ref="995501573"/> + <reference ref="1013048762"/> + <reference ref="654791710"/> </object> <reference key="parent" ref="1005"/> </object> <object class="IBObjectRecord"> <int key="objectID">7</int> <reference key="object" ref="1013048762"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="328796931"/> </object> <reference key="parent" ref="1006"/> </object> <object class="IBObjectRecord"> <int key="objectID">8</int> <reference key="object" ref="328796931"/> <reference key="parent" ref="1013048762"/> </object> <object class="IBObjectRecord"> <int key="objectID">9</int> <reference key="object" ref="995501573"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="770782373"/> </object> <reference key="parent" ref="1006"/> </object> <object class="IBObjectRecord"> <int key="objectID">10</int> <reference key="object" ref="770782373"/> <reference key="parent" ref="995501573"/> </object> <object class="IBObjectRecord"> <int key="objectID">11</int> <reference key="object" ref="654791710"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="460152017"/> </object> <reference key="parent" ref="1006"/> </object> <object class="IBObjectRecord"> <int key="objectID">12</int> <reference key="object" ref="460152017"/> <reference key="parent" ref="654791710"/> </object> <object class="IBObjectRecord"> <int key="objectID">53</int> <reference key="object" ref="230448896"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="510341909"/> <reference ref="327961336"/> </object> <reference key="parent" ref="1006"/> </object> <object class="IBObjectRecord"> <int key="objectID">54</int> <reference key="object" ref="510341909"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="95880135"/> </object> <reference key="parent" ref="230448896"/> </object> <object class="IBObjectRecord"> <int key="objectID">55</int> <reference key="object" ref="95880135"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="724727501"/> - <reference ref="585255460"/> <reference ref="991520932"/> + <reference ref="585255460"/> + <reference ref="724727501"/> </object> <reference key="parent" ref="510341909"/> </object> <object class="IBObjectRecord"> <int key="objectID">56</int> <reference key="object" ref="327961336"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="962628448"/> </object> <reference key="parent" ref="230448896"/> </object> <object class="IBObjectRecord"> <int key="objectID">57</int> <reference key="object" ref="962628448"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="87774458"/> + <reference ref="78351454"/> + <reference ref="810544083"/> + <reference ref="526320074"/> </object> <reference key="parent" ref="327961336"/> </object> <object class="IBObjectRecord"> <int key="objectID">120</int> <reference key="object" ref="991520932"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="509241866"/> - <reference ref="1048896611"/> - <reference ref="157709042"/> + <reference ref="929902514"/> <reference ref="518638902"/> + <reference ref="770329762"/> <reference ref="564558037"/> - <reference ref="929902514"/> + <reference ref="1048896611"/> <reference ref="242295069"/> - <reference ref="770329762"/> <reference ref="1052486056"/> - <reference ref="266837115"/> - <reference ref="748740056"/> <reference ref="644913919"/> - <reference ref="282789491"/> - <reference ref="80225576"/> + <reference ref="157709042"/> <reference ref="481078677"/> <reference ref="701649081"/> + <reference ref="282789491"/> + <reference ref="80225576"/> + <reference ref="748740056"/> + <reference ref="266837115"/> </object> <reference key="parent" ref="95880135"/> </object> <object class="IBObjectRecord"> <int key="objectID">58</int> <reference key="object" ref="509241866"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="345948081"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">59</int> <reference key="object" ref="345948081"/> <reference key="parent" ref="509241866"/> </object> <object class="IBObjectRecord"> <int key="objectID">86</int> <reference key="object" ref="1048896611"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="200609284"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">91</int> <reference key="object" ref="200609284"/> <reference key="parent" ref="1048896611"/> </object> <object class="IBObjectRecord"> <int key="objectID">101</int> <reference key="object" ref="282789491"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="167999035"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">114</int> <reference key="object" ref="167999035"/> <reference key="parent" ref="282789491"/> </object> <object class="IBObjectRecord"> <int key="objectID">64</int> <reference key="object" ref="157709042"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="119847882"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">65</int> <reference key="object" ref="119847882"/> <reference key="parent" ref="157709042"/> </object> <object class="IBObjectRecord"> <int key="objectID">85</int> <reference key="object" ref="518638902"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="921169719"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">92</int> <reference key="object" ref="921169719"/> <reference key="parent" ref="518638902"/> </object> <object class="IBObjectRecord"> <int key="objectID">104</int> <reference key="object" ref="1052486056"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="902255367"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">111</int> <reference key="object" ref="902255367"/> <reference key="parent" ref="1052486056"/> </object> <object class="IBObjectRecord"> <int key="objectID">107</int> <reference key="object" ref="266837115"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="916736093"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">108</int> <reference key="object" ref="916736093"/> <reference key="parent" ref="266837115"/> </object> <object class="IBObjectRecord"> <int key="objectID">103</int> <reference key="object" ref="80225576"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="89720965"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">112</int> <reference key="object" ref="89720965"/> <reference key="parent" ref="80225576"/> </object> <object class="IBObjectRecord"> <int key="objectID">60</int> <reference key="object" ref="564558037"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="694139405"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">61</int> <reference key="object" ref="694139405"/> <reference key="parent" ref="564558037"/> </object> <object class="IBObjectRecord"> <int key="objectID">100</int> <reference key="object" ref="481078677"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="598843304"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">115</int> <reference key="object" ref="598843304"/> <reference key="parent" ref="481078677"/> </object> <object class="IBObjectRecord"> <int key="objectID">102</int> <reference key="object" ref="701649081"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="487908187"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">113</int> <reference key="object" ref="487908187"/> <reference key="parent" ref="701649081"/> </object> <object class="IBObjectRecord"> <int key="objectID">105</int> <reference key="object" ref="748740056"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="674973427"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">110</int> <reference key="object" ref="674973427"/> <reference key="parent" ref="748740056"/> </object> <object class="IBObjectRecord"> <int key="objectID">62</int> <reference key="object" ref="929902514"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="110598254"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">63</int> <reference key="object" ref="110598254"/> <reference key="parent" ref="929902514"/> </object> <object class="IBObjectRecord"> <int key="objectID">88</int> <reference key="object" ref="242295069"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="686601725"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">89</int> <reference key="object" ref="686601725"/> <reference key="parent" ref="242295069"/> </object> <object class="IBObjectRecord"> <int key="objectID">87</int> <reference key="object" ref="770329762"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1020163194"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">90</int> <reference key="object" ref="1020163194"/> <reference key="parent" ref="770329762"/> </object> <object class="IBObjectRecord"> <int key="objectID">106</int> <reference key="object" ref="644913919"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1046562852"/> </object> <reference key="parent" ref="991520932"/> </object> <object class="IBObjectRecord"> <int key="objectID">109</int> <reference key="object" ref="1046562852"/> <reference key="parent" ref="644913919"/> </object> <object class="IBObjectRecord"> <int key="objectID">149</int> <reference key="object" ref="585255460"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="667726591"/> - <reference ref="337999651"/> <reference ref="532256007"/> <reference ref="371590425"/> <reference ref="307029731"/> <reference ref="95502372"/> <reference ref="925722485"/> <reference ref="382885577"/> <reference ref="498595760"/> <reference ref="669058752"/> <reference ref="373610845"/> <reference ref="599827838"/> <reference ref="659833234"/> <reference ref="527654156"/> + <reference ref="337999651"/> + <reference ref="667726591"/> </object> <reference key="parent" ref="95880135"/> </object> <object class="IBObjectRecord"> <int key="objectID">142</int> <reference key="object" ref="532256007"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="993628458"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">147</int> <reference key="object" ref="993628458"/> <reference key="parent" ref="532256007"/> </object> <object class="IBObjectRecord"> <int key="objectID">130</int> <reference key="object" ref="371590425"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="41921744"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">131</int> <reference key="object" ref="41921744"/> <reference key="parent" ref="371590425"/> </object> <object class="IBObjectRecord"> <int key="objectID">143</int> <reference key="object" ref="307029731"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="898541514"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">146</int> <reference key="object" ref="898541514"/> <reference key="parent" ref="307029731"/> </object> <object class="IBObjectRecord"> <int key="objectID">133</int> <reference key="object" ref="95502372"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="302770213"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">140</int> <reference key="object" ref="302770213"/> <reference key="parent" ref="95502372"/> </object> <object class="IBObjectRecord"> <int key="objectID">127</int> <reference key="object" ref="925722485"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="540516504"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">128</int> <reference key="object" ref="540516504"/> <reference key="parent" ref="925722485"/> </object> <object class="IBObjectRecord"> <int key="objectID">134</int> <reference key="object" ref="382885577"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="493858441"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">139</int> <reference key="object" ref="493858441"/> <reference key="parent" ref="382885577"/> </object> <object class="IBObjectRecord"> <int key="objectID">129</int> <reference key="object" ref="498595760"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="676380058"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">132</int> <reference key="object" ref="676380058"/> <reference key="parent" ref="498595760"/> </object> <object class="IBObjectRecord"> <int key="objectID">135</int> <reference key="object" ref="669058752"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="66600519"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">138</int> <reference key="object" ref="66600519"/> <reference key="parent" ref="669058752"/> </object> <object class="IBObjectRecord"> <int key="objectID">141</int> <reference key="object" ref="373610845"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="79947852"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">148</int> <reference key="object" ref="79947852"/> <reference key="parent" ref="373610845"/> </object> <object class="IBObjectRecord"> <int key="objectID">125</int> <reference key="object" ref="599827838"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="130290391"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">126</int> <reference key="object" ref="130290391"/> <reference key="parent" ref="599827838"/> </object> <object class="IBObjectRecord"> <int key="objectID">136</int> <reference key="object" ref="659833234"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="404599171"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">137</int> <reference key="object" ref="404599171"/> <reference key="parent" ref="659833234"/> </object> <object class="IBObjectRecord"> <int key="objectID">144</int> <reference key="object" ref="527654156"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="747673443"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">145</int> <reference key="object" ref="747673443"/> <reference key="parent" ref="527654156"/> </object> <object class="IBObjectRecord"> <int key="objectID">173</int> <reference key="object" ref="724727501"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="415200325"/> <reference ref="38819005"/> <reference ref="392143892"/> - <reference ref="461347810"/> <reference ref="1007515992"/> + <reference ref="461347810"/> </object> <reference key="parent" ref="95880135"/> </object> <object class="IBObjectRecord"> <int key="objectID">70</int> <reference key="object" ref="461347810"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="575720656"/> </object> <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> <int key="objectID">71</int> <reference key="object" ref="575720656"/> <reference key="parent" ref="461347810"/> </object> <object class="IBObjectRecord"> <int key="objectID">5</int> <reference key="object" ref="415200325"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="759654285"/> </object> <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> <int key="objectID">6</int> <reference key="object" ref="759654285"/> <reference key="parent" ref="415200325"/> </object> <object class="IBObjectRecord"> <int key="objectID">23</int> <reference key="object" ref="38819005"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="922564724"/> </object> <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> <int key="objectID">24</int> <reference key="object" ref="922564724"/> <reference key="parent" ref="38819005"/> </object> <object class="IBObjectRecord"> <int key="objectID">72</int> <reference key="object" ref="1007515992"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="55582849"/> </object> <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> <int key="objectID">73</int> <reference key="object" ref="55582849"/> <reference key="parent" ref="1007515992"/> </object> <object class="IBObjectRecord"> <int key="objectID">21</int> <reference key="object" ref="392143892"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="154709998"/> </object> <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> <int key="objectID">22</int> <reference key="object" ref="154709998"/> <reference key="parent" ref="392143892"/> </object> <object class="IBObjectRecord"> <int key="objectID">80</int> <reference key="object" ref="337999651"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="316809000"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">81</int> <reference key="object" ref="316809000"/> <reference key="parent" ref="337999651"/> </object> <object class="IBObjectRecord"> <int key="objectID">78</int> <reference key="object" ref="667726591"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1037067466"/> </object> <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> <int key="objectID">79</int> <reference key="object" ref="1037067466"/> <reference key="parent" ref="667726591"/> </object> <object class="IBObjectRecord"> - <int key="objectID">174</int> - <reference key="object" ref="87774458"/> + <int key="objectID">178</int> + <reference key="object" ref="78351454"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="867004219"/> + </object> + <reference key="parent" ref="962628448"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">179</int> + <reference key="object" ref="810544083"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="449686934"/> + </object> + <reference key="parent" ref="962628448"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">180</int> + <reference key="object" ref="526320074"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="1063097842"/> + <reference ref="969047062"/> </object> <reference key="parent" ref="962628448"/> </object> <object class="IBObjectRecord"> - <int key="objectID">175</int> - <reference key="object" ref="1063097842"/> - <reference key="parent" ref="87774458"/> + <int key="objectID">181</int> + <reference key="object" ref="969047062"/> + <reference key="parent" ref="526320074"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">182</int> + <reference key="object" ref="449686934"/> + <reference key="parent" ref="810544083"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">183</int> + <reference key="object" ref="867004219"/> + <reference key="parent" ref="78351454"/> </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>1.IBEditorWindowLastContentRect</string> <string>1.IBPluginDependency</string> <string>1.IBWindowTemplateEditedContentRect</string> <string>1.NSWindowTemplate.visibleAtLaunch</string> <string>1.WindowOrigin</string> <string>1.editorWindowContentRectSynchronizationRect</string> <string>1.windowTemplate.hasMinSize</string> <string>1.windowTemplate.minSize</string> <string>10.IBPluginDependency</string> <string>100.IBPluginDependency</string> <string>101.IBPluginDependency</string> <string>102.IBPluginDependency</string> <string>103.IBPluginDependency</string> <string>104.IBPluginDependency</string> <string>105.IBPluginDependency</string> <string>106.IBPluginDependency</string> <string>107.IBPluginDependency</string> <string>108.IBPluginDependency</string> <string>109.IBPluginDependency</string> <string>11.IBPluginDependency</string> <string>110.IBPluginDependency</string> <string>111.IBPluginDependency</string> <string>112.IBPluginDependency</string> <string>113.IBPluginDependency</string> <string>114.IBPluginDependency</string> <string>115.IBPluginDependency</string> <string>12.IBPluginDependency</string> <string>125.IBPluginDependency</string> <string>126.IBPluginDependency</string> <string>127.IBPluginDependency</string> <string>128.IBPluginDependency</string> <string>129.IBPluginDependency</string> <string>130.IBPluginDependency</string> <string>131.IBPluginDependency</string> <string>132.IBPluginDependency</string> <string>133.IBPluginDependency</string> <string>134.IBPluginDependency</string> <string>135.IBPluginDependency</string> <string>136.IBPluginDependency</string> <string>137.IBPluginDependency</string> <string>138.IBPluginDependency</string> <string>139.IBPluginDependency</string> <string>140.IBPluginDependency</string> <string>141.IBPluginDependency</string> <string>142.IBPluginDependency</string> <string>143.IBPluginDependency</string> <string>144.IBPluginDependency</string> <string>145.IBPluginDependency</string> <string>146.IBPluginDependency</string> <string>147.IBPluginDependency</string> <string>148.IBPluginDependency</string> - <string>174.IBPluginDependency</string> - <string>175.IBPluginDependency</string> + <string>178.IBPluginDependency</string> + <string>179.IBPluginDependency</string> + <string>180.IBPluginDependency</string> + <string>181.IBPluginDependency</string> + <string>182.IBPluginDependency</string> + <string>183.IBPluginDependency</string> <string>2.IBPluginDependency</string> <string>21.IBPluginDependency</string> <string>22.IBPluginDependency</string> <string>23.IBPluginDependency</string> <string>24.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>58.IBPluginDependency</string> <string>59.IBPluginDependency</string> <string>6.IBPluginDependency</string> <string>60.IBPluginDependency</string> <string>61.IBPluginDependency</string> <string>62.IBPluginDependency</string> <string>63.IBPluginDependency</string> <string>64.IBPluginDependency</string> <string>65.IBPluginDependency</string> <string>7.IBPluginDependency</string> <string>70.IBPluginDependency</string> <string>71.IBPluginDependency</string> <string>72.IBPluginDependency</string> <string>73.IBPluginDependency</string> <string>78.IBPluginDependency</string> <string>79.IBPluginDependency</string> <string>8.IBPluginDependency</string> <string>80.IBPluginDependency</string> <string>81.IBPluginDependency</string> <string>85.IBPluginDependency</string> <string>86.IBPluginDependency</string> <string>87.IBPluginDependency</string> <string>88.IBPluginDependency</string> <string>89.IBPluginDependency</string> <string>9.IBPluginDependency</string> <string>90.IBPluginDependency</string> <string>91.IBPluginDependency</string> <string>92.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>{{391, 376}, {535, 452}}</string> + <string>{{375, 406}, {530, 450}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{391, 376}, {535, 452}}</string> + <string>{{375, 406}, {530, 450}}</string> <boolean value="NO"/> <string>{196, 240}</string> <string>{{202, 428}, {480, 270}}</string> <boolean value="NO"/> <string>{368, 331}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> - <int key="maxID">177</int> + <int key="maxID">187</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">XamhainUserDefaultsController</string> <string key="superclassName">NSUserDefaultsController</string> <object class="NSMutableDictionary" key="outlets"> <string key="NS.key.0">mpConfigureSheet</string> <string key="NS.object.0">NSWindow</string> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">screen saving/XamhainUserDefaultsController.h</string> </object> </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">NSActionCell</string> <string key="superclassName">NSCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="87276028"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="696164746"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1054327803"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSBox</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSBox.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButton</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButtonCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSCell</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSControl</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="476499260"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSController</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFormatter</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenu</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="871101704"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="87276028"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="696164746"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="1054327803"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="476499260"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="871101704"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="701233559"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSError.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSSlider</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSlider.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSSliderCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSliderCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSStepper</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSStepper.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSStepperCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSStepperCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTabView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTabView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTabViewItem</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTabViewItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextField</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextField.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextFieldCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSUserDefaultsController</string> <string key="superclassName">NSController</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserDefaultsController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <string key="superclassName">NSResponder</string> <reference key="sourceIdentifier" ref="701233559"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> </object>
jjk/XamhainII
af7038e02a2178d5dcda3078214efebcc8e78d9e
Improve configuration UI.
diff --git a/XamhainConfigureSheet.xib b/XamhainConfigureSheet.xib index 04de8b9..6a28435 100644 --- a/XamhainConfigureSheet.xib +++ b/XamhainConfigureSheet.xib @@ -1,981 +1,2757 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1060</int> <string key="IBDocument.SystemVersion">10B504</string> <string key="IBDocument.InterfaceBuilderVersion">732</string> <string key="IBDocument.AppKitVersion">1038.2</string> <string key="IBDocument.HIToolboxVersion">437.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="NS.object.0">732</string> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1"/> + <integer value="149"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="1001"> <string key="NSClassName">XamhainUserDefaultsController</string> </object> <object class="NSCustomObject" id="1003"> <string key="NSClassName">FirstResponder</string> </object> <object class="NSCustomObject" id="1004"> <string key="NSClassName">NSApplication</string> </object> <object class="NSWindowTemplate" id="1005"> <int key="NSWindowStyleMask">1</int> <int key="NSWindowBacking">2</int> - <string key="NSWindowRect">{{0, 768}, {415, 110}}</string> - <int key="NSWTFlags">1618478080</int> + <string key="NSWindowRect">{{0, 426}, {535, 452}}</string> + <int key="NSWTFlags">1886913536</int> <string key="NSWindowTitle">ConfigurationSheet</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> <object class="NSView" key="NSWindowView" id="1006"> <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSTextField" id="415200325"> - <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 73}, {234, 17}}</string> - <reference key="NSSuperview" ref="1006"/> - <int key="NSViewLayerContentsRedrawPolicy">2</int> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="759654285"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">272629760</int> - <string key="NSContents">Number of Knots</string> - <object class="NSFont" key="NSSupport"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">13</double> - <int key="NSfFlags">16</int> - </object> - <reference key="NSControlView" ref="415200325"/> - <object class="NSColor" key="NSBackgroundColor" id="586021249"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> - </object> - </object> - <object class="NSColor" key="NSTextColor" id="671980879"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlTextColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MAA</bytes> - </object> - </object> - </object> - </object> <object class="NSButton" id="1013048762"> <reference key="NSNextResponder" ref="1006"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{305, 12}, {96, 32}}</string> + <string key="NSFrame">{{425, 12}, {96, 32}}</string> <reference key="NSSuperview" ref="1006"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="328796931"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">OK</string> <object class="NSFont" key="NSSupport" id="872788741"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="1013048762"/> <int key="NSButtonFlags">-2037235457</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSButton" id="995501573"> <reference key="NSNextResponder" ref="1006"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{197, 12}, {96, 32}}</string> + <string key="NSFrame">{{329, 12}, {96, 32}}</string> <reference key="NSSuperview" ref="1006"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="770782373"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Cancel</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="995501573"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string type="base64-UTF8" key="NSKeyEquivalent">Gw</string> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSButton" id="654791710"> <reference key="NSNextResponder" ref="1006"/> <int key="NSvFlags">292</int> <string key="NSFrame">{{14, 12}, {148, 32}}</string> <reference key="NSSuperview" ref="1006"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="460152017"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Reset to Defaults</string> <reference key="NSSupport" ref="872788741"/> <reference key="NSControlView" ref="654791710"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> - <object class="NSStepper" id="392143892"> + <object class="NSTabView" id="230448896"> <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{186, 67}, {19, 27}}</string> + <int key="NSvFlags">36</int> + <string key="NSFrame">{{13, 40}, {509, 398}}</string> <reference key="NSSuperview" ref="1006"/> - <int key="NSViewLayerContentsRedrawPolicy">2</int> - <bool key="NSEnabled">YES</bool> - <object class="NSStepperCell" key="NSCell" id="154709998"> - <int key="NSCellFlags">917024</int> - <int key="NSCellFlags2">0</int> - <reference key="NSControlView" ref="392143892"/> - <double key="NSValue">8</double> - <double key="NSMinValue">1</double> - <double key="NSMaxValue">25</double> - <double key="NSIncrement">1</double> - <bool key="NSAutorepeat">YES</bool> + <object class="NSMutableArray" key="NSTabViewItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTabViewItem" id="510341909"> + <string key="NSIdentifier">1</string> + <object class="NSView" key="NSView" id="95880135"> + <reference key="NSNextResponder" ref="230448896"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSBox" id="991520932"> + <reference key="NSNextResponder" ref="95880135"/> + <int key="NSvFlags">36</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSView" id="386728850"> + <reference key="NSNextResponder" ref="991520932"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="509241866"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{15, 91}, {75, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="345948081"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Horizontal:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="509241866"/> + <object class="NSColor" key="NSBackgroundColor" id="586021249"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="671980879"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlTextColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + </object> + </object> + <object class="NSTextField" id="1048896611"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{41, 16}, {49, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="200609284"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Round:</string> + <object class="NSFont" key="NSSupport" id="15919542"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">13</double> + <int key="NSfFlags">16</int> + </object> + <reference key="NSControlView" ref="1048896611"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="282789491"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{224, 66}, {108, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="167999035"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Solid vs. Hollow:</string> + <reference key="NSSupport" ref="15919542"/> + <reference key="NSControlView" ref="282789491"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSSlider" id="157709042"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{93, 37}, {105, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="119847882"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="157709042"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSTextField" id="518638902"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{35, 64}, {56, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="921169719"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Vertical:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="518638902"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="1052486056"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{201, 39}, {131, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="902255367"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Straight vs. Skewed:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="1052486056"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSSlider" id="266837115"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{335, 10}, {104, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="916736093"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="266837115"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSSlider" id="80225576"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{335, 62}, {104, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="89720965"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="80225576"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSTextField" id="564558037"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{38, 41}, {52, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="694139405"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Square:</string> + <reference key="NSSupport" ref="15919542"/> + <reference key="NSControlView" ref="564558037"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="481078677"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{215, 91}, {117, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="598843304"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Slender vs. Broad:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="481078677"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSSlider" id="701649081"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{335, 89}, {104, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="487908187"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="701649081"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSTextField" id="748740056"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{209, 14}, {123, 17}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="674973427"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Fixed vs. Spinning:</string> + <reference key="NSSupport" ref="15919542"/> + <reference key="NSControlView" ref="748740056"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSSlider" id="929902514"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{93, 89}, {104, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="110598254"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="929902514"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSSlider" id="242295069"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{93, 12}, {104, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="686601725"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="242295069"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSSlider" id="770329762"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{94, 62}, {104, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="1020163194"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="770329762"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSSlider" id="644913919"> + <reference key="NSNextResponder" ref="386728850"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{335, 37}, {104, 21}}</string> + <reference key="NSSuperview" ref="386728850"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="1046562852"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="644913919"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + </object> + <string key="NSFrame">{{1, 1}, {455, 118}}</string> + <reference key="NSSuperview" ref="991520932"/> + </object> + </object> + <string key="NSFrame">{{18, 13}, {457, 134}}</string> + <reference key="NSSuperview" ref="95880135"/> + <string key="NSOffsets">{0, 0}</string> + <object class="NSTextFieldCell" key="NSTitleCell"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Knot Types</string> + <object class="NSFont" key="NSSupport" id="26"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">11</double> + <int key="NSfFlags">3100</int> + </object> + <object class="NSColor" key="NSBackgroundColor" id="445431265"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textBackgroundColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> + </object> + </object> + <reference key="NSContentView" ref="386728850"/> + <int key="NSBorderType">1</int> + <int key="NSBoxType">0</int> + <int key="NSTitlePosition">2</int> + <bool key="NSTransparent">NO</bool> + </object> + <object class="NSBox" id="585255460"> + <reference key="NSNextResponder" ref="95880135"/> + <int key="NSvFlags">36</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSView" id="87759421"> + <reference key="NSNextResponder" ref="585255460"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSSlider" id="532256007"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{104, 35}, {100, 21}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="993628458"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="532256007"/> + <double key="NSMaxValue">10</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSSlider" id="371590425"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{245, 85}, {100, 21}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="41921744"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="371590425"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSTextField" id="307029731"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{207, 39}, {35, 17}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="898541514"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Max:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="307029731"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="95502372"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{27, 64}, {74, 17}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="302770213"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Speed Min:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="95502372"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSSlider" id="925722485"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{104, 85}, {100, 21}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="540516504"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="925722485"/> + <double key="NSMaxValue">1</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSSlider" id="382885577"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{104, 60}, {100, 21}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="493858441"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="382885577"/> + <double key="NSMaxValue">10</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSTextField" id="498595760"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{207, 89}, {35, 17}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="676380058"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Max:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="498595760"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="669058752"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{207, 64}, {35, 17}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="66600519"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Max:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="669058752"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="373610845"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{38, 39}, {63, 17}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="79947852"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Spin Min:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="373610845"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="599827838"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{40, 89}, {61, 17}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="130290391"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Size Min:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="599827838"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSSlider" id="659833234"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{245, 60}, {100, 21}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="404599171"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="659833234"/> + <double key="NSMaxValue">10</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSSlider" id="527654156"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{245, 35}, {100, 21}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="747673443"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="527654156"/> + <double key="NSMaxValue">10</double> + <double key="NSMinValue">0.0</double> + <double key="NSValue">0.0</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSButton" id="337999651"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{105, 12}, {18, 18}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="316809000"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Check</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="337999651"/> + <int key="NSButtonFlags">1214534143</int> + <int key="NSButtonFlags2">2</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSSwitch</string> + </object> + <object class="NSButtonImageSource" key="NSAlternateImage"> + <string key="NSImageName">NSSwitch</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="667726591"> + <reference key="NSNextResponder" ref="87759421"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{15, 14}, {87, 17}}</string> + <reference key="NSSuperview" ref="87759421"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="1037067466"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Multicolored:</string> + <reference key="NSSupport" ref="15919542"/> + <reference key="NSControlView" ref="667726591"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + </object> + <string key="NSFrame">{{1, 1}, {455, 116}}</string> + <reference key="NSSuperview" ref="585255460"/> + </object> + </object> + <string key="NSFrame">{{18, 151}, {457, 132}}</string> + <reference key="NSSuperview" ref="95880135"/> + <string key="NSOffsets">{0, 0}</string> + <object class="NSTextFieldCell" key="NSTitleCell"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Knot Properties</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSBackgroundColor" ref="445431265"/> + <object class="NSColor" key="NSTextColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> + </object> + </object> + <reference key="NSContentView" ref="87759421"/> + <int key="NSBorderType">1</int> + <int key="NSBoxType">0</int> + <int key="NSTitlePosition">2</int> + <bool key="NSTransparent">NO</bool> + </object> + <object class="NSBox" id="724727501"> + <reference key="NSNextResponder" ref="95880135"/> + <int key="NSvFlags">36</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSView" id="642879379"> + <reference key="NSNextResponder" ref="724727501"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSSlider" id="461347810"> + <reference key="NSNextResponder" ref="642879379"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{343, 13}, {100, 21}}</string> + <reference key="NSSuperview" ref="642879379"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSliderCell" key="NSCell" id="575720656"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents"/> + <reference key="NSControlView" ref="461347810"/> + <double key="NSMaxValue">120</double> + <double key="NSMinValue">1</double> + <double key="NSValue">30</double> + <double key="NSAltIncValue">0.0</double> + <int key="NSNumberOfTickMarks">0</int> + <int key="NSTickMarkPosition">1</int> + <bool key="NSAllowsTickMarkValuesOnly">NO</bool> + <bool key="NSVertical">NO</bool> + </object> + </object> + <object class="NSTextField" id="415200325"> + <reference key="NSNextResponder" ref="642879379"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{15, 17}, {116, 17}}</string> + <reference key="NSSuperview" ref="642879379"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="759654285"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">71303168</int> + <string key="NSContents">Number of Knots:</string> + <reference key="NSSupport" ref="15919542"/> + <reference key="NSControlView" ref="415200325"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="38819005"> + <reference key="NSNextResponder" ref="642879379"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{136, 14}, {25, 22}}</string> + <reference key="NSSuperview" ref="642879379"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="922564724"> + <int key="NSCellFlags">343014977</int> + <int key="NSCellFlags2">272700480</int> + <string key="NSContents">99</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="38819005"/> + <bool key="NSDrawsBackground">YES</bool> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MSAxIDEAA</bytes> + </object> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSTextField" id="1007515992"> + <reference key="NSNextResponder" ref="642879379"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{252, 17}, {88, 17}}</string> + <reference key="NSSuperview" ref="642879379"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="55582849"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">71304192</int> + <string key="NSContents">Refresh Rate:</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="1007515992"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + <object class="NSStepper" id="392143892"> + <reference key="NSNextResponder" ref="642879379"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{166, 11}, {19, 27}}</string> + <reference key="NSSuperview" ref="642879379"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSStepperCell" key="NSCell" id="154709998"> + <int key="NSCellFlags">917024</int> + <int key="NSCellFlags2">0</int> + <reference key="NSControlView" ref="392143892"/> + <double key="NSValue">8</double> + <double key="NSMinValue">1</double> + <double key="NSMaxValue">25</double> + <double key="NSIncrement">1</double> + <bool key="NSAutorepeat">YES</bool> + </object> + </object> + </object> + <string key="NSFrame">{{1, 1}, {459, 46}}</string> + <reference key="NSSuperview" ref="724727501"/> + </object> + </object> + <string key="NSFrame">{{14, 287}, {461, 62}}</string> + <reference key="NSSuperview" ref="95880135"/> + <string key="NSOffsets">{0, 0}</string> + <object class="NSTextFieldCell" key="NSTitleCell"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Animation</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSBackgroundColor" ref="445431265"/> + <object class="NSColor" key="NSTextColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> + </object> + </object> + <reference key="NSContentView" ref="642879379"/> + <int key="NSBorderType">1</int> + <int key="NSBoxType">0</int> + <int key="NSTitlePosition">2</int> + <bool key="NSTransparent">NO</bool> + </object> + </object> + <string key="NSFrame">{{10, 33}, {489, 352}}</string> + <reference key="NSSuperview" ref="230448896"/> + </object> + <string key="NSLabel">General</string> + <reference key="NSColor" ref="586021249"/> + <reference key="NSTabView" ref="230448896"/> + </object> + <object class="NSTabViewItem" id="327961336"> + <string key="NSIdentifier">2</string> + <object class="NSView" key="NSView" id="962628448"> + <nil key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="87774458"> + <reference key="NSNextResponder" ref="962628448"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{187, 209}, {114, 17}}</string> + <reference key="NSSuperview" ref="962628448"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="1063097842"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents">Watch This Space</string> + <reference key="NSSupport" ref="872788741"/> + <reference key="NSControlView" ref="87774458"/> + <reference key="NSBackgroundColor" ref="586021249"/> + <reference key="NSTextColor" ref="671980879"/> + </object> + </object> + </object> + <string key="NSFrame">{{10, 33}, {489, 352}}</string> + </object> + <string key="NSLabel">Advanced</string> + <reference key="NSColor" ref="586021249"/> + <reference key="NSTabView" ref="230448896"/> + </object> </object> - </object> - <object class="NSTextField" id="38819005"> - <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{143, 73}, {38, 17}}</string> - <reference key="NSSuperview" ref="1006"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="922564724"> - <int key="NSCellFlags">347209281</int> - <int key="NSCellFlags2">272700480</int> - <string key="NSContents">Label</string> - <reference key="NSSupport" ref="872788741"/> - <reference key="NSControlView" ref="38819005"/> - <bool key="NSDrawsBackground">YES</bool> - <reference key="NSBackgroundColor" ref="586021249"/> - <reference key="NSTextColor" ref="671980879"/> + <reference key="NSSelectedTabViewItem" ref="510341909"/> + <reference key="NSFont" ref="872788741"/> + <int key="NSTvFlags">0</int> + <bool key="NSAllowTruncatedLabels">YES</bool> + <bool key="NSDrawsBackground">YES</bool> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="95880135"/> </object> </object> </object> - <string key="NSFrameSize">{415, 110}</string> + <string key="NSFrameSize">{535, 452}</string> <reference key="NSSuperview"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> <object class="NSMutableArray" key="connectionRecords"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">mpConfigureSheet</string> <reference key="source" ref="1001"/> <reference key="destination" ref="1005"/> </object> <int key="connectionID">32</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">revertToInitialValues:</string> <reference key="source" ref="1001"/> <reference key="destination" ref="654791710"/> </object> <int key="connectionID">36</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">save:</string> <reference key="source" ref="1001"/> <reference key="destination" ref="1013048762"/> </object> <int key="connectionID">37</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">revert:</string> <reference key="source" ref="1001"/> <reference key="destination" ref="995501573"/> </object> - <int key="connectionID">39</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">value: values.NumberOfKnots</string> - <reference key="source" ref="38819005"/> - <reference key="destination" ref="1001"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="38819005"/> - <reference key="NSDestination" ref="1001"/> - <string key="NSLabel">value: values.NumberOfKnots</string> - <string key="NSBinding">value</string> - <string key="NSKeyPath">values.NumberOfKnots</string> - <object class="NSDictionary" key="NSOptions"> - <string key="NS.key.0">NSAllowsEditingMultipleValuesSelection</string> - <boolean value="NO" key="NS.object.0"/> - </object> - <int key="NSNibBindingConnectorVersion">2</int> + <int key="connectionID">39</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.NumberOfKnots</string> + <reference key="source" ref="38819005"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="38819005"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.NumberOfKnots</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.NumberOfKnots</string> + <object class="NSDictionary" key="NSOptions"> + <string key="NS.key.0">NSAllowsEditingMultipleValuesSelection</string> + <boolean value="NO" key="NS.object.0"/> + </object> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">49</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.NumberOfKnots</string> + <reference key="source" ref="392143892"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="392143892"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.NumberOfKnots</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.NumberOfKnots</string> + <object class="NSDictionary" key="NSOptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSAllowsEditingMultipleValuesSelection</string> + <string>NSConditionallySetsEnabled</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <boolean value="NO"/> + <boolean value="NO"/> + </object> + </object> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">50</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.TicksPerSecond</string> + <reference key="source" ref="461347810"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="461347810"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.TicksPerSecond</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.TicksPerSecond</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">77</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.Technicolor</string> + <reference key="source" ref="337999651"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="337999651"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.Technicolor</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.Technicolor</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">83</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.SkewProbability</string> + <reference key="source" ref="644913919"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="644913919"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.SkewProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.SkewProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">116</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.SpinProbability</string> + <reference key="source" ref="266837115"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="266837115"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.SpinProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.SpinProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">117</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.BroadKnotProbability</string> + <reference key="source" ref="701649081"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="701649081"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.BroadKnotProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.BroadKnotProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">118</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.HollowKnotProbability</string> + <reference key="source" ref="80225576"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="80225576"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.HollowKnotProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.HollowKnotProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">119</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.HorizontalKnotProbability</string> + <reference key="source" ref="929902514"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="929902514"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.HorizontalKnotProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.HorizontalKnotProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">121</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.VerticalKnotProbability</string> + <reference key="source" ref="770329762"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="770329762"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.VerticalKnotProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.VerticalKnotProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">122</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.ClosedKnotProbability</string> + <reference key="source" ref="157709042"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="157709042"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.ClosedKnotProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.ClosedKnotProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">123</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.CircularKnotProbability</string> + <reference key="source" ref="242295069"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="242295069"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.CircularKnotProbability</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.CircularKnotProbability</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">124</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.MinSpeed</string> + <reference key="source" ref="382885577"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="382885577"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.MinSpeed</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.MinSpeed</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">166</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.MaxSpeed</string> + <reference key="source" ref="659833234"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="659833234"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.MaxSpeed</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.MaxSpeed</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">168</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.MinSpin</string> + <reference key="source" ref="532256007"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="532256007"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.MinSpin</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.MinSpin</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">170</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.MaxSpin</string> + <reference key="source" ref="527654156"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="527654156"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.MaxSpin</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.MaxSpin</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">172</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.MinSize</string> + <reference key="source" ref="925722485"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="925722485"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.MinSize</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.MinSize</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">176</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.MaxSize</string> + <reference key="source" ref="371590425"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="371590425"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">value: values.MaxSize</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.MaxSize</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">177</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <reference key="object" ref="0"/> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="1001"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="1003"/> + <reference key="parent" ref="0"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="1004"/> + <reference key="parent" ref="0"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1</int> + <reference key="object" ref="1005"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1006"/> + </object> + <reference key="parent" ref="0"/> + <string key="objectName">ConfigurationSheet</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">2</int> + <reference key="object" ref="1006"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="230448896"/> + <reference ref="654791710"/> + <reference ref="1013048762"/> + <reference ref="995501573"/> + </object> + <reference key="parent" ref="1005"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">7</int> + <reference key="object" ref="1013048762"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="328796931"/> + </object> + <reference key="parent" ref="1006"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">8</int> + <reference key="object" ref="328796931"/> + <reference key="parent" ref="1013048762"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">9</int> + <reference key="object" ref="995501573"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="770782373"/> + </object> + <reference key="parent" ref="1006"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">10</int> + <reference key="object" ref="770782373"/> + <reference key="parent" ref="995501573"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">11</int> + <reference key="object" ref="654791710"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="460152017"/> + </object> + <reference key="parent" ref="1006"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">12</int> + <reference key="object" ref="460152017"/> + <reference key="parent" ref="654791710"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">53</int> + <reference key="object" ref="230448896"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="510341909"/> + <reference ref="327961336"/> + </object> + <reference key="parent" ref="1006"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">54</int> + <reference key="object" ref="510341909"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="95880135"/> + </object> + <reference key="parent" ref="230448896"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">55</int> + <reference key="object" ref="95880135"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="724727501"/> + <reference ref="585255460"/> + <reference ref="991520932"/> + </object> + <reference key="parent" ref="510341909"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">56</int> + <reference key="object" ref="327961336"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="962628448"/> + </object> + <reference key="parent" ref="230448896"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">57</int> + <reference key="object" ref="962628448"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="87774458"/> + </object> + <reference key="parent" ref="327961336"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">120</int> + <reference key="object" ref="991520932"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="509241866"/> + <reference ref="1048896611"/> + <reference ref="157709042"/> + <reference ref="518638902"/> + <reference ref="564558037"/> + <reference ref="929902514"/> + <reference ref="242295069"/> + <reference ref="770329762"/> + <reference ref="1052486056"/> + <reference ref="266837115"/> + <reference ref="748740056"/> + <reference ref="644913919"/> + <reference ref="282789491"/> + <reference ref="80225576"/> + <reference ref="481078677"/> + <reference ref="701649081"/> + </object> + <reference key="parent" ref="95880135"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">58</int> + <reference key="object" ref="509241866"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="345948081"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">59</int> + <reference key="object" ref="345948081"/> + <reference key="parent" ref="509241866"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">86</int> + <reference key="object" ref="1048896611"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="200609284"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">91</int> + <reference key="object" ref="200609284"/> + <reference key="parent" ref="1048896611"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">101</int> + <reference key="object" ref="282789491"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="167999035"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">114</int> + <reference key="object" ref="167999035"/> + <reference key="parent" ref="282789491"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">64</int> + <reference key="object" ref="157709042"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="119847882"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">65</int> + <reference key="object" ref="119847882"/> + <reference key="parent" ref="157709042"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">85</int> + <reference key="object" ref="518638902"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="921169719"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">92</int> + <reference key="object" ref="921169719"/> + <reference key="parent" ref="518638902"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">104</int> + <reference key="object" ref="1052486056"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="902255367"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">111</int> + <reference key="object" ref="902255367"/> + <reference key="parent" ref="1052486056"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">107</int> + <reference key="object" ref="266837115"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="916736093"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">108</int> + <reference key="object" ref="916736093"/> + <reference key="parent" ref="266837115"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">103</int> + <reference key="object" ref="80225576"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="89720965"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">112</int> + <reference key="object" ref="89720965"/> + <reference key="parent" ref="80225576"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">60</int> + <reference key="object" ref="564558037"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="694139405"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">61</int> + <reference key="object" ref="694139405"/> + <reference key="parent" ref="564558037"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100</int> + <reference key="object" ref="481078677"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="598843304"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">115</int> + <reference key="object" ref="598843304"/> + <reference key="parent" ref="481078677"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">102</int> + <reference key="object" ref="701649081"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="487908187"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">113</int> + <reference key="object" ref="487908187"/> + <reference key="parent" ref="701649081"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">105</int> + <reference key="object" ref="748740056"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="674973427"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">110</int> + <reference key="object" ref="674973427"/> + <reference key="parent" ref="748740056"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">62</int> + <reference key="object" ref="929902514"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="110598254"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">63</int> + <reference key="object" ref="110598254"/> + <reference key="parent" ref="929902514"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">88</int> + <reference key="object" ref="242295069"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="686601725"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">89</int> + <reference key="object" ref="686601725"/> + <reference key="parent" ref="242295069"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">87</int> + <reference key="object" ref="770329762"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1020163194"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">90</int> + <reference key="object" ref="1020163194"/> + <reference key="parent" ref="770329762"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">106</int> + <reference key="object" ref="644913919"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1046562852"/> + </object> + <reference key="parent" ref="991520932"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">109</int> + <reference key="object" ref="1046562852"/> + <reference key="parent" ref="644913919"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">149</int> + <reference key="object" ref="585255460"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="667726591"/> + <reference ref="337999651"/> + <reference ref="532256007"/> + <reference ref="371590425"/> + <reference ref="307029731"/> + <reference ref="95502372"/> + <reference ref="925722485"/> + <reference ref="382885577"/> + <reference ref="498595760"/> + <reference ref="669058752"/> + <reference ref="373610845"/> + <reference ref="599827838"/> + <reference ref="659833234"/> + <reference ref="527654156"/> + </object> + <reference key="parent" ref="95880135"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">142</int> + <reference key="object" ref="532256007"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="993628458"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">147</int> + <reference key="object" ref="993628458"/> + <reference key="parent" ref="532256007"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">130</int> + <reference key="object" ref="371590425"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="41921744"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">131</int> + <reference key="object" ref="41921744"/> + <reference key="parent" ref="371590425"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">143</int> + <reference key="object" ref="307029731"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="898541514"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">146</int> + <reference key="object" ref="898541514"/> + <reference key="parent" ref="307029731"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">133</int> + <reference key="object" ref="95502372"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="302770213"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">140</int> + <reference key="object" ref="302770213"/> + <reference key="parent" ref="95502372"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">127</int> + <reference key="object" ref="925722485"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="540516504"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">128</int> + <reference key="object" ref="540516504"/> + <reference key="parent" ref="925722485"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">134</int> + <reference key="object" ref="382885577"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="493858441"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">139</int> + <reference key="object" ref="493858441"/> + <reference key="parent" ref="382885577"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">129</int> + <reference key="object" ref="498595760"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="676380058"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">132</int> + <reference key="object" ref="676380058"/> + <reference key="parent" ref="498595760"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">135</int> + <reference key="object" ref="669058752"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="66600519"/> </object> + <reference key="parent" ref="585255460"/> </object> - <int key="connectionID">49</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">value: values.NumberOfKnots</string> - <reference key="source" ref="392143892"/> - <reference key="destination" ref="1001"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="392143892"/> - <reference key="NSDestination" ref="1001"/> - <string key="NSLabel">value: values.NumberOfKnots</string> - <string key="NSBinding">value</string> - <string key="NSKeyPath">values.NumberOfKnots</string> - <object class="NSDictionary" key="NSOptions"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSAllowsEditingMultipleValuesSelection</string> - <string>NSConditionallySetsEnabled</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <boolean value="NO"/> - <boolean value="NO"/> - </object> - </object> - <int key="NSNibBindingConnectorVersion">2</int> + <object class="IBObjectRecord"> + <int key="objectID">138</int> + <reference key="object" ref="66600519"/> + <reference key="parent" ref="669058752"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">141</int> + <reference key="object" ref="373610845"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="79947852"/> </object> + <reference key="parent" ref="585255460"/> </object> - <int key="connectionID">50</int> - </object> - </object> - <object class="IBMutableOrderedSet" key="objectRecords"> - <object class="NSArray" key="orderedObjects"> - <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> - <int key="objectID">0</int> - <reference key="object" ref="0"/> - <reference key="children" ref="1000"/> - <nil key="parent"/> + <int key="objectID">148</int> + <reference key="object" ref="79947852"/> + <reference key="parent" ref="373610845"/> </object> <object class="IBObjectRecord"> - <int key="objectID">-2</int> - <reference key="object" ref="1001"/> - <reference key="parent" ref="0"/> - <string key="objectName">File's Owner</string> + <int key="objectID">125</int> + <reference key="object" ref="599827838"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="130290391"/> + </object> + <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> - <int key="objectID">-1</int> - <reference key="object" ref="1003"/> - <reference key="parent" ref="0"/> - <string key="objectName">First Responder</string> + <int key="objectID">126</int> + <reference key="object" ref="130290391"/> + <reference key="parent" ref="599827838"/> </object> <object class="IBObjectRecord"> - <int key="objectID">-3</int> - <reference key="object" ref="1004"/> - <reference key="parent" ref="0"/> - <string key="objectName">Application</string> + <int key="objectID">136</int> + <reference key="object" ref="659833234"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="404599171"/> + </object> + <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> - <int key="objectID">1</int> - <reference key="object" ref="1005"/> + <int key="objectID">137</int> + <reference key="object" ref="404599171"/> + <reference key="parent" ref="659833234"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">144</int> + <reference key="object" ref="527654156"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="1006"/> + <reference ref="747673443"/> </object> - <reference key="parent" ref="0"/> - <string key="objectName">ConfigurationSheet</string> + <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> - <int key="objectID">2</int> - <reference key="object" ref="1006"/> + <int key="objectID">145</int> + <reference key="object" ref="747673443"/> + <reference key="parent" ref="527654156"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">173</int> + <reference key="object" ref="724727501"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="415200325"/> - <reference ref="392143892"/> <reference ref="38819005"/> - <reference ref="654791710"/> - <reference ref="995501573"/> - <reference ref="1013048762"/> + <reference ref="392143892"/> + <reference ref="461347810"/> + <reference ref="1007515992"/> </object> - <reference key="parent" ref="1005"/> + <reference key="parent" ref="95880135"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5</int> - <reference key="object" ref="415200325"/> + <int key="objectID">70</int> + <reference key="object" ref="461347810"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="759654285"/> + <reference ref="575720656"/> </object> - <reference key="parent" ref="1006"/> + <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> - <int key="objectID">6</int> - <reference key="object" ref="759654285"/> - <reference key="parent" ref="415200325"/> + <int key="objectID">71</int> + <reference key="object" ref="575720656"/> + <reference key="parent" ref="461347810"/> </object> <object class="IBObjectRecord"> - <int key="objectID">7</int> - <reference key="object" ref="1013048762"/> + <int key="objectID">5</int> + <reference key="object" ref="415200325"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="328796931"/> + <reference ref="759654285"/> </object> - <reference key="parent" ref="1006"/> + <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> - <int key="objectID">8</int> - <reference key="object" ref="328796931"/> - <reference key="parent" ref="1013048762"/> + <int key="objectID">6</int> + <reference key="object" ref="759654285"/> + <reference key="parent" ref="415200325"/> </object> <object class="IBObjectRecord"> - <int key="objectID">9</int> - <reference key="object" ref="995501573"/> + <int key="objectID">23</int> + <reference key="object" ref="38819005"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="770782373"/> + <reference ref="922564724"/> </object> - <reference key="parent" ref="1006"/> + <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> - <int key="objectID">10</int> - <reference key="object" ref="770782373"/> - <reference key="parent" ref="995501573"/> + <int key="objectID">24</int> + <reference key="object" ref="922564724"/> + <reference key="parent" ref="38819005"/> </object> <object class="IBObjectRecord"> - <int key="objectID">11</int> - <reference key="object" ref="654791710"/> + <int key="objectID">72</int> + <reference key="object" ref="1007515992"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="460152017"/> + <reference ref="55582849"/> </object> - <reference key="parent" ref="1006"/> + <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> - <int key="objectID">12</int> - <reference key="object" ref="460152017"/> - <reference key="parent" ref="654791710"/> + <int key="objectID">73</int> + <reference key="object" ref="55582849"/> + <reference key="parent" ref="1007515992"/> </object> <object class="IBObjectRecord"> <int key="objectID">21</int> <reference key="object" ref="392143892"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="154709998"/> </object> - <reference key="parent" ref="1006"/> + <reference key="parent" ref="724727501"/> </object> <object class="IBObjectRecord"> <int key="objectID">22</int> <reference key="object" ref="154709998"/> <reference key="parent" ref="392143892"/> </object> <object class="IBObjectRecord"> - <int key="objectID">23</int> - <reference key="object" ref="38819005"/> + <int key="objectID">80</int> + <reference key="object" ref="337999651"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="922564724"/> + <reference ref="316809000"/> </object> - <reference key="parent" ref="1006"/> + <reference key="parent" ref="585255460"/> </object> <object class="IBObjectRecord"> - <int key="objectID">24</int> - <reference key="object" ref="922564724"/> - <reference key="parent" ref="38819005"/> + <int key="objectID">81</int> + <reference key="object" ref="316809000"/> + <reference key="parent" ref="337999651"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">78</int> + <reference key="object" ref="667726591"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1037067466"/> + </object> + <reference key="parent" ref="585255460"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">79</int> + <reference key="object" ref="1037067466"/> + <reference key="parent" ref="667726591"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">174</int> + <reference key="object" ref="87774458"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1063097842"/> + </object> + <reference key="parent" ref="962628448"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">175</int> + <reference key="object" ref="1063097842"/> + <reference key="parent" ref="87774458"/> </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>1.IBEditorWindowLastContentRect</string> <string>1.IBPluginDependency</string> <string>1.IBWindowTemplateEditedContentRect</string> <string>1.NSWindowTemplate.visibleAtLaunch</string> <string>1.WindowOrigin</string> <string>1.editorWindowContentRectSynchronizationRect</string> <string>1.windowTemplate.hasMinSize</string> <string>1.windowTemplate.minSize</string> <string>10.IBPluginDependency</string> + <string>100.IBPluginDependency</string> + <string>101.IBPluginDependency</string> + <string>102.IBPluginDependency</string> + <string>103.IBPluginDependency</string> + <string>104.IBPluginDependency</string> + <string>105.IBPluginDependency</string> + <string>106.IBPluginDependency</string> + <string>107.IBPluginDependency</string> + <string>108.IBPluginDependency</string> + <string>109.IBPluginDependency</string> <string>11.IBPluginDependency</string> + <string>110.IBPluginDependency</string> + <string>111.IBPluginDependency</string> + <string>112.IBPluginDependency</string> + <string>113.IBPluginDependency</string> + <string>114.IBPluginDependency</string> + <string>115.IBPluginDependency</string> <string>12.IBPluginDependency</string> + <string>125.IBPluginDependency</string> + <string>126.IBPluginDependency</string> + <string>127.IBPluginDependency</string> + <string>128.IBPluginDependency</string> + <string>129.IBPluginDependency</string> + <string>130.IBPluginDependency</string> + <string>131.IBPluginDependency</string> + <string>132.IBPluginDependency</string> + <string>133.IBPluginDependency</string> + <string>134.IBPluginDependency</string> + <string>135.IBPluginDependency</string> + <string>136.IBPluginDependency</string> + <string>137.IBPluginDependency</string> + <string>138.IBPluginDependency</string> + <string>139.IBPluginDependency</string> + <string>140.IBPluginDependency</string> + <string>141.IBPluginDependency</string> + <string>142.IBPluginDependency</string> + <string>143.IBPluginDependency</string> + <string>144.IBPluginDependency</string> + <string>145.IBPluginDependency</string> + <string>146.IBPluginDependency</string> + <string>147.IBPluginDependency</string> + <string>148.IBPluginDependency</string> + <string>174.IBPluginDependency</string> + <string>175.IBPluginDependency</string> <string>2.IBPluginDependency</string> <string>21.IBPluginDependency</string> <string>22.IBPluginDependency</string> <string>23.IBPluginDependency</string> <string>24.IBPluginDependency</string> <string>5.IBPluginDependency</string> + <string>58.IBPluginDependency</string> + <string>59.IBPluginDependency</string> <string>6.IBPluginDependency</string> + <string>60.IBPluginDependency</string> + <string>61.IBPluginDependency</string> + <string>62.IBPluginDependency</string> + <string>63.IBPluginDependency</string> + <string>64.IBPluginDependency</string> + <string>65.IBPluginDependency</string> <string>7.IBPluginDependency</string> + <string>70.IBPluginDependency</string> + <string>71.IBPluginDependency</string> + <string>72.IBPluginDependency</string> + <string>73.IBPluginDependency</string> + <string>78.IBPluginDependency</string> + <string>79.IBPluginDependency</string> <string>8.IBPluginDependency</string> + <string>80.IBPluginDependency</string> + <string>81.IBPluginDependency</string> + <string>85.IBPluginDependency</string> + <string>86.IBPluginDependency</string> + <string>87.IBPluginDependency</string> + <string>88.IBPluginDependency</string> + <string>89.IBPluginDependency</string> <string>9.IBPluginDependency</string> + <string>90.IBPluginDependency</string> + <string>91.IBPluginDependency</string> + <string>92.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>{{665, 702}, {415, 110}}</string> + <string>{{391, 376}, {535, 452}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{665, 702}, {415, 110}}</string> + <string>{{391, 376}, {535, 452}}</string> <boolean value="NO"/> <string>{196, 240}</string> <string>{{202, 428}, {480, 270}}</string> <boolean value="NO"/> <string>{368, 331}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> - <int key="maxID">52</int> + <int key="maxID">177</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">XamhainUserDefaultsController</string> <string key="superclassName">NSUserDefaultsController</string> <object class="NSMutableDictionary" key="outlets"> <string key="NS.key.0">mpConfigureSheet</string> <string key="NS.object.0">NSWindow</string> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">screen saving/XamhainUserDefaultsController.h</string> </object> </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">NSActionCell</string> <string key="superclassName">NSCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="87276028"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="696164746"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1054327803"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">NSBox</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSBox.h</string> + </object> + </object> <object class="IBPartialClassDescription"> <string key="className">NSButton</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButtonCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSCell</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSControl</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="476499260"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSController</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFormatter</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenu</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="871101704"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="87276028"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="696164746"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="1054327803"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="476499260"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="871101704"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="701233559"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSError.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">NSSlider</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSlider.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSSliderCell</string> + <string key="superclassName">NSActionCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSliderCell.h</string> + </object> + </object> <object class="IBPartialClassDescription"> <string key="className">NSStepper</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSStepper.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSStepperCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSStepperCell.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTabView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTabView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTabViewItem</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTabViewItem.h</string> + </object> + </object> <object class="IBPartialClassDescription"> <string key="className">NSTextField</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextField.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextFieldCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSUserDefaultsController</string> <string key="superclassName">NSController</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserDefaultsController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <string key="superclassName">NSResponder</string> <reference key="sourceIdentifier" ref="701233559"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> </object> </object> </object> </object> <int key="IBDocument.localizationMode">0</int> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> <integer value="1060" key="NS.object.0"/> </object> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> <integer value="3000" key="NS.object.0"/> </object> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">XamhainII.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> </data> </archive>
jjk/XamhainII
3f84aab601738242423d6752037100e868e446aa
Some small improvements.
diff --git a/defaults.plist b/defaults.plist index 611595f..d323ee5 100644 --- a/defaults.plist +++ b/defaults.plist @@ -1,56 +1,56 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>BroadKnotProbability</key> <real>0.5</real> <key>CircularKnotProbability</key> <real>0.5</real> <key>ClosedKnotProbability</key> <real>0.5</real> <key>CornerProbability1</key> <real>0.2</real> <key>CornerProbability2</key> <real>0.8</real> <key>HollowKnotProbability</key> <real>0.4</real> <key>HorizontalKnotProbability</key> <real>0.1</real> <key>HorizontalMirrorProbability</key> <real>0.9</real> <key>KnotSubdivisions</key> <integer>2</integer> <key>MaxSize</key> <real>0.5</real> <key>MaxSpeed</key> <real>6.0</real> <key>MaxSpin</key> <real>5.0</real> <key>MinSize</key> <real>0.2</real> <key>MinSpeed</key> <real>3.0</real> <key>MinSpin</key> <real>1.0</real> <key>NumberOfKnots</key> <integer>8</integer> <key>SectionProbability1</key> <real>0.06</real> <key>SectionProbability2</key> <real>0.94</real> <key>SkewProbability</key> <real>0.8</real> <key>SpinProbability</key> <real>0.8</real> <key>SymmetricKnotProbability</key> <real>0.8</real> <key>Technicolor</key> <true/> <key>TicksPerSecond</key> <integer>60</integer> <key>VerticalKnotProbability</key> - <real>0.2</real> + <real>0.1</real> <key>VerticalMirrorProbability</key> <real>0.9</real> </dict> </plist> diff --git a/knot engine/RandomKnot.cpp b/knot engine/RandomKnot.cpp index 0d7dac2..e652a52 100644 --- a/knot engine/RandomKnot.cpp +++ b/knot engine/RandomKnot.cpp @@ -1,392 +1,392 @@ // Base class for creating random knots. // // Copyright © 1997-2009 Jens Kilian // // This file is part of XamhainII. // // XamhainII is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // XamhainII is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with XamhainII. If not, see <http://www.gnu.org/licenses/>. #include "RandomKnot.h" #include <algorithm> #include <cmath> #include <cstdlib> #include <OpenGL/gl.h> #include "KnotSection.h" #include "KnotStyle.h" #include "Position.h" #include "RandomColor.h" #include "RandomNumbers.h" #include "StrokeSet.h" namespace { // Generate an array of random direction values. Direction * randomDirectionArray(int width, int height, GLfloat min, GLfloat max) { Direction *pArray = new Direction[width * height]; for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { GLfloat p = randomFloat(); if (p < min) { pArray[i*width + j] = H; } else if (p < max) { pArray[i*width + j] = D; } else { pArray[i*width + j] = V; } } } return pArray; } // Enforce symmetry in an array of random direction values. void enforceSymmetry(Direction *pArray, int width, int height, int widthLimit, int heightLimit, bool xMirror, bool yMirror) { for (int i0 = 0; i0 < heightLimit; ++i0) { const int i1 = yMirror ? height - i0 - 1 : i0; for (int j0 = 0; j0 < widthLimit; ++j0) { const int j1 = xMirror ? width - j0 - 1 : j0; pArray[i1*width + j1] = pArray[i0*width + j0]; } } } } RandomKnot::RandomKnot(const KnotStyle &knotStyle, int windowWidth, int windowHeight, int maxSections) : mWindowWidth(windowWidth), mWindowHeight(windowHeight), mHSections(3 + randomInteger(maxSections - 3)), mVSections(3 + randomInteger(maxSections - 3)), mOutlineStrokes(knotStyle.outline()), mFillStrokes(knotStyle.fill()), mHollow(randomFloat() < mPrefs.hollowKnotProbability()), mpSectionTypes(0), mpSectionCorners(0), mpColors(0), mDisplayList(0) { // Initialize the knot data. Derived classes have to establish // the proper boundary conditions. mpSectionTypes = randomDirectionArray(mHSections, mVSections, mPrefs.sectionProbability1(), mPrefs.sectionProbability2()); mpSectionCorners = randomDirectionArray(mHSections + 1, mVSections + 1, mPrefs.cornerProbability1(), mPrefs.cornerProbability2()); mpSectionColors[BOT] = new int[mHSections * mVSections]; mpSectionColors[TOP] = new int[mHSections * mVSections]; if (randomFloat() < mPrefs.symmetricKnotProbability()) { // Enforce symmetries. enforceHorizontalSymmetry( randomFloat() < mPrefs.horizontalMirrorProbability()); enforceVerticalSymmetry( randomFloat() < mPrefs.verticalMirrorProbability()); } } RandomKnot::~RandomKnot(void) { delete [] mpSectionTypes; mpSectionTypes = 0; delete [] mpSectionCorners; mpSectionCorners = 0; delete [] mpSectionColors[BOT]; mpSectionColors[BOT] = 0; delete [] mpSectionColors[TOP]; mpSectionColors[TOP] = 0; delete [] mpColors; mpColors = 0; if (mDisplayList) { glDeleteLists(mDisplayList, 1); mDisplayList = 0; } } bool RandomKnot::animate(void) { if (mTime >= mMaxTime) { return false; } // Draw the knot in its current state. draw(mBasePosition + mTime * mDirection, mAngle); // Update the state. mTime += mSpeed; mAngle += mSpin; return true; } GLuint RandomKnot::displayList(void) const { if (!mDisplayList) { mDisplayList = glGenLists(1); // Generate the display list. glNewList(mDisplayList, GL_COMPILE); { drawBasicKnot(); } glEndList(); } return mDisplayList; } void RandomKnot::enforceHorizontalSymmetry(bool mirror) { enforceSymmetry(mpSectionTypes, mHSections, mVSections, mHSections / 2, mVSections, true, mirror); enforceSymmetry(mpSectionCorners, mHSections + 1, mVSections + 1, (mHSections + 1) / 2, mVSections + 1, true, mirror); } void RandomKnot::enforceVerticalSymmetry(bool mirror) { enforceSymmetry(mpSectionTypes, mHSections, mVSections, mHSections, mVSections / 2, mirror, true); enforceSymmetry(mpSectionCorners, mHSections + 1, mVSections + 1, mHSections + 1, (mVSections + 1) / 2, mirror, true); } void RandomKnot::prepareAnimation(Position extent, bool xRepeat, bool yRepeat) { // Find a random position within the window where the knot will be visible. const GLfloat knotWidth = 2.0 * extent.x; const GLfloat knotHeight = 2.0 * extent.y; if (knotWidth < mWindowWidth && knotHeight < mWindowHeight) { mBasePosition = Position(randomFloat(mWindowWidth - knotWidth), randomFloat(mWindowHeight - knotHeight)) + extent; } else { mBasePosition = Position(randomFloat() * mWindowWidth, randomFloat() * mWindowHeight); } // Give the knot a random speed, direction, angle and spin. - mSpeed = randomFloat(mPrefs.minSpeed(), mPrefs.maxSpeed()); + mSpeed = randomFloat(mPrefs.minSpeed(), mPrefs.maxSpeed()) + 0.1; GLfloat dir; if (randomFloat() < mPrefs.skewProbability()) { dir = randomFloat(0.0, M_PI * 2.0); if (xRepeat) { mAngle = fmod(dir + M_PI_2, M_PI * 2.0); } else if (yRepeat) { mAngle = dir; } else { mAngle = randomFloat(0.0, M_PI * 2.0); } } else { int quad; if (xRepeat) { quad = 2 * randomInteger(2) + 1; } else if (yRepeat) { quad = 2 * randomInteger(2); } else { quad = randomInteger(4); } dir = quad * M_PI_2; mAngle = 0.0; } mDirection = Position(cos(dir), sin(dir)); if (randomFloat() < mPrefs.spinProbability()) { mSpin = randomFloat(mPrefs.minSpin(), mPrefs.maxSpin()) * ((randomFloat() < 0.5) ? 1.0 : -1.0) / 180.0 * M_PI; } else { mSpin = 0.0; } // Calculate the starting and stopping times, i.e., the time at which // the knot's bounding circle is tangent to the window's bounding circle. // // - project window midpoint to point P0 on line of movement at time T0. // - use Pythagoras to compute distance from P0 to center of knot // - calculate T0 - distance and T0 + distance const Position midPosition(mWindowWidth * 0.5, mWindowHeight * 0.5); const GLfloat t0 = (midPosition - mBasePosition) * mDirection; const Position p0 = mBasePosition + t0 * mDirection; const GLfloat hyp = norm(midPosition) + norm(extent); const GLfloat cat = norm(midPosition - p0); const GLfloat distance = sqrt(hyp * hyp - cat * cat); mTime = t0 - distance; mMaxTime = t0 + distance; // Adjust the spin rate so the angle is consistent at start and stop. GLfloat iterations = floor((mMaxTime - mTime) / mSpeed); mSpin = floor(mSpin / M_PI * iterations) * M_PI / iterations; } void RandomKnot::assignColors(void) { // Initialize the color indices; -1 indicates an as-yet-unknown color. int color = mPrefs.technicolor() ? -1 : 0; for (int y = 0; y < mVSections; ++y) { for (int x = 0; x < mHSections; ++x) { mpSectionColors[BOT][y * mHSections + x] = color; mpSectionColors[TOP][y * mHSections + x] = color; } } ++color; // Assign colors to the sections by tracing all the 'strands' in the knot. for (int y = 0; y < mVSections; ++y) { for (int x = 0; x < mHSections; ++x) { if (mpSectionColors[TOP][y * mHSections + x] < 0) { // Assign a color to the top strand. if (traceColor(color, TOP, x, y, 0, 0)) { ++color; } } if (mpSectionColors[BOT][y * mHSections + x] < 0) { // Assign a color to the bottom strand. switch (mpSectionTypes[y * mHSections + x]) { case D: case H: if (traceColor(color, BOT, x, y, 0, 1)) { ++color; } break; case V: if (traceColor(color, BOT, x, y, 1, 0)) { ++color; } break; case N: break; } } } } // Generate the random colors. mpColors = new RandomColor[color]; int hue = randomInteger(360); const int gamut = 90 + randomInteger(270); const int shift = gamut / color; for (int i = 0; i < color; ++i) { mpColors[i] = RandomColor(0.4, 0.9, 0.6, 1.0, 1.0, 1.0, hue); hue = (hue + shift) % 360; } } bool RandomKnot::traceColor(int color, int layer, int x, int y, int dx, int dy) { for (;;) { mpSectionColors[layer][y * mHSections + x] = color; // Hop across the corner indicated by dx/dy. switch (mpSectionCorners[(y+dy) * (mHSections+1) + x+dx]) { case D: x = (dx ? x+1 : x-1+mHSections) % mHSections; dx = 1-dx; y = (dy ? y+1 : y-1+mVSections) % mVSections; dy = 1-dy; break; case H: x = (dx ? x+1 : x-1+mHSections) % mHSections; dx = 1-dx; break; case V: y = (dy ? y+1 : y-1+mVSections) % mVSections; dy = 1-dy; break; case N: mpSectionColors[layer][y * mHSections + x] = 0; return false; } // Decide how to continue. switch (mpSectionTypes[y * mHSections + x]) { case D: dx = 1-dx; dy = 1-dy; layer = (dx + dy) % 2 ? BOT : TOP; break; case H: dx = 1-dx; layer = dy ? BOT : TOP; break; case V: dy = 1-dy; layer = dx ? BOT : TOP; break; case N: // This can't happen. abort(); } if (mpSectionColors[layer][y * mHSections + x] == color) { // We're done with this strand. break; } else if (mpSectionColors[layer][y * mHSections + x] >= 0) { // This can't happen. abort(); } } return true; } diff --git a/screen saving/XamhainGLView.h b/screen saving/XamhainGLView.h index 4665705..428d2d2 100644 --- a/screen saving/XamhainGLView.h +++ b/screen saving/XamhainGLView.h @@ -1,41 +1,39 @@ // XamhainII OpenGL view. // // Copyright © 2009, Jens Kilian. // // This file is part of XamhainII. // // XamhainII is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // XamhainII is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with XamhainII. If not, see <http://www.gnu.org/licenses/>. #import <AppKit/NSOpenGLView.h> class KnotStyle; class RandomKnot; class XamhainPreferences; @interface XamhainGLView : NSOpenGLView { - XamhainPreferences *mpPrefs; // user defaults - KnotStyle *mpBroadStyle; // knot styles KnotStyle *mpSlenderStyle; int mNumberOfKnots; // knots being animated RandomKnot **mppKnots; } - (void) startAnimation; - (void) stopAnimation; @end diff --git a/screen saving/XamhainGLView.mm b/screen saving/XamhainGLView.mm index 2090c83..5e1e5eb 100644 --- a/screen saving/XamhainGLView.mm +++ b/screen saving/XamhainGLView.mm @@ -1,196 +1,177 @@ // XamhainII OpenGL view. // // Copyright © 2009, Jens Kilian. // // This file is part of XamhainII. // // XamhainII is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // XamhainII is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with XamhainII. If not, see <http://www.gnu.org/licenses/>. #import "XamhainGLView.h" #include <algorithm> using namespace ::std; #include <OpenGL/gl.h> #include "CircularKnot.h" #include "ClosedKnot.h" #include "HorizontalKnot.h" #include "KnotStyle.h" #include "RandomNumbers.h" #include "VerticalKnot.h" namespace { // Knot types. enum KnotType { kClosed, kCircular, kHorizontal, kVertical }; } @implementation XamhainGLView + (NSOpenGLPixelFormat *) defaultPixelFormat { static const NSOpenGLPixelFormatAttribute attributes[] = { NSOpenGLPFADoubleBuffer, 0 }; return [[NSOpenGLPixelFormat alloc] initWithAttributes: attributes]; } -- (id) initWithFrame: (NSRect)frame -{ - self = [super initWithFrame: frame]; - if (self) { - mpPrefs = new XamhainPreferences; - - mpSlenderStyle = mpBroadStyle = 0; - - mppKnots = 0; - } - - return self; -} - - (void) startAnimation { mpBroadStyle = new KnotStyle("broad"); mpSlenderStyle = new KnotStyle("slender"); - mNumberOfKnots = mpPrefs->numberOfKnots(); + XamhainPreferences prefs; + mNumberOfKnots = prefs.numberOfKnots(); mppKnots = new RandomKnot *[mNumberOfKnots]; fill(mppKnots, mppKnots + mNumberOfKnots, (RandomKnot *)0); } - (void) stopAnimation { if (mppKnots) { for (int i = 0; i < mNumberOfKnots; ++i) { delete mppKnots[i]; } delete [] mppKnots; mppKnots = 0; } delete mpSlenderStyle; delete mpBroadStyle; mpSlenderStyle = mpBroadStyle = 0; } -- (void) finalize -{ - delete mpPrefs; - - [super finalize]; -} - - (void) prepareOpenGL { const GLint one = 1; [[self openGLContext] setValues: &one forParameter: NSOpenGLCPSwapInterval]; glClearColor(0.0, 0.0, 0.0, 1.0); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } - (void) reshape { const NSSize size = [self bounds].size; const int width = size.width; const int height = size.height; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, width, 0.0, height, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } - (void) drawRect: (NSRect)dirtyRect { (void)dirtyRect; glClear(GL_COLOR_BUFFER_BIT); if (mppKnots) { const NSSize size = [self bounds].size; const int width = size.width; const int height = size.height; + XamhainPreferences prefs; for (int i = 0; i < mNumberOfKnots; ++i) { if (!mppKnots[i]) { // Determine knot style. const KnotStyle &style = - randomFloat() < mpPrefs->broadKnotProbability() + randomFloat() < prefs.broadKnotProbability() ? *mpBroadStyle : *mpSlenderStyle; // Determine knot type. KnotType type = kCircular; GLfloat p = randomFloat(); - if ((p -= mpPrefs->horizontalKnotProbability()) < 0.0) { + if ((p -= prefs.horizontalKnotProbability()) < 0.0) { type = kHorizontal; - } else if ((p -= mpPrefs->verticalKnotProbability()) < 0.0) { + } else if ((p -= prefs.verticalKnotProbability()) < 0.0) { type = kVertical; - } else if ((p -= mpPrefs->closedKnotProbability()) < 0.0) { + } else if ((p -= prefs.closedKnotProbability()) < 0.0) { type = kClosed; } switch (type) { case kClosed: mppKnots[i] = new ClosedKnot(style, width, height); break; case kCircular: mppKnots[i] = new CircularKnot(style, width, height); break; case kHorizontal: mppKnots[i] = new HorizontalKnot(style, width, height); break; case kVertical: mppKnots[i] = new VerticalKnot(style, width, height); break; } } if (!mppKnots[i]->animate()) { delete mppKnots[i]; mppKnots[i] = 0; } } } [[self openGLContext] flushBuffer]; } @end diff --git a/screen saving/XamhainView.mm b/screen saving/XamhainView.mm index 17eec14..728f8c6 100644 --- a/screen saving/XamhainView.mm +++ b/screen saving/XamhainView.mm @@ -1,80 +1,84 @@ // XamhainII screen saver view. // // Copyright © 2009, Jens Kilian. // // This file is part of XamhainII. // // XamhainII is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // XamhainII is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with XamhainII. If not, see <http://www.gnu.org/licenses/>. #import "XamhainView.h" #import "XamhainGLView.h" #include "XamhainPreferences.h" #import "XamhainUserDefaultsController.h" @implementation XamhainView - (id) initWithFrame: (NSRect)frame isPreview: (BOOL)isPreview { self = [super initWithFrame: frame isPreview: isPreview]; if (self) { XamhainPreferences prefs; [self setAnimationTimeInterval: 1.0/prefs.ticksPerSecond()]; const NSRect childFrame = NSOffsetRect(frame, -frame.origin.x, -frame.origin.y); mpGLView = [[XamhainGLView alloc] initWithFrame: childFrame]; if (mpGLView) { [self addSubview: mpGLView]; } else { NSLog(@"Failed to create XamhainGLView."); } } else { NSLog(@"Failed to create XamhainView"); } return self; } - (void) startAnimation { [super startAnimation]; + + XamhainPreferences prefs; + [self setAnimationTimeInterval: 1.0/prefs.ticksPerSecond()]; + [mpGLView startAnimation]; } - (void) stopAnimation { [super stopAnimation]; [mpGLView stopAnimation]; } - (void) animateOneFrame { [mpGLView setNeedsDisplay: YES]; } - (BOOL) hasConfigureSheet { return YES; } - (NSWindow *) configureSheet { return [[XamhainUserDefaultsController sharedUserDefaultsController] configureSheet]; } @end