From 514a0dffa036432c5b591772327da9e4dccb03e1 Mon Sep 17 00:00:00 2001 From: Russell Hamilton Date: Mon, 11 Dec 2017 13:44:21 +0000 Subject: [PATCH] Version for testing web server --- ParticleStats/ParticleStats_Inputs.py | 2 +- ParticleStats/TrackAlign_Functions.py | 43 ++++++++++++++++++++++----- scripts/TrackAlign.py | 2 -- setup.py | 2 +- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/ParticleStats/ParticleStats_Inputs.py b/ParticleStats/ParticleStats_Inputs.py index 1989ea1..3b548e0 100644 --- a/ParticleStats/ParticleStats_Inputs.py +++ b/ParticleStats/ParticleStats_Inputs.py @@ -199,7 +199,7 @@ def DrawTrailsOnImageFile(FileName,ParticleNo,CoordsSet,Colour,Coords,Scale, i = 0 while i < len(Coords): draw.point( (Coords[i][4]/Scale, Coords[i][5]/Scale),fill=Colour ) - if(i > minprint and i <= maxprint and ParticleNo == 1 and i % 100 == 0): + if(i > minprint and i <= maxprint and ParticleNo == 5 and i % 100 == 0): print ',' . join([ str(Coords[i][1]), str(Coords[i][2]), str(Coords[i][4]), str(Coords[i][5]) ]) i += 1 diff --git a/ParticleStats/TrackAlign_Functions.py b/ParticleStats/TrackAlign_Functions.py index 8898d93..ccfd4bd 100644 --- a/ParticleStats/TrackAlign_Functions.py +++ b/ParticleStats/TrackAlign_Functions.py @@ -703,7 +703,7 @@ def GenerateRandomCoords (Coords,Frames,Type,ntrails,imagesize,NoiseAmount,\ #------------------------------------------------------------------------------ def PlotMatchingTrails (OutName,IMSize,ImageName,Query,Hits,HitList,Colours,\ - Polygon,PolygonColour): + Polygon,PolygonColour): OutName = OutName+"_Hits" scene = Scene(OutName,IMSize[0],IMSize[1]) @@ -727,15 +727,25 @@ def PlotMatchingTrails (OutName,IMSize,ImageName,Query,Hits,HitList,Colours,\ print "SUB:", i, HitList[i], Hits[HitList[i]][0][4], Hits[HitList[i]][0][5], Hits[HitList[i]][-1][4], Hits[HitList[i]][-1][5] i += 1 + + i = 0 + while i < len(Hits): + print "sub:", i, Hits[i][0][4], Hits[i][0][5], Hits[i][-1][4], Hits[i][-1][5] + i += 1 + # Print the reference trail in black, with green/red circles at ends + + scene.add(Circle((Query[0][4],Query[0][5]),1,0,0,(0,255,0),0.5)) + scene.add(Line((Query[0][4],Query[0][5]), (Query[-1][4], Query[-1][5]),(255,0,0),1,0.5)) + scene.add(Circle((Query[-1][4], Query[-1][5]),1,0,0,(255,0,0),0.5)) + # i = 0 # while i < len(Results[0][0]): # if i == 0: -# scene.add(Circle((Results[0][0][i][0],Results[0][0][i][1]),\ -# 1,0,0,(0,255,0),0.5)) -# #if i == (len(Results[0][0])-1): -# # scene.add(Circle((Results[0][0][i][0],Results[0][0][i][1]),\ -# # 1,0,0,(255,0,0),0.5)) +# scene.add(Circle((Results[0][0][i][0],Results[0][0][i][1]),1,0,0,(0,255,0),0.5)) + #if i == (len(Results[0][0])-1): + # scene.add(Circle((Results[0][0][i][0],Results[0][0][i][1]),\ + # 1,0,0,(255,0,0),0.5)) # if i > 0: # scene.add(Line((Results[0][0][i-1][0],Results[0][0][i-1][1]),\ # (Results[0][0][i][0],Results[0][0][i][1]),\ @@ -743,6 +753,25 @@ def PlotMatchingTrails (OutName,IMSize,ImageName,Query,Hits,HitList,Colours,\ # i += 1 # Print the matching trails + i = 1 + while i < len(HitList): + RGB = ColourConvert(Colours[i]) + + j = 0 + while j < len(Hits[HitList[i]]): + + if j == 0: + scene.add(Circle((Hits[HitList[i]][j][4], Hits[HitList[i]][j][5]),0.5,0,0,(0,255,0),0.5)) + if j == (len(Hits[HitList[i]])-1): + scene.add(Circle((Hits[HitList[i]][j][4], Hits[HitList[i]][j][5]),0.5,0,0,(255,0,0),0.5)) + if j > 0: + scene.add(Line((Hits[HitList[i]][j-1][4],Hits[HitList[i]][j-1][5]),\ + (Hits[HitList[i]][j][4], Hits[HitList[i]][j][5]),\ + (RGB[0],RGB[1],RGB[2]),0.5,0.5)) + j += 1 + + i += 1 + # i = 1 # while i < len(Results): # RGB = ColourConvert(Colours[i]) @@ -756,7 +785,7 @@ def PlotMatchingTrails (OutName,IMSize,ImageName,Query,Hits,HitList,Colours,\ # # 0.5,0,0,(255,0,0),0.5)) # if j > 0: # scene.add(Line((Results[i][0][j-1][0],Results[i][0][j-1][1]),\ -# (Results[i][0][j][0],Results[i][0][j][1]),\ +# (Results[i][0][j][0],Results[i][0][j][1]),\ # (RGB[0],RGB[1],RGB[2]),0.5,0.5)) # j += 1 # diff --git a/scripts/TrackAlign.py b/scripts/TrackAlign.py index 168d6d9..e165a3a 100755 --- a/scripts/TrackAlign.py +++ b/scripts/TrackAlign.py @@ -467,8 +467,6 @@ print PS_Inputs.Colourer(Separator,"grey",options.OutputType,"",FontSize_Text) -sys.exit() - if options.Polygon: cnt_ROI_R = 0 diff --git a/setup.py b/setup.py index 3aadd9d..1125461 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ license = 'GPLv3', packages = ['ParticleStats'], #py_modules=[ "ParticleStats_Inputs.py", "ParticleStats_Maths.py", "ParticleStats_Outputs.py", "ParticleStats_Plots.py", "ParticleStats_RandomTrailGenerator.py", "ParticleStats_Vectors.py", "Test_Interactive_OSX_DivideUpLines.py", "Test_Interactive_OSX.py", "Test_Interactive.py" ], - scripts=["scripts/ParticleStats_Compare.py", "scripts/ParticleStats_Directionality.py", "scripts/ParticleStats_Kymographs.py", "scripts/ParticleStats_ROI.py", "scripts/ParticleStats_Trackmate.py", "scripts/ParticleStats_Vibtest.py", "scripts/TrackAlign.py"], + scripts=["scripts/ParticleStats_Compare.py", "scripts/ParticleStats_Directionality.py", "scripts/ParticleStats_Kymographs.py", "scripts/ParticleStats_ROI.py", "scripts/ParticleStats_Trackmate.py", "scripts/ParticleStats_Vibtest.py", "scripts/TrackAlign.py", "scripts/ParticleStats_Behavioral.py"], ext_modules = [module1], package_data={ 'ParticleStats': [