From cbc02fcde9997468396dd1a86dc991324d352f36 Mon Sep 17 00:00:00 2001 From: moonanjum26 Date: Thu, 9 Aug 2018 18:36:58 +0530 Subject: [PATCH] first commit --- src/firmware/IAD_v2_4_AIO.ino | 479 +++++++++ src/matlab/IAD_v_2_3.fig | Bin 0 -> 14029 bytes src/matlab/IAD_v_2_3.m | 1213 ++++++++++++++++++++++ src/python/0.jpg | Bin 0 -> 7125 bytes src/python/pyuic5.bat | 1 + src/python/slide_scanner_gui.py | 399 +++++++ src/python/slide_scanner_test.py | 419 ++++++++ src/python/slide_scanner_test.pyc | Bin 0 -> 11967 bytes src/python/slide_scanner_test.qml | 111 ++ src/python/slide_scanner_test.qmlproject | 20 + src/python/slide_scanner_test.ui | 986 ++++++++++++++++++ src/python/toQImage.py | 27 + src/python/toQImage.pyc | Bin 0 -> 1307 bytes 13 files changed, 3655 insertions(+) create mode 100644 src/firmware/IAD_v2_4_AIO.ino create mode 100644 src/matlab/IAD_v_2_3.fig create mode 100644 src/matlab/IAD_v_2_3.m create mode 100644 src/python/0.jpg create mode 100644 src/python/pyuic5.bat create mode 100644 src/python/slide_scanner_gui.py create mode 100644 src/python/slide_scanner_test.py create mode 100644 src/python/slide_scanner_test.pyc create mode 100644 src/python/slide_scanner_test.qml create mode 100644 src/python/slide_scanner_test.qmlproject create mode 100644 src/python/slide_scanner_test.ui create mode 100644 src/python/toQImage.py create mode 100644 src/python/toQImage.pyc diff --git a/src/firmware/IAD_v2_4_AIO.ino b/src/firmware/IAD_v2_4_AIO.ino new file mode 100644 index 0000000..7f32eff --- /dev/null +++ b/src/firmware/IAD_v2_4_AIO.ino @@ -0,0 +1,479 @@ +#include + +#define Xdir 13 +#define Ydir 12 +#define Zdir 11 + +#define Ybump 32 +#define Xbump 36 +#define AFbump 28 +#define bumpGnd 42 + +/*************************************************************************************** +This is what matters when you change the Step size : change the FoV accordingly +Rest of everything is calculated in terms of steps only +So the GUI needs to take care of step size to um conversion +***************************************************************************************/ +// FoV size. This is in steps. Calcuated as FoV (steps) = FoV (um) / stepSize +// The step size as on 27 June is 198 nm / step +long xFoV = 1843, yFoV = 2323; + +long XMaxStep=260000L, YMaxStep=130000L, ZMaxStep=30000L; +long limitTOZfocus = 31000L,limitToXZero=-250000,limitToYZero=4000; + +// steps to go before stopping +int trayOutNoiseMargin = 50; + +long XcurrStep=0L, YcurrStep=0L, ZcurrStep=0L; +long Ax=0L,Ay=0L,Az=0L,Bx=0L,By=0L,Bz=0L,Cx=0L,Cy=0L,Cz=0L; +long nextZstep = 0, XdeltaZperFoV=0, YdeltaZperFoV=0; +int needtocheckXmovement=0,needtocheckYmovement=0,needtocheckZmovement=0; + +void setup() { + Serial.begin(57600); + // pulse : X,Y,Z :: TX 1,2,3 + Serial1.begin(38400); Serial2.begin(38400); Serial3.begin(38400); + pinMode(Zdir,OUTPUT); pinMode(Ydir,OUTPUT); pinMode(Xdir,OUTPUT); + pinMode(Xbump,INPUT); pinMode(Ybump,INPUT); pinMode(AFbump,INPUT); // The bump switchs + pinMode(bumpGnd,OUTPUT); digitalWrite(bumpGnd,LOW); // this sets the gnd for the bump switches + +} + +void loop() { + + int choice = Serial.read(); + + switch(choice){ + case('T') : digitalWrite(Zdir,LOW); delayMicroseconds(10); doZSteps(1); ZcurrStep=ZcurrStep-1; // T == Z up by 5 counts + break; + case('G') : digitalWrite(Zdir,HIGH); delayMicroseconds(10); doZSteps(1); ZcurrStep=ZcurrStep+1; // G == Z down + break; + case('A') : needtocheckXmovement=1; digitalWrite(Xdir,LOW); delayMicroseconds(10); doXSteps(xFoV/5); XcurrStep=XcurrStep+xFoV; // A == X up by 1 FoV + break; + case('D') : needtocheckXmovement=0; digitalWrite(Xdir,HIGH); delayMicroseconds(10); doXSteps(xFoV/5); XcurrStep=XcurrStep-xFoV; // D == X down by 1 FoV + break; + case('W') : needtocheckYmovement=0; digitalWrite(Ydir,LOW); delayMicroseconds(10); doYSteps(yFoV/5); YcurrStep=YcurrStep+yFoV; // W == Y up + break; + case('S') : needtocheckYmovement=1; digitalWrite(Ydir,HIGH); delayMicroseconds(10); doYSteps(yFoV/5); YcurrStep=YcurrStep-yFoV; // S == Y down + break; + case('J') : XcurrStep = 0; // J == X reset + break; + case('K') : YcurrStep = 0; // K == Y reset + break; + case('L') : ZcurrStep = 0; // L == Z reset + break; + case('B') : gotoXSetStep(getStep()); + break; + case('N') : gotoYSetStep(getStep()); + break; + case('M') : gotoZSetStep(getStep()); + break; + case('I') : Serial1.flush(); Serial.print('X'); Serial.print("#"); Serial.print(XcurrStep); Serial.print("#"); + break; + case('O') : Serial2.flush(); Serial.print('Y'); Serial.print("#"); Serial.print(YcurrStep); Serial.print("#"); + break; + case('P') : Serial3.flush(); Serial.print('Z');Serial.print("#"); Serial.print(ZcurrStep); Serial.print("#"); + break; + + // Set A,B,C - Codes are E,R,Y respectively + case('E') : Ax=XcurrStep; Ay=YcurrStep; Az=ZcurrStep; + break; + case('R') : Bx=XcurrStep; By=YcurrStep; Bz=ZcurrStep; + break; + case('Y') : Cx=XcurrStep; Cy=YcurrStep; Cz=ZcurrStep; + break; + case('U') : + break; + case('Z') : do4ptArea(); + break; + case('X') : + break; + case('C') : // linear scan + doAtoB(); + break; + case('V') : debug(); + break; + case('Q') : gohome(); + break; + case('F') : doFullArea(); + break; + + case('H') : gotoZSetStep(0); + // Signal that ready to AF now + Serial.print("H#"); + break; + case('1') : tray_out(); + break; + case('2') : tray_in(); + break; + case('0') : EEPROM.write(0,0); + break; + case('7') : Serial.print('7'); Serial.print("#"); + break; + case('3') : digitalWrite(Zdir,HIGH); delayMicroseconds(10); Serial3.print("X"); ZcurrStep=ZcurrStep+1; + break; + case('5') : digitalWrite(Zdir,LOW); delayMicroseconds(10); Serial3.print("X"); ZcurrStep=ZcurrStep-1; + break; + case('.'): // this is the travel sync option. First go 20 k steps and note time + Serial.print('0'); Serial.print("#"); gotoXSetStep(XcurrStep+20000); Serial.print('1'); Serial.print("#"); + Serial.print('2'); Serial.print("#"); gotoXSetStep(XcurrStep-20000); Serial.print('3'); Serial.print("#"); + Serial.print('4'); Serial.print("#"); gotoYSetStep(YcurrStep+20000); Serial.print('5'); Serial.print("#"); + Serial.print('6'); Serial.print("#"); gotoYSetStep(YcurrStep-20000); Serial.print('7'); Serial.print("#"); + default : break; + } +} + + +void doXSteps(long num) { while (num > 0 ) { + if( (needtocheckXmovement==1) && (digitalRead(Xbump) == LOW)) { XcurrStep=0; return;} // DO NOT MOVE IF ALREADY AT LIMIT + Serial1.print("U"); num--; } } + +void doYSteps(long num) { while (num > 0 ) { + if( (needtocheckYmovement==1) && (digitalRead(Ybump) == LOW)) { YcurrStep=0; return;} // DO NOT MOVE IF ALREADY AT LIMIT + Serial2.print("U"); num--; } } + +void doZSteps(long num) { while (num > 0 ) { + if( (needtocheckZmovement==1) && (digitalRead(AFbump) == LOW)) { ZcurrStep=0; return;} // DO NOT MOVE IF ALREADY AT LIMIT + Serial3.print("@"); num--; } } + +long getStep() +{ + long index = 0, inpStep[7]={0,0,0,0,0,0,0}, invalidInput = 0; + long setStep = 0L; + + + for(index=0; index<8; index++ ) + { + while ( Serial.available() < 1 ); + inpStep[index] = Serial.read() - 48; + } + + // DISCARD first byte : MATLAB sends the terminator character there. We need it since if we turn it off, MATALB won't read the Tx from this arduino + // ALSO igmore the second byte : that's the sign symbol + setStep = (inpStep[2]*100000) + (inpStep[3]*10000) + (inpStep[4]*1000) + (inpStep[5]*100) + (inpStep[6]*10) + (inpStep[7]*1) + 0L ; + + // check what sign was sent. If it was anything other than a '-' then dont worry + if (inpStep[1] + 48 == '-' ) { setStep = setStep*(-1); } + + return setStep; +} + +void gotoXSetStep(long XsetStep) +{ + if(XsetStep > XMaxStep) {XsetStep=XMaxStep;} + long stepstodo = abs(XsetStep - XcurrStep) / 5; + + if (XsetStep > XcurrStep) + { needtocheckXmovement=1 ; + digitalWrite(Xdir,LOW); delayMicroseconds(10); XcurrStep=XsetStep; doXSteps( stepstodo ); } + + if (XsetStep < XcurrStep) + { needtocheckXmovement=0 ; + digitalWrite(Xdir,HIGH); delayMicroseconds(10); XcurrStep=XsetStep; doXSteps( stepstodo ); } + +} + +void gotoYSetStep(long YsetStep) +{ + if(YsetStep > YMaxStep) {YsetStep = YMaxStep;} + long stepstodo = abs(YsetStep - YcurrStep) / 5; + + if (YsetStep > YcurrStep) + { needtocheckYmovement=0 ; + digitalWrite(Ydir,LOW); delayMicroseconds(10); YcurrStep=YsetStep; doYSteps( stepstodo ); } + + if (YsetStep < YcurrStep) + { + needtocheckYmovement=1 ; + digitalWrite(Ydir,HIGH); delayMicroseconds(10); YcurrStep=YsetStep; doYSteps( stepstodo ); } + +} + +void gotoZSetStep(long ZsetStep) +{ + //if(ZsetStep > ZMaxStep) {ZsetStep = ZMaxStep;} + long stepstodo = abs(ZsetStep - ZcurrStep) / 5; + + if (ZsetStep > ZcurrStep) + { needtocheckZmovement=0 ; + digitalWrite(Zdir,HIGH); delayMicroseconds(10); ZcurrStep=ZsetStep; doZSteps( stepstodo ); } + + if (ZsetStep < ZcurrStep) + { + needtocheckZmovement=1 ; + digitalWrite(Zdir,LOW); delayMicroseconds(10); ZcurrStep=ZsetStep; doZSteps( stepstodo ); } + +} + +void tray_out () +{/* + // if already tray out then skip this + //if (EEPROM.read(0) == 1) { return; } + // var to even out electric noise + int Xnoise=0, Ynoise=0, Znoise=0; + // x & y out + digitalWrite(Xdir,HIGH); digitalWrite(Ydir,HIGH); digitalWrite(Zdir,HIGH); delayMicroseconds(20); + + while ( Znoise < trayOutNoiseMargin ) + { + Serial1.print("U"); + if (digitalRead(AFbump) == HIGH) { Znoise++; } + } + + digitalWrite(Zdir,LOW); + for (int i=0; i<2000;i++) + { Serial1.print("U"); } + + + while ( Xnoise < trayOutNoiseMargin ) + { + Serial2.print("U"); + if (digitalRead(Xbump) == HIGH) { Xnoise++; } + } + + for (int i=0; i<5000;i++) + { Serial2.print("U"); } + + while ( Ynoise < trayOutNoiseMargin ) + { + Serial3.print("U"); + if (digitalRead(Ybump) == LOW) { Ynoise++; } + } + +// if all done, store this in EEPROM +//EEPROM.write(0,1); +*/ + +Serial.println("Tray out"); +} + +void tray_in() +{ +// assuming that it is called only after tray_out + // gotoXSetStep(125000); + //gotoYSetStep(-40000); + // gotoZSetStep(-3000); + + // now that we're at position, reset counts + //XcurrStep=0L; YcurrStep=0L; ZcurrStep=0L; + + // and the tray in var + // EEPROM.write(0,0); + } + + +void doFullArea() +{ + // calculate num of x & y FoV. And the tilts + long XstepCount = 252525 ; long numXsteps = (XstepCount / xFoV) ; long YstepCount = 126260 ; long numYsteps = (YstepCount / yFoV) ; + + /* The equations are + * Az = {Tx(Ax-Bx)} + {Ty(Ay-By)} + {Bz} + * and + * Az = {Tx(Ax-Cx)} + {Ty(Ay-Cy)} + {Cz} + * + * we can find Tx and Ty after some algebra + * After Tx and Ty, we can find Oz too + */ +long a = (round)( (Ax-Bx) / (float)xFoV); long b = (round)((Ay-By)/(float)yFoV); long c = (Az-Bz); +long d = (round)((Ax-Cx)/(float)xFoV); long e = (round)((Ay-Cy)/(float)yFoV); long f =(Az-Cz); +long Oz = 0L; + +XdeltaZperFoV = (round) ((c*e)-(b*f)) / (float) ((a*e)-(b*d)) ; +YdeltaZperFoV = (round) (c-(a*XdeltaZperFoV)) / (float) b ; +Oz = Az - (XdeltaZperFoV *(Ax/xFoV)) - (YdeltaZperFoV * (Ay/yFoV)); + +// Tilts calculated. Now go ahead with WSI ************************************************************** +// set the initial delta z to the x one. Later, in the loop, it will be changed continously +long deltaZperFoV = XdeltaZperFoV; + +//this var keeps track of xdir while scanning . +1 is inc., -1 is dec +long XtravelDir = 1; + +// go to the origin + gotoXSetStep(0); gotoYSetStep(0); gotoZSetStep(Oz); + delay(300); + +// Send sync signal to the imager. By now we're starting FoV and this will be immediately imaged. + Serial.print("S#"); + +// go go go + for (long trackY = 0; trackY <= numYsteps; trackY++) + { + for (long trackX = 0; trackX < numXsteps; trackX++) + { + gotoXSetStep(XcurrStep + (XtravelDir * xFoV)); + + /* Four cases now --- (a) we're at 1st fov : dont move Z ! + * --- (b)we're on first strip but more than 1st fov : keep adding X tilt + * --- (c) we're at end of strip and just moved to next strip : only add the Y tilt + * --- (d) we're in 2nd or higher strip : keep adding only X tilt (Y tilt already added at (c)) + */ + + if((trackX==0)&&(trackY==0)) { nextZstep = ZcurrStep; } + if((trackX>0)&&(trackY==0)) { nextZstep = ZcurrStep +(XtravelDir * deltaZperFoV); } + if((trackX==0)&&(trackY>0)) { nextZstep = ZcurrStep + YdeltaZperFoV;} + if((trackX>0)&&(trackY>0)) { nextZstep = ZcurrStep +(XtravelDir * deltaZperFoV); } + + gotoZSetStep(nextZstep); + + } + + // shift in the Y dir + gotoYSetStep(YcurrStep + yFoV); + + // now go in the opposite direction + XtravelDir = XtravelDir * -1; + } + + // All done. Now go back to ORIGIN + gotoXSetStep(0); gotoYSetStep(0); gotoZSetStep(0); + delay(300); +} + + +//88888888888888888888888888888888888888888888888888888888888888888 +// THIS IS THE GOHOME() FUNCTION +//88888888888888888888888888888888888888888888888888888888888888888 +void gohome() +{ +// turn on all lights +gotoYSetStep(-300000); gotoXSetStep(400000); +Serial1.flush(); Serial.print('X'); Serial.print("#"); Serial.print(XcurrStep); Serial.print("#"); +// Y already at origin. Need to bring X and Z there + +gotoXSetStep(limitToXZero); gotoYSetStep(limitToYZero); + +gotoZSetStep(-100000); gotoZSetStep(limitTOZfocus); + +// SET THIS AS ORIGIN +XcurrStep=0L; YcurrStep=0L; ZcurrStep=0L; +// all done now. Send sync signal + Serial.print("S#"); +} + +void debug() +{ + +// calc steps in X +long XstepCount = abs(Bx - Ax) ; long numXsteps = (XstepCount / xFoV) ; + +// calc steps in Y +long YstepCount = abs(Cy - By) ; long numYsteps = (YstepCount / yFoV) ; + +// calc the z changes +long XZdeltaCount = Bz - Az ; long XdeltaZperFoV = XZdeltaCount / (numXsteps-1); +long YZdeltaCount = Cz - Bz ; long YdeltaZperFoV = YZdeltaCount / (numYsteps-1); + +// set the initial delta z to the x one. Later, in the loop, it will be changed continously +long deltaZperFoV = XdeltaZperFoV; + +Serial.print(" Ax: ");Serial.print(Ax);Serial.print(" Ay: ");Serial.print(Ay);Serial.print(" Az: ");Serial.print(Az); +Serial.print(" Bx: ");Serial.print(Bx);Serial.print(" By: ");Serial.print(By);Serial.print(" Bz: ");Serial.print(Bz); +Serial.print(" Cx: ");Serial.print(Cx);Serial.print(" Cy: ");Serial.print(Cy);Serial.print(" Cz: ");Serial.print(Cz); +Serial.print(" XdeltaZperFoV: ");Serial.print(XdeltaZperFoV); +Serial.print(" YdeltaZperFoV: ");Serial.print(YdeltaZperFoV); +Serial.print("#"); + +} + +void do4ptArea() +{ +// calc steps in X +long XstepCount = abs(Bx - Ax) ; long numXsteps = (XstepCount / xFoV) ; + +// calc steps in Y +long YstepCount = abs(Cy - By) ; long numYsteps = (YstepCount / yFoV) ; + +// calc the z changes +long XZdeltaCount = Bz - Az ; long XdeltaZperFoV = XZdeltaCount / (numXsteps-1); +long YZdeltaCount = Cz - Bz ; long YdeltaZperFoV = YZdeltaCount / (numYsteps-1); + +// set the initial delta z to the x one. Later, in the loop, it will be changed continously +long deltaZperFoV = XdeltaZperFoV; + +//this var keeps track of xdir while scanning . +1 is inc., -1 is dec +long XtravelDir = 1; + +// go to the origin + gotoXSetStep(Ax); gotoYSetStep(Ay); gotoZSetStep(Az); + delay(300); + +// Send sync signal to the imager + Serial.print("S#"); +// go go go + for (long trackY = 0; trackY <= numYsteps; trackY++) + { + for (long trackX = 0; trackX < numXsteps; trackX++) + { + gotoXSetStep(XcurrStep + (XtravelDir * xFoV)); + + /* Four cases now --- (a) we're at 1st fov : dont move Z ! + * --- (b)we're on first strip but more than 1st fov : keep adding X tilt + * --- (c) we're at end of strip and just moved to next strip : only add the Y tilt + * --- (d) we're in 2nd or higher strip : keep adding only X tilt (Y tilt already added at (c)) + */ + + if((trackX==0)&&(trackY==0)) { nextZstep = ZcurrStep; } + if((trackX>0)&&(trackY==0)) { nextZstep = ZcurrStep +(XtravelDir * deltaZperFoV); } + if((trackX==0)&&(trackY>0)) { nextZstep = ZcurrStep + YdeltaZperFoV;} + if((trackX>0)&&(trackY>0)) { nextZstep = ZcurrStep +(XtravelDir * deltaZperFoV); } + + gotoZSetStep(nextZstep); + + } + + // shift in the Y dir + gotoYSetStep(YcurrStep + yFoV); + + // now go in the opposite direction + XtravelDir = XtravelDir * -1; + } + + // All done. Now go back to ORIGIN + gotoXSetStep(0); gotoYSetStep(0); gotoZSetStep(0); + delay(300); +} + +void doAtoB() +{ + long XMovDir = 1; + + // find num of Fov to be traversed and their direction + long XstepCount = abs(Bx - Ax) ; long numXFoV = (XstepCount / xFoV) ; + + if (Bx > Ax) { XMovDir = 1; } + if (Bx < Ax) { XMovDir = -1; } + + // setup Z data + long ZdeltaCount = Bz - Az ; + long deltaZperFoV = ZdeltaCount / numXFoV; // This gives the Z change per FoV + Serial.println("deltaperZfov is "); + Serial.println(deltaZperFoV); + // go to the origin + gotoXSetStep(Ax); gotoYSetStep(Ay); gotoZSetStep(Az); + + // Send sync signal to the imager + Serial.print("S#"); + delay(300); + + // go go go + if( XMovDir == 1) // means we're going in inc X dir + { + for(long i=0; ij1@VifeHzUZfOl2V-F5RL$%*WflXbFpo+mpRa{B6W@^r#Hd~_Oe`rP(Tu6A5>+O8kG?SWoy5_H-M zMyi@3LR@qTUUnb6?QH3Q?hwR_yl~ukexMev_*(DE6x+#J72qR4@|>#}QZPGOJzq zOIvC+ZCKdbYpgT2zNhlqL*YPtCOM=M|2!0?fKNxSZ}3B&h#2(w&E;gEU(=UvUq{F5 z^bz2u|Hdjz7%1aQi8TAng6>6SwZn}k)kb%$U#t<|IO6`xqq|S;%S1SM4*?Fap~h4t z(r{eVNcM<5ryJlakp+Hi(o7i+s*Lc)ow|s1+K}1OI8OaC$H?0F`HiY*!#1&Z8o)1} z8imES_w)GZcb0pCO$^irxs?!;KZ-9+4j+`{kmA2<%;7&SC}ynxX>V6tZB})RJaUv9 zy=;rpxWRU%@3oo#I3{a5=(qQM@xXoU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Xj6GNacLv{w5v9-3gj{HbSi1hQHyALhlTO|IsgrAW3ar6txemg|Q)891mWt16a z6rb7*mLwy`*@yq33!zqd%xO4M@MYzkm9b=_eRs(8Iy;j2!1jA2)Azy2Cc3RqTNsw? z!+5!(q5=BD@WL#?Crkl6q{5hO$ba5?gz`U^YqG}O=d~%K>Zw_$k0zl~1b7YSx$m)F z6XB#7D;av^#csWGua0lsBJxj^K~b~(ES(&-PNnxLgRW6t1@_*^swaK3l~u=Pg;4%E z2ZzY>jgOx?l_5o4+f!(0ajSltwk5Ze=$Zw#c|A@0#%7FpkiS;{T^A`|HyW9^IlwS#5j()1(LA)>RqNf+(jv zqb$a{wdAIanz|zQv$qqCQ?+7^3w*l!|e|e|}d~0fk+%mQ1{<+2fph1`x`Cf-boYCSYpoxa6J%geIUUSXPFKHZ^&i zbx#lSru|7!ragnPp6vG`QbYh--xhETpimlshpR_}!I+^eTi`{Vs7r%xlkwD=Dz@** zCl`RCu3Lzvmr)@b;f1QMSBN2);n2sm|I#g~9DqNmSBQy|LEgu(uh{S|0GmtC5`#0t zsE=dcpg}1BuSU-j^KFJ`AIrW*gJJ-VtKJ5NWQJcK&%Q;2asa`Z-UcRS20dBJrAV^T&dEvUaLv=q6n=>b41`9KW6 zdwLn16%L&q-juHQqFu4N%ZA&5{vQbf@eT1`S4f+WpOFmd4v;=7G2s$9$ZbQBukq>Z z6?Btpim){RD&3fAftEtIu8t>i!Pr<(o(_{lZ75gDqz$DH;>VNnI^g6*2bSCcT7Z{c z(Eg_gv;E0x%M&2@8b 250000) + check = 250000; + end; + + str = sprintf('%06d',abs(check)); % abs needed so that no +&- in neg numbers + + if(check < 0) + newstr = strcat('-',str); + else + newstr = strcat('+',str); + end; +% end formatting ---------- -------------------------------------------- + fprintf(s,'B'); + fprintf(s, newstr ); + + + +% --- Executes on slider movement. +function slider1_Callback(hObject, eventdata, handles) +% hObject handle to slider1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +sliderVal = get(hObject,'Value'); set(handles.edit10,'string', sliderVal ); + + + +% --- Executes during object creation, after setting all properties. +function slider1_CreateFcn(hObject, eventdata, handles) +% hObject handle to slider1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: slider controls usually have a light gray background. +if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor',[.9 .9 .9]); +end +set(hObject,'Max',250000,'Min',-250000) + + +% --- Executes on button press in pushbutton5. +function pushbutton5_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton5 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; fprintf(s, 'N'); fprintf(s, '0000000'); + + +function edit11_Callback(hObject, eventdata, handles) +% hObject handle to edit11 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of edit11 as text +% str2double(get(hObject,'String')) returns contents of edit11 as a double + + +% --- Executes during object creation, after setting all properties. +function edit11_CreateFcn(hObject, eventdata, handles) +% hObject handle to edit11 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in pushbutton6. +function pushbutton6_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton6 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; +% format the number properly -------------------------------------------- + str = get(handles.edit11,'string'); check = str2double(str); + % ensure that too big values dont go in + if (check < -250000) + check = -250000; + elseif (check > 250000) + check = 250000; + end; + + str = sprintf('%06d',abs(check)); % abs needed so that no +&- in neg numbers + + if(check < 0) + newstr = strcat('-',str); + else + newstr = strcat('+',str); + end; +% end formatting ---------- -------------------------------------------- + fprintf(s,'N'); fprintf(s, newstr ); + +% --- Executes on slider movement. +function slider2_Callback(hObject, eventdata, handles) +% hObject handle to slider2 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +sliderVal = sprintf('%06d',get(hObject,'Value')); +set(handles.edit11,'string', sliderVal ); + + +% --- Executes during object creation, after setting all properties. +function slider2_CreateFcn(hObject, eventdata, handles) +% hObject handle to slider2 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: slider controls usually have a light gray background. +if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor',[.9 .9 .9]); +end + + +% --- Executes on button press in pushbutton7. +function pushbutton7_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton7 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; fprintf(s, 'M'); fprintf(s, '0000000'); + + +function edit12_Callback(hObject, eventdata, handles) +% hObject handle to edit12 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of edit12 as text +% str2double(get(hObject,'String')) returns contents of edit12 as a double + + +% --- Executes during object creation, after setting all properties. +function edit12_CreateFcn(hObject, eventdata, handles) +% hObject handle to edit12 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in pushbutton8. +function pushbutton8_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton8 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; +% format the number properly -------------------------------------------- + str = get(handles.edit12,'string'); check = str2double(str); + % ensure that too big values dont go in + if (check < -50000) + check = -50000; + elseif (check > 250000) + check = 250000; + end; + + str = sprintf('%06d',abs(check)); % abs needed so that no +&- in neg numbers + + if(check < 0) + newstr = strcat('-',str); + else + newstr = strcat('+',str); + end; +% end formatting ---------- -------------------------------------------- + fprintf(s,'M'); fprintf(s, newstr ); + +% --- Executes on slider movement. +function slider3_Callback(hObject, eventdata, handles) +% hObject handle to slider3 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +sliderVal = sprintf('%06d',get(hObject,'Value')); +set(handles.edit12,'string', sliderVal ); + + +% --- Executes during object creation, after setting all properties. +function slider3_CreateFcn(hObject, eventdata, handles) +% hObject handle to slider3 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: slider controls usually have a light gray background. +if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor',[.9 .9 .9]); +end + + +% --- Executes on button press in pushbutton9. +function pushbutton9_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton9 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + s = handles.s; vid = handles.vid ; fid=handles.fid; resetbutton=handles.resetbutton; + set(handles.camwait,'string','Custom area scan started.'); + + tmr = handles.tmr; stop(tmr); + setslidename = handles.setslidename; + fprintf(fid, '\r\nStarting area scan...'); + XFoVSize = 1823; YFoVSize = 2323; + XPulseRate = 38400; YPulseRate = 38400 ; + Xzadjustdelay = 0.002; + autoContrTime = 0.1; + + XImDelay = (XFoVSize / XPulseRate) ; + YImDelay = (YFoVSize / YPulseRate) ; + + % send command to Arduino + fprintf(s,'Z'); + + % get the co-ods + xA = str2double(handles.xA); xB = str2double(handles.xB); + yC = str2double(handles.yC); yB = str2double(handles.yB); + + % logging co-ordinates + logline = strcat('\r\n Going from X co-od ',handles.xA,' to ',handles.xB); + fprintf(fid, logline); + logline = strcat('\r\n Going from Y co-od ',handles.yB,' to ',handles.yC); + fprintf(fid, logline); + + % find num of FoV + numofX = (xB - xA) / XFoVSize; + numofY = (yC - yB) / YFoVSize; + + % wait for the scan to begin + while fscanf(s) ~= 'S' + end; + % start counting time + tic; + + % NOW TAKING PICTURES + rowcount = 0; + filecount = 0; + + msg = '\r\n Starting image capture ...'; + fprintf(fid, msg); + + % Dircn = false; %We believe we start from top + while(rowcount <= numofY) + while(filecount <= numofX) + pause(XImDelay); + snapshot=getsnapshot(vid); + %enh_snapshot=autocontrast(snapshot); + filename = strcat(setslidename,'_',num2str(rowcount),'-',num2str(filecount), '.bmp'); + %imwrite(enh_snapshot,filename); + imwrite(snapshot,filename); + filecount = filecount + 1; + end + % wait for shift by one FoV in Y direction + filecount = 0; + pause(YImDelay); + rowcount = rowcount + 1; + end + % display time elapsed + time_to_scan_area = toc +%numofY*numofX + msg = sprintf('\r\nImages captured : %d x %d', numofY,numofX); + fprintf(fid, msg); + start(tmr); +set(handles.camwait,'string','Custom area scan completed.'); + +% --- Executes on button press in pushbutton10. +function pushbutton10_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton10 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; vid = handles.vid ; fid=handles.fid; resetbutton=handles.resetbutton; +tmr = handles.tmr; stop(tmr); +tic +setslidename = char(handles.setslidename); + +set(handles.camwait,'string','Auto WSI started.'); +fprintf(fid, '\r\nAuto WSI started.'); + +XFoVSize = 350; YFoVSize = 450; +XPulseRate = 3800 ; YPulseRate = 3800 ; % MICRO METER PER SEC +Xzadjustdelay = 0.002; +autoContrTime = 0.1; +XImDelay = (XFoVSize / XPulseRate) * 0.45; % reduction of 60% needed to compensate for MATLAB processing delays +YImDelay = (YFoVSize / YPulseRate) * 0.45; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% go home first. Send command and wait for sync +fprintf(s,'Q'); +while fscanf(s) ~= 'S' +end; + +%Af at origin and set this z as zero +%fullAF(handles,16000); fprintf(s,'L'); +disp('let go'); +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Locations of points : +% A: +% B: +% C: +% D: +% E: +% F: +% G: +% H: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % GoTo POINTS, AF and Store var + gotoX(50505,handles); gotoY(25250,handles); handles.Avar = fullAF(handles,16000); + fprintf(s,'E'); + gotoX(126260,handles); handles.Bvar = fullAF(handles,16000); + fprintf(s,'R'); + gotoX(202020,handles); handles.Cvar = fullAF(handles,16000); + fprintf(s,'Y'); + + % Update handles structure + guidata(hObject,handles); + + % Take another value and find if it is > the smallest of the three. If yes, replace it + gotoX(166670,handles); gotoY(50505,handles); Xvar = fullAF(handles,16000); YourImage=getsnapshot(vid); + if( mean(YourImage(:)) < 230) + bestpoints(hObject,handles, Xvar); + end + gotoX(90910,handles); Xvar = fullAF(handles,16000); YourImage=getsnapshot(vid); + if( mean(YourImage(:)) < 230) + bestpoints(hObject,handles, Xvar); + end + gotoX(50505,handles); gotoY(75750,handles); Xvar =fullAF(handles,16000); YourImage=getsnapshot(vid); + if( mean(YourImage(:)) < 230) + bestpoints(hObject,handles, Xvar); + end + gotoX(126260,handles); Xvar =fullAF(handles,16000); YourImage=getsnapshot(vid); + if( mean(YourImage(:)) < 230) + bestpoints(hObject,handles, Xvar); + end + gotoX(202020,handles); Xvar =fullAF(handles,16000); YourImage=getsnapshot(vid); + if( mean(YourImage(:)) < 230) + bestpoints(hObject,handles, Xvar); + end +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +disp('The time for 8 pt AF is'); +toc + +% now asking Arduino to do WSI +fprintf(s,'F'); + +% logging co-ordinates +fprintf(fid, '\r\n Going to Origin and starting WSI '); + +% find num of FoV +numofX = 50000 / XFoVSize; numofY = 25000 / YFoVSize; + +% wait for the scan to begin +while fscanf(s) ~= 'S' + disp('waiting'); +end; + +% NOW TAKING PICTURES +rowcount = 0; +filecount = 0; + + msg = '\r\n Starting image capture ...'; + fprintf(fid, msg); + +while(rowcount <= numofY) + while(filecount <= numofX) + % take image and save + %pause(XImDelay+Xzadjustdelay+autoContrTime); + pause(XImDelay); + snapshot=getsnapshot(vid); + %enh_snapshot=autocontrast(snapshot); + filename = strcat(setslidename,'_',num2str(rowcount),'-',num2str(filecount), '.bmp'); + imwrite(snapshot,filename); + filecount = filecount + 1; + end + % wait for shift by one FoV in Y direction + filecount = 0; + pause(YImDelay); + rowcount = rowcount + 1; +end +set(handles.camwait,'string','Auto WSI completed.'); +msg = sprintf('\r\nImages captured : %d x %d', numofY,numofX); +fprintf(fid, msg); +toc + + + +function pushtoimage_Callback(hObject, eventdata, handles) +% hObject handle to pushtoimage (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +disp('unused func'); + +% --- Executes on button press in pushbutton11. +function pushbutton11_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton11 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; +xA = get(handles.currxpos,'string'); handles.xA = xA; +yA = get(handles.currypos,'string'); handles.yA = yA; +zA = get(handles.currzpos,'string'); handles.zA = zA; +data = strcat(xA,' , ',yA,' , ',zA); set(handles.xyzA,'string',data); +fprintf(s,'E'); +guidata(hObject, handles); + + +% --- Executes on button press in pushbutton12. +function pushbutton12_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton12 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; + +xB = get(handles.currxpos,'string'); handles.xB = xB; +yB = get(handles.currypos,'string'); handles.yB = yB; +zB = get(handles.currzpos,'string'); handles.zB = zB; + +data = strcat(xB,',',yB,',',zB); set(handles.xyzB,'string',data); + +% send command that sets pt B in Arduino +fprintf(s,'R'); guidata(hObject, handles); + +% --- Executes on button press in pushD. +function pushD_Callback(hObject, eventdata, handles) +% hObject handle to pushD (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; + +xD = get(handles.currxpos,'string'); handles.xD = xD; +yD = get(handles.currypos,'string'); handles.yD = yD; +zD = get(handles.currzpos,'string'); handles.zD = zD; + +data = strcat(xD,',',yD,',',zD); set(handles.xyzD,'string',data); + +% send command that sets pt D in Arduino +fprintf(s,'U'); guidata(hObject, handles); + +% --- Executes on button press in pushC. +function pushC_Callback(hObject, eventdata, handles) +% hObject handle to pushC (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; + +xC = get(handles.currxpos,'string'); handles.xC = xC; +yC = get(handles.currypos,'string'); handles.yC = yC; +zC = get(handles.currzpos,'string'); handles.zC = zC; + +data = strcat(xC,',',yC,',',zC); set(handles.xyzC,'string',data); + +% send command that sets pt C in Arduino +fprintf(s,'Y'); guidata(hObject, handles); + + +function editboxslidename_Callback(hObject, eventdata, handles) +% hObject handle to editboxslidename (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of editboxslidename as text +% str2double(get(hObject,'String')) returns contents of editboxslidename as a double + + +% --- Executes during object creation, after setting all properties. +function editboxslidename_CreateFcn(hObject, eventdata, handles) +% hObject handle to editboxslidename (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in pushbutton15. +function pushbutton15_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton15 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +newName = get(handles.editboxslidename,'string'); +handles.setslidename = newName; + +% Update handles structure +guidata(hObject, handles); + +% --- Executes on button press in pushbutton16. +function pushbutton16_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton16 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +vid = handles.vid; +% calc var +newimg = double(getsnapshot(vid)); newvar=var(newimg(:)); +%disp on the window +set(handles.var_disp,'string',newvar); + +% --- Executes on button press in pushbutton17. +function pushbutton17_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton17 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +vid = handles.vid; s = handles.s; +% Move Z up +fprintf(s,'T'); +% calc var +newimg = double(getsnapshot(vid)); newvar=var(newimg(:)); +%disp on the window +set(handles.var_disp,'string',newvar); + +% --- Executes on button press in pushbutton18. +function pushbutton18_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton18 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +vid = handles.vid; s = handles.s; +% Move Z down +fprintf(s,'G'); +% calc var +newimg = double(getsnapshot(vid)); newvar=var(newimg(:)); +%disp on the window +set(handles.var_disp,'string',newvar); + +% --- Executes on button press in pushbutton19. +function pushbutton19_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton19 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +vid=handles.vid; +snapshot=getsnapshot(vid); +enh_snapshot=autocontrast(snapshot); +imwrite(snapshot,strcat('DataSet_IISC_Cytocube/Slide1/Image_',handles.setSlidename,'.jpg')); +filename = strcat('DataSet_IISC_Cytocube/Slide1/Enhanced_Image_',handles.setSlidename,'.jpg'); +imwrite(enh_snapshot,filename); +disp('image saved') + +% --- Executes on button press in pushbutton20. +function pushbutton20_Callback(hObject, eventdata, handles) +% this is the debug code +% hObject handle to pushbutton20 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; src = handles.src; vid=handles.vid; tmr = handles.tmr; +stop(tmr); + +% scan across Z and build a variance graph +% needed for Rajesh's GYTI +% stackcount=50; vararray= zeros(1,stackcount); +% currzpos = str2double(get(handles.currzpos,'string')); +% startingZ = currzpos + (10 * stackcount); +% newZ = strcat('+',sprintf('%06d',abs(startingZ ))) +% fprintf(s,'M'); fprintf(s, newZ ); pause(2); +% +% imgcount=0; +% while(imgcount <= stackcount) +% newimg = double(getsnapshot(vid)); vari = var(newimg(:)) +% vararray(:) = vari; +% imgcount = imgcount + 1; +% fprintf(s,'T'); pause(0.1); +% end +% save('variancee.mat', 'vararray'); +% start(tmr); disp('graphing done'); +% return; + +setslidename = '100f_point13_'; +set(handles.camwait,'string','Focal stack acquisition ongoing...'); +% take a focal stack +currzpos = str2double(get(handles.currzpos,'string')); +originalZ = currzpos +stackcount=100; filecount=0; + +% go down to the starting point +startingZ = currzpos - (10 * (stackcount/2)) +startingZcopy = startingZ; +if(startingZ < 0) + startingZ = strcat('-',sprintf('%06d',abs(startingZ ))); + else + startingZ = strcat('+',sprintf('%06d',abs(startingZ ))); + end; +fprintf(s,'M'); fprintf(s, startingZ ); pause(1); + + +% now sweep up, taking pix. Reach to the max height . +while(filecount <= stackcount) + snapshot=getsnapshot(vid); + filename = strcat(setslidename,'_up_',num2str(filecount), '.jpg'); + imwrite(snapshot,filename); + filecount = filecount + 1; + + newZ = startingZcopy + (10*filecount) ; + if(newZ < 0) + newZ = strcat('-',sprintf('%06d',abs(newZ ))); + else + newZ = strcat('+',sprintf('%06d',abs(newZ ))); + end; + fprintf(s,'M'); fprintf(s, newZ ); pause(0.1); +end + +% % go back to original Z location +newZ = originalZ; +if(newZ < 0) + newZ = strcat('-',sprintf('%06d',abs(newZ ))); + else + newZ = strcat('+',sprintf('%06d',abs(newZ ))); + end; +fprintf(s,'M'); fprintf(s, newZ ); %pause(1); + +% display info +set(handles.camwait,'string','Focal stack acquisition completed'); +start(tmr); +return; + + + +% --- Executes on button press in pushbutton21. +function pushbutton21_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton21 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + s = handles.s; fprintf(s,'W'); + +% --- Executes on button press in pushbutton22. +function pushbutton22_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton22 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + s = handles.s; fprintf(s,'S'); + +% --- Executes on button press in pushbutton23. +function pushbutton23_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton23 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + s = handles.s; fprintf(s,'D'); + +% --- Executes on button press in pushbutton24. +function pushbutton24_Callback(hObject, eventdata, handles) +% hObject handle to pushbutton24 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + s = handles.s; fprintf(s,'A'); + +% --- Executes when user attempts to close figure1. +function figure1_CloseRequestFcn(hObject, eventdata, handles) +% hObject handle to figure1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +% Hint: delete(hObject) closes the figure +delete(hObject); + + +function [] = query_X(handles) +s = handles.s; fwrite(s,'I'); data = fgetl(s); + +if(data == 'X') + set(handles.currxpos,'string',fgetl(s)); +else + data = fgetl(s); disp(sprintf('not X data - %s',data)); +end + +function [] = query_Y(handles) +s = handles.s; fwrite(s,'O'); data = fgetl(s); + +if(data == 'Y') + set(handles.currypos,'string',fgetl(s)); +else + data = fgetl(s); disp(sprintf('not Y data - %s',data)); +end + +function [] = query_Z(handles) +s = handles.s; fwrite(s,'P'); data = fgetl(s); + +if(data == 'Z') + set(handles.currzpos,'string',fgetl(s)); +else + data = fgetl(s); disp(sprintf('not Y data - %s',data)); +end + + + +% AUTOCONTRAST Automatically adjusts contrast of images to optimum level. +% e.g. autocontrast('Sunset.jpg','Output.jpg') + +function output_img = autocontrast(input_img) + +low_limit=0.004; +up_limit=0.995; +img=input_img; +[m1 n1 r1]=size(img); +img=double(img); +%--------------------calculation of vmin and vmax---------------------- +for k=1:r1 + arr=sort(reshape(img(:,:,k),m1*n1,1)); + v_min(k)=arr(ceil(low_limit*m1*n1)); + v_max(k)=arr(ceil(up_limit*m1*n1)); +end +%---------------------------------------------------------------------- +if r1==3 + v_min=rgb2ntsc(v_min); + v_max=rgb2ntsc(v_max); +end +%---------------------------------------------------------------------- +img=(img-v_min(1))/(v_max(1)-v_min(1)); +output_img = uint8(img.*255); + + + +function gotoX(check,handles) +s=handles.s; + %%%%%%% check if Arduino is responsive and if not, wait %%%%%% + fprintf(s,'7'); while fscanf(s) ~= '7' + end + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +str = sprintf('%06d',abs(check)); % abs needed so that no +&- in neg numbers + % ensure that too big values dont go in + if (check < -750000) check = -750000; + elseif (check > 750000) check = 750000; + end; + + if(check < 0) + newstr = strcat('-',str); + else + newstr = strcat('+',str); + end; + % end formatting ---------- -------------------------------------------- + fprintf(s,'B'); fprintf(s, newstr ); + +function gotoY(check,handles) +s=handles.s; + %%%%%%% check if Arduino is responsive and if not, wait %%%%%% + fprintf(s,'7'); while fscanf(s) ~= '7' + end + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +str = sprintf('%06d',abs(check)); % abs needed so that no +&- in neg numbers + % ensure that too big values dont go in + if (check < -750000) check = -750000; + elseif (check > 750000) check = 750000; + end; + + if(check < 0) + newstr = strcat('-',str); + else + newstr = strcat('+',str); + end; + % end formatting ---------- -------------------------------------------- + fprintf(s,'N'); fprintf(s, newstr ); + +function gotoZ(check,handles) +s=handles.s; + %%%%%%% check if Arduino is responsive and if not, wait %%%%%% + fprintf(s,'7'); while fscanf(s) ~= '7' + end + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +str = sprintf('%06d',abs(check)); % abs needed so that no +&- in neg numbers + % ensure that too big values dont go in + if (check < -30000) check = -30000; + elseif (check > 30000) check = 30000; + end; + + if(check < 0) + newstr = strcat('-',str); + else + newstr = strcat('+',str); + end; + % end formatting ---------- -------------------------------------------- + fprintf(s,'M'); fprintf(s, newstr ); pause(0.035); + + +function [currmaxvar] = fullAF(handles,travel) +tmr=handles.tmr; + toTurnOnOrNot=1; + if strcmp(get(tmr,'Running'),'off') + toTurnOnOrNot=0; + else + stop(tmr); + end + +%tic +set(handles.camwait,'string','Autofocus in progress...'); +vid=handles.vid; fid=handles.fid; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% CRUDE AF. +Z_travel_for_crude = travel; crude_step_count = 200; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +crude_pulse_count = Z_travel_for_crude / crude_step_count; +crude_curr_var=0; crude_max_var=0; crude_loc_max_var=0; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% go to starting Z loc (we've hit limit switch via arduino already so its z=0) +crude_start_loc = str2double(get(handles.currzpos,'string')) - (Z_travel_for_crude/2); +gotoZ(crude_start_loc,handles); pause(0.2); +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% now keep going up and taking var +crude_curr_loc = crude_start_loc; + +for i=1: crude_pulse_count + % variance + crude_img = double(getsnapshot(vid)); crude_curr_var=var(crude_img(:)); + + if (crude_curr_var > crude_max_var) + crude_max_var = crude_curr_var; + crude_loc_max_var = crude_curr_loc; + end + % update loc + crude_curr_loc = crude_curr_loc + crude_step_count ; + gotoZ(crude_curr_loc,handles); +end +gotoZ(crude_loc_max_var,handles); +pause(1); +%snapshot=getsnapshot(vid); imwrite(snapshot,'aftercrude.bmp'); +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% fINECRUDE AF. +Z_travel_for_crude = 2000; crude_step_count = 50; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +crude_pulse_count = Z_travel_for_crude / crude_step_count; +crude_curr_var=0; crude_max_var=0; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% go to starting Z loc (we've hit limit switch via arduino already so its z=0) +crude_start_loc = crude_loc_max_var - (Z_travel_for_crude/2); +gotoZ(crude_start_loc,handles); pause(0.2); +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% now keep going up and taking var +crude_curr_loc = crude_start_loc; + +for i=1: crude_pulse_count + % variance + crude_img = double(getsnapshot(vid)); crude_curr_var=var(crude_img(:)); + + if (crude_curr_var > crude_max_var) + crude_max_var = crude_curr_var; + crude_loc_max_var = crude_curr_loc; + end + % update loc + crude_curr_loc = crude_curr_loc + crude_step_count ; + gotoZ(crude_curr_loc,handles); +end +gotoZ(crude_loc_max_var,handles); +pause(1); +%snapshot=getsnapshot(vid); imwrite(snapshot,'afterfinecrude.bmp'); +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The fine AF begins here +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +Ztotaltravel = 200; final_go_backpulses = 0 ; +currZ = crude_loc_max_var; + +% first go above +start_above_loc = currZ - (Ztotaltravel/2); +gotoZ(start_above_loc,handles); +pause(1); +% now build the var array +localAF_loc_array = zeros(1,Ztotaltravel); localAF_var_array = zeros(1,Ztotaltravel); +localAF_curr_loc = start_above_loc; +for q=1:(Ztotaltravel/5) + % location + localAF_loc_array(q) = localAF_curr_loc; + % variance + localAF_img = double(getsnapshot(vid)); localAF_var_array(q)=var(localAF_img(:)); + + % move and update loc + localAF_curr_loc = localAF_curr_loc + 5; gotoZ(localAF_curr_loc,handles); +end + +% Finally go to the max var location +index_of_max_var = find(localAF_var_array == max(localAF_var_array)); +loc_of_max_var = localAF_loc_array(index_of_max_var) - final_go_backpulses ; + +gotoZ(loc_of_max_var,handles); +fprintf(fid,'\r\nCrude/Fine AF (var): %d / %d (%d)',crude_loc_max_var,loc_of_max_var,max(localAF_var_array)); +currmaxvar = max(localAF_var_array) ; +% toc % loc_of_max_var +set(handles.camwait,'string','AF done.'); + +if toTurnOnOrNot ==1 + start(tmr); +end +pause(1); + + + +% --- Executes on button press in resetbutton. +function resetbutton_Callback(hObject, eventdata, handles) +% hObject handle to resetbutton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s = handles.s; tmr=handles.tmr; resetbutton=handles.resetbutton; +set(resetbutton,'enable','off'); +set(handles.camwait,'string','System resetting...'); +stop(tmr); +fclose(s); fopen(s); +pause(2); +fprintf(s,'Q'); +while fscanf(s) ~= 'S' + end; +start(tmr); +set(handles.camwait,'string','system at home location.'); +set(resetbutton,'enable','on'); +return; + + +% --- Executes during object deletion, before destroying properties. +function figure1_DeleteFcn(hObject, eventdata, handles) +% hObject handle to figure1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +if ~isempty(instrfind) + fclose(instrfind); + delete(instrfind); +end + +try + stop(tmr); + fid=handles.fid; fclose(fid); + vid = handles.vid; stoppreview(vid); delete(vid); +catch + clear all; + clc; +end + +%s=handles.s; fclose(s); delete(s); +disp('Killed all before exiting'); + + +% --- Executes during object creation, after setting all properties. +function figure1_CreateFcn(hObject, eventdata, handles) +% hObject handle to figure1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + + +function [] = bestpoints(hObject,handles,Xvar) +handles = guidata(hObject); +s=handles.s; +Avar = handles.Avar; Bvar = handles.Bvar; Cvar = handles.Cvar; + if ((Cvar < Bvar) && (Cvar < Avar)) + if ( Xvar > Cvar) + fprintf(s,'Y'); + handles.Cvar = Xvar; + disp('changed C'); + end + end + if ((Avar < Bvar) && (Avar < Cvar)) + if ( Xvar > Avar) + fprintf(s,'E'); + handles.Avar = Xvar; + disp('changed A'); + end + end + if ((Bvar < Avar) && (Bvar < Cvar)) + if ( Xvar > Bvar) + fprintf(s,'R'); + handles.Bvar = Xvar; + handles.Bvar + disp('changed B'); + end + end + + %update handles + guidata(hObject, handles); diff --git a/src/python/0.jpg b/src/python/0.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d1de1d897ba2c5646447083addbaf7d9fabc5a82 GIT binary patch literal 7125 zcmb7JcQhPM*IrRp?~7npSt+7~=+UCCC=tE)1WO3f`wtPKljyNJtF2&_5G{HqTCBRd zC3=na$@`x3e&_w`JKvr8XU^Pt&Ye4VW}dlo^Xq02K&`6$Tp56ehX7?~L8 znP}-j^nXF{@NdTu5RwoQlF(C-QPBUt<)#%tLk#Ev^x)%h0`Ab@;nU#VbO68rJix7K zx90vwh=7E|cmyQ)cW%37sR4NS_;`c_L?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7M3nz{q0GYc?kCmh9H{o%CLx1A4v`YkW zSwV9$N|t)_cSFm$l(!@inS=MaGptJugeyBygeV{Z#LA^Gr4*n4Sw93?4EDXv=_124 zc*ozRu0?n4j~t(Rmy!#KYNddT(t+}B*g+e9cSz#=f#7jDYxAC=jH+$}=%j1hR%LJ6 z_e?@nL3Gz+mR>|j<}~1oJ_XF9@Uv|}Hj&hm25NOpDg1E#Ea*AtUgCp}gDG@PdyYjI z7iErOLXPpi6s?Z>S%FPnQY@bvtAN}d&mPLmEEj$ZmE7ouZ(#(cUE7x17KW9y=lDRL z4tbhJ_&M?KhHt5q4|OupCM|En-<8b$_xq41ubQD1=Q&ztB=SZxPIcy$&dCP4)`lOa*T1V@5NFiB_zndYtP$AQTNARA?#aH3O;RPAwB`o9!rflD@{LdKL zQxZ(?&VbQ(?xvIYG%+MKyX2kdortVI8F`WrTUg++B0(!Vb@;nvwARt~Re3^K#h_+&m|^d~9lS1AwpYacGS4(f^cx%Tksxs0n&Dmy}&%-SSE-{apaF zu|w@qdldLUN>(HkHJx-~%T!d|;CU_)d(K)OYHFog%~)*50wTLlsCv!FHk9K?a6#ET zv_1B6m_%lvv#~`ARj%B2{F!{-srhaTxd-q3IW5CD_8lT7w~U!e;UHD=HPWo3u_rF9 z=vb0vqRKaM6BE9SbffAC=SK%1j$=%k3&*&iHvmpU46xhBS(%Qc-?OkLv|;ipPzUzL z1AlOSolP^W2-NgNWDY8p=3G>QO=K^%g7#DXXf^c&mhoUcq-{STiz6=hcV?v*cU{i- z*3=0~MQiH=*U;x|pF>aBs9YP(_t#_?5hCEou crude_max_var: + crude_max_var = crude_curr_var + crude_loc_max_var = crude_curr_loc + crude_curr_loc = crude_curr_loc + crude_step_count + self.gotoZ(crude_curr_loc) + time.sleep(0.175) + self.gotoZ(crude_loc_max_var) + # Fine-crude AF + Z_travel_for_crude = 1000; crude_step_count = 50; + crude_loc_max_var = 0; crude_max_var = 0 + crude_pulse_count = Z_travel_for_crude / crude_step_count; + crude_start_loc = self.currzpos - (Z_travel_for_crude/2); + self.gotoZ(crude_start_loc); + crude_curr_loc = crude_start_loc; + for i in range(int(crude_pulse_count)): + snapshot = self.data + crude_curr_var = np.var(cv2.filter2D(snapshot,-1,kernel)) + print(crude_curr_var,'||',self.currzpos) + if crude_curr_var > crude_max_var: + crude_max_var = crude_curr_var + crude_loc_max_var = crude_curr_loc + crude_curr_loc = crude_curr_loc + crude_step_count + self.gotoZ(crude_curr_loc) + time.sleep(0.075) + self.gotoZ(crude_loc_max_var) + # Fine AF + Z_travel_for_crude = 120; crude_step_count = 5; + crude_loc_max_var = 0;crude_max_var = 0 + crude_pulse_count = Z_travel_for_crude / crude_step_count; + crude_start_loc = self.currzpos - (Z_travel_for_crude/2); + self.gotoZ(crude_start_loc); + crude_curr_loc = crude_start_loc; + for i in range(int(crude_pulse_count)): + snapshot = self.data + crude_curr_var = np.var(snapshot) + print(crude_curr_var,'||',self.currzpos) + if crude_curr_var > crude_max_var: + crude_max_var = crude_curr_var + crude_loc_max_var = crude_curr_loc + crude_curr_loc = crude_curr_loc + crude_step_count + self.gotoZ(crude_curr_loc) + time.sleep(0.025) + self.gotoZ(crude_loc_max_var) + ts_stop = time.time() + print('time taken for autofocusing:'+str(ts_stop-ts_start)+' secs') + + def parameter(self): + image = self.data + img = cv2.medianBlur(image,5) + cimg = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) + circles = cv2.HoughCircles(cimg,cv2.HOUGH_GRADIENT,1,35,param1=50,param2=30,minRadius=10,maxRadius=45) + area = 0 + try: + circles = np.uint16(np.around(circles));#print('No.of Circles:',len(circles[0,:])) + for i in circles[0,:]: + # Total area + area = area + (3.1415 * i[2] * i[2]) + except: + print("No circles detected") + ret,im_th = cv2.threshold(cimg,np.average(cimg),255,cv2.THRESH_BINARY_INV) + foreground_area = np.count_nonzero(im_th) + param = area/foreground_area + if(param == 0): + return (foreground_area/(1280*1024)) + return param + + def focus(self,travel,step_count): + ts_start = time.time() + # FineCrude + Z_travel_for_crude = travel; crude_step_count = step_count; + crude_loc_max_var = 0; crude_max_var = 0 + crude_pulse_count = Z_travel_for_crude / crude_step_count; + crude_start_loc = self.currzpos - (Z_travel_for_crude/2); + self.gotoZ(crude_start_loc); + crude_curr_loc = crude_start_loc; + kernel = np.ones((5,5),np.float32)/9 + for i in range(int(crude_pulse_count)): + snapshot = self.data + crude_curr_var = np.var(cv2.filter2D(snapshot,-1,kernel)) + #print(crude_curr_var,'||',self.currzpos) + if crude_curr_var > crude_max_var: + crude_max_var = crude_curr_var + crude_loc_max_var = crude_curr_loc + crude_curr_loc = crude_curr_loc + crude_step_count + self.gotoZ(crude_curr_loc) + time.sleep(0.075) + self.gotoZ(crude_loc_max_var) + # Fine AF + Z_travel_for_crude = step_count*2; crude_step_count = 3; + crude_loc_max_var = 0;crude_max_var = 0 + crude_pulse_count = Z_travel_for_crude / crude_step_count; + crude_start_loc = self.currzpos - (Z_travel_for_crude/2); + self.gotoZ(crude_start_loc); + crude_curr_loc = crude_start_loc; + for i in range(int(crude_pulse_count)): + snapshot = self.data + crude_curr_var = np.var(snapshot) + #print(crude_curr_var,'||',self.currzpos) + if crude_curr_var > crude_max_var: + crude_max_var = crude_curr_var + crude_loc_max_var = crude_curr_loc + crude_curr_loc = crude_curr_loc + crude_step_count + self.gotoZ(crude_curr_loc) + time.sleep(0.025) + self.gotoZ(crude_loc_max_var) + ts_stop = time.time() + print('time taken for autofocusing:'+str(ts_stop-ts_start)+' secs') + + #def focalstack(self,travel): + + + + def xMinus(self): + self.ser.write(b'D') + self.currxpos = self.currxpos - self.xFov + self.label_13.setText(self._translate("MainWindow", str(self.currxpos))) + def xPlus(self): + self.ser.write(b'A') + self.currxpos = self.currxpos + self.xFov + self.label_13.setText(self._translate("MainWindow", str(self.currxpos))) + def yMinus(self): + self.ser.write(b'S') + self.currypos = self.currypos - self.yFov + self.label_14.setText(self._translate("MainWindow", str(self.currypos))) + def yPlus(self): + self.ser.write(b'W') + self.currypos = self.currypos + self.yFov + self.label_14.setText(self._translate("MainWindow", str(self.currypos))) + def zDown(self): + self.ser.write(b'G') + self.currzpos = self.currzpos - 1 + self.label_15.setText(self._translate("MainWindow", str(self.currzpos))) + def zUp(self): + self.ser.write(b'T') + self.currzpos = self.currzpos + 1 + self.label_15.setText(self._translate("MainWindow", str(self.currzpos))) + def gotoX(self, xValue): + xValue = int(xValue) + if self.currxpos != xValue: + xValue_str = '#' + str("%($)07d" % {"$":xValue}) + self.ser.write(b'B') + self.ser.write(xValue_str.encode()) + time.sleep(abs(self.currxpos-xValue)/self.Xpulserate) + self.currxpos = int(xValue) + self.label_13.setText(self._translate("MainWindow", str(self.currxpos))) + def gotoY(self, yValue): + yValue = int(yValue) + if self.currypos != yValue: + yValue_str = '#' + str("%($)07d" % {"$":yValue}) + self.ser.write(b'N') + self.ser.write(yValue_str.encode()) + time.sleep(abs(self.currypos-yValue)/self.Ypulserate) + self.currypos = int(yValue) + self.label_14.setText(self._translate("MainWindow", str(self.currypos))) + def gotoZ(self, zValue): + zValue = int(zValue) + if self.currzpos != zValue: + zValue_str = '#' + str("%($)07d" % {"$":zValue}) + self.ser.write(b'M') + self.ser.write(zValue_str.encode()) + time.sleep(abs(self.currzpos-zValue)/self.Zpulserate) + self.currzpos = int(zValue) + self.label_15.setText(self._translate("MainWindow", str(self.currzpos))) + + def bloodsmear(self): + self.gotoX('0') + self.gotoY('0') + self.gotoZ('0') + self.gotoY(self.ymiddle);time.sleep(2); + self.autoFocus() + Zval = []; param_y0 = []; Xpos = []; + xstep = round((self.x1-self.x0)/11); + for xpos in range(self.x0,self.x1,xstep): + self.gotoX(xpos) + self.focus(2000,50) + Zval.append(self.currzpos) + Xpos.append(self.currxpos) + snap = self.data + snapshot = PIL.Image.fromarray(snap,'RGB') + snapshot.save('snap@'+str(xpos)+'.jpg') + param_y0.append(self.parameter()) + print(np.asarray(param_y0)) + index = np.argmax((param_y0)) + xbest = Xpos[index] + self.gotoX(Xpos[index]) + self.gotoZ(Zval[index]);time.sleep(2); + param_y1 = [];Xpos = []; Zval = []; + if(xbest<=xstep): + for xpos in range(xbest,xbest+xstep*2,12581): + self.gotoX(xpos) + self.focus(500,50) + Zval.append(self.currzpos) + Xpos.append(self.currxpos) + snap = self.data + snapshot = PIL.Image.fromarray(snap,'RGB') + snapshot.save('snap@'+str(xpos)+'.jpg') + param_y1.append(self.parameter()) + elif(xbest>self.x1): + for xpos in range(xbest-xstep*2,xbest,12581): + self.gotoX(xpos) + self.focus(500,50) + Zval.append(self.currzpos) + Xpos.append(self.currxpos) + snap = self.data + snapshot = PIL.Image.fromarray(snap,'RGB') + snapshot.save('snap@'+str(xpos)+'.jpg') + param_y1.append(self.parameter()) + else: + for xpos in range(xbest-xstep,xbest+xstep,12581): + self.gotoX(xpos) + self.focus(500,50) + Zval.append(self.currzpos) + Xpos.append(self.currxpos) + snap = self.data + snapshot = PIL.Image.fromarray(snap,'RGB') + snapshot.save('snap@'+str(xpos)+'.jpg') + param_y1.append(self.parameter()) + index = np.argmax(np.asarray(param_y1)) + param = np.where(np.asarray(param_y1),1,0) + self.gotoY(0) + if(np.sum(param[1:4]) == 3): + x1 = Xpos[1]; + x2 = Xpos[3]; + self.gotoX(x1);self.focus(500,50);self.ser.write(b'R') + self.gotoX(x2);self.focus(500,50);self.ser.write(b'E') + self.gotoY(self.y1);self.focus(500,50);self.ser.write(b'Y') + xA = x1; xB = x2; + yC = self.y1; yB = 0; + numofX = round((xB-xA)/self.xFov); + numofY = round((yC-yB)/self.yFov); + self.ser.write(b'Z') + while(self.ser.read() != 'S'): + print('.') + + rowcount = 0; + filecount = 0; + print('Starting Image Capture...') + while(rowcount <= numofY): + while(filecount <= numofX): + snap = PIL.Image.fromarray(self.data,'RGB') + snapshot.save('Image_'+str(rowcount)+'_'+str(filecount)+'.jpg') + filecount = filecount + 1 + filecount = 0 + rowcount = rowcount + 1 + elif(np.sum(param[0:3] > np.sum(param[2:5]))): + x1 = Xpos[0]; + x2 = Xpos[2]; + self.gotoX(x1);self.focus(500,50);self.ser.write(b'R') + self.gotoX(x2);self.focus(500,50);self.ser.write(b'E') + self.gotoY(self.y1);self.focus(500,50);self.ser.write(b'Y') + xA = x1; xB = x2; + yC = self.y1; yB = 0; + numofX = round((xB-xA)/self.xFov); + numofY = round((yC-yB)/self.yFov); + self.ser.write(b'Z') + while(self.ser.read() != 'S'): + print('.') + rowcount = 0; + filecount = 0; + print('Starting Image Capture...') + while(rowcount <= numofY): + while(filecount <= numofX): + snap = PIL.Image.fromarray(self.data,'RGB') + snapshot.save('Image_'+str(rowcount)+'_'+str(filecount)+'.jpg') + filecount = filecount + 1 + filecount = 0 + rowcount = rowcount + 1 + elif(np.sum(param[0:3] < np.sum(param[2:5]))): + x1 = Xpos[2]; + x2 = Xpos[4]; + self.gotoX(x1);self.focus(500,50);self.ser.write(b'R') + self.gotoX(x2);self.focus(500,50);self.ser.write(b'E') + self.gotoY(self.y1);self.focus(500,50);self.ser.write(b'Y') + xA = x1; xB = x2; + yC = self.y1; yB = 0; + numofX = round((xB-xA)/self.xFov); + numofY = round((yC-yB)/self.yFov); + self.ser.write(b'Z') + while(self.ser.read() != 'S'): + print('.') + + rowcount = 0; + filecount = 0; + print('Starting Image Capture...') + while(rowcount <= numofY): + while(filecount <= numofX): + snap = PIL.Image.fromarray(self.data,'RGB') + snapshot.save('Image_'+str(rowcount)+'_'+str(filecount)+'.jpg') + filecount = filecount + 1 + filecount = 0 + rowcount = rowcount + 1 + else: + print('No Best region detected!') + self.resetOrigin() + + def test(self): + #var = round(np.var(self.data)) + #self.label_8.setText(self._translate("MainWindow", str(var))) + self.focus(500,50) + + +if __name__ == '__main__' : + app = QtWidgets.QApplication(sys.argv) + x = gui() + x.main() + sys.exit(app.exec_()) diff --git a/src/python/slide_scanner_test.py b/src/python/slide_scanner_test.py new file mode 100644 index 0000000..d7d4f29 --- /dev/null +++ b/src/python/slide_scanner_test.py @@ -0,0 +1,419 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'slide_scanner_test.ui' +# +# Created by: PyQt5 UI code generator 5.6 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.setWindowModality(QtCore.Qt.WindowModal) + MainWindow.resize(1024, 768) + font = QtGui.QFont() + font.setPointSize(8) + MainWindow.setFont(font) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("F:/IITT_Logo/0.jpg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + MainWindow.setWindowIcon(icon) + MainWindow.setAutoFillBackground(False) + MainWindow.setStyleSheet("background-color: rgb(90, 90, 90);") + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.logoView = QtWidgets.QLabel(self.centralwidget) + self.logoView.setGeometry(QtCore.QRect(20, 20, 50, 50)) + self.logoView.setObjectName("logoView") + self.label = QtWidgets.QLabel(self.centralwidget) + self.label.setGeometry(QtCore.QRect(80, 20, 461, 51)) + font = QtGui.QFont() + font.setPointSize(24) + self.label.setFont(font) + self.label.setStyleSheet("color: rgb(255, 255, 255);") + self.label.setObjectName("label") + self.slideImageView = QtWidgets.QLabel(self.centralwidget) + self.slideImageView.setGeometry(QtCore.QRect(20, 180, 640, 512)) + self.slideImageView.setBaseSize(QtCore.QSize(640, 512)) + self.slideImageView.setStyleSheet("background-color: rgb(85, 255, 127);") + self.slideImageView.setObjectName("slideImageView") + self.label_2 = QtWidgets.QLabel(self.centralwidget) + self.label_2.setGeometry(QtCore.QRect(220, 150, 221, 31)) + font = QtGui.QFont() + font.setPointSize(18) + self.label_2.setFont(font) + self.label_2.setStyleSheet("color: rgb(255, 255, 255);") + self.label_2.setObjectName("label_2") + self.pushButton = QtWidgets.QPushButton(self.centralwidget) + self.pushButton.setEnabled(True) + self.pushButton.setGeometry(QtCore.QRect(680, 520, 141, 27)) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth()) + self.pushButton.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton.setFont(font) + self.pushButton.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;\n" +"") + self.pushButton.setCheckable(False) + self.pushButton.setAutoDefault(False) + self.pushButton.setObjectName("pushButton") + self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_2.setGeometry(QtCore.QRect(870, 520, 141, 27)) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth()) + self.pushButton_2.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_2.setFont(font) + self.pushButton_2.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_2.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_2.setObjectName("pushButton_2") + self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_3.setGeometry(QtCore.QRect(734, 300, 51, 23)) + self.pushButton_3.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_3.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_3.setObjectName("pushButton_3") + self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_4.setGeometry(QtCore.QRect(680, 330, 51, 23)) + self.pushButton_4.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_4.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_4.setCheckable(False) + self.pushButton_4.setAutoDefault(True) + self.pushButton_4.setObjectName("pushButton_4") + self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_5.setGeometry(QtCore.QRect(790, 330, 51, 23)) + self.pushButton_5.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_5.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_5.setObjectName("pushButton_5") + self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_6.setGeometry(QtCore.QRect(734, 360, 51, 23)) + self.pushButton_6.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_6.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_6.setObjectName("pushButton_6") + self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_7.setGeometry(QtCore.QRect(880, 300, 75, 23)) + self.pushButton_7.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_7.setAutoFillBackground(False) + self.pushButton_7.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_7.setObjectName("pushButton_7") + self.pushButton_8 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_8.setGeometry(QtCore.QRect(880, 360, 75, 23)) + self.pushButton_8.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_8.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_8.setObjectName("pushButton_8") + self.label_3 = QtWidgets.QLabel(self.centralwidget) + self.label_3.setGeometry(QtCore.QRect(680, 260, 181, 21)) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) + self.label_3.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(12) + self.label_3.setFont(font) + self.label_3.setStyleSheet("color: rgb(255, 255, 255);") + self.label_3.setObjectName("label_3") + self.lineEdit = QtWidgets.QLineEdit(self.centralwidget) + self.lineEdit.setGeometry(QtCore.QRect(770, 420, 113, 20)) + self.lineEdit.setObjectName("lineEdit") + self.label_4 = QtWidgets.QLabel(self.centralwidget) + self.label_4.setGeometry(QtCore.QRect(690, 420, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_4.setFont(font) + self.label_4.setStyleSheet("color: rgb(255, 255, 255);") + self.label_4.setObjectName("label_4") + self.label_5 = QtWidgets.QLabel(self.centralwidget) + self.label_5.setGeometry(QtCore.QRect(690, 480, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_5.setFont(font) + self.label_5.setStyleSheet("color: rgb(255, 255, 255);") + self.label_5.setObjectName("label_5") + self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget) + self.lineEdit_2.setGeometry(QtCore.QRect(770, 480, 113, 20)) + self.lineEdit_2.setObjectName("lineEdit_2") + self.label_6 = QtWidgets.QLabel(self.centralwidget) + self.label_6.setGeometry(QtCore.QRect(690, 450, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_6.setFont(font) + self.label_6.setStyleSheet("color: rgb(255, 255, 255);") + self.label_6.setObjectName("label_6") + self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget) + self.lineEdit_3.setGeometry(QtCore.QRect(770, 450, 113, 20)) + self.lineEdit_3.setObjectName("lineEdit_3") + self.pushButton_9 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_9.setGeometry(QtCore.QRect(890, 420, 75, 23)) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_9.setFont(font) + self.pushButton_9.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_9.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_9.setObjectName("pushButton_9") + self.pushButton_10 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_10.setGeometry(QtCore.QRect(890, 450, 75, 23)) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_10.setFont(font) + self.pushButton_10.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_10.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_10.setObjectName("pushButton_10") + self.pushButton_11 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_11.setGeometry(QtCore.QRect(890, 480, 75, 23)) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_11.setFont(font) + self.pushButton_11.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_11.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_11.setObjectName("pushButton_11") + self.pushButton_12 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_12.setGeometry(QtCore.QRect(940, 220, 75, 23)) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_12.setFont(font) + self.pushButton_12.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_12.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_12.setObjectName("pushButton_12") + self.label_7 = QtWidgets.QLabel(self.centralwidget) + self.label_7.setGeometry(QtCore.QRect(680, 220, 131, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_7.setFont(font) + self.label_7.setStyleSheet("color: rgb(255, 255, 255);") + self.label_7.setAlignment(QtCore.Qt.AlignCenter) + self.label_7.setObjectName("label_7") + self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget) + self.lineEdit_4.setGeometry(QtCore.QRect(820, 220, 113, 20)) + self.lineEdit_4.setObjectName("lineEdit_4") + self.pushButton_13 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_13.setEnabled(True) + self.pushButton_13.setGeometry(QtCore.QRect(680, 560, 141, 27)) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.pushButton_13.sizePolicy().hasHeightForWidth()) + self.pushButton_13.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_13.setFont(font) + self.pushButton_13.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_13.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;\n" +"") + self.pushButton_13.setCheckable(False) + self.pushButton_13.setAutoDefault(False) + self.pushButton_13.setObjectName("pushButton_13") + self.label_8 = QtWidgets.QLabel(self.centralwidget) + self.label_8.setGeometry(QtCore.QRect(680, 180, 131, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_8.setFont(font) + self.label_8.setStyleSheet("color: rgb(255, 255, 255);") + self.label_8.setAlignment(QtCore.Qt.AlignCenter) + self.label_8.setObjectName("label_8") + self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget) + self.lineEdit_5.setGeometry(QtCore.QRect(820, 180, 113, 20)) + self.lineEdit_5.setObjectName("lineEdit_5") + self.pushButton_14 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_14.setGeometry(QtCore.QRect(940, 180, 75, 23)) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_14.setFont(font) + self.pushButton_14.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_14.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_14.setObjectName("pushButton_14") + self.label_9 = QtWidgets.QLabel(self.centralwidget) + self.label_9.setGeometry(QtCore.QRect(840, 0, 131, 16)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_9.setFont(font) + self.label_9.setStyleSheet("color: rgb(255, 255, 255);") + self.label_9.setObjectName("label_9") + self.label_10 = QtWidgets.QLabel(self.centralwidget) + self.label_10.setGeometry(QtCore.QRect(840, 30, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_10.setFont(font) + self.label_10.setStyleSheet("color: rgb(255, 255, 255);") + self.label_10.setObjectName("label_10") + self.label_11 = QtWidgets.QLabel(self.centralwidget) + self.label_11.setGeometry(QtCore.QRect(840, 60, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_11.setFont(font) + self.label_11.setStyleSheet("color: rgb(255, 255, 255);") + self.label_11.setObjectName("label_11") + self.label_12 = QtWidgets.QLabel(self.centralwidget) + self.label_12.setGeometry(QtCore.QRect(840, 90, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_12.setFont(font) + self.label_12.setStyleSheet("color: rgb(255, 255, 255);") + self.label_12.setObjectName("label_12") + self.label_13 = QtWidgets.QLabel(self.centralwidget) + self.label_13.setGeometry(QtCore.QRect(930, 30, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_13.setFont(font) + self.label_13.setStyleSheet("color: rgb(255, 255, 255);") + self.label_13.setObjectName("label_13") + self.label_14 = QtWidgets.QLabel(self.centralwidget) + self.label_14.setGeometry(QtCore.QRect(930, 60, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_14.setFont(font) + self.label_14.setStyleSheet("color: rgb(255, 255, 255);") + self.label_14.setObjectName("label_14") + self.label_15 = QtWidgets.QLabel(self.centralwidget) + self.label_15.setGeometry(QtCore.QRect(930, 90, 81, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_15.setFont(font) + self.label_15.setStyleSheet("color: rgb(255, 255, 255);") + self.label_15.setObjectName("label_15") + self.pushButton_15 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_15.setGeometry(QtCore.QRect(630, 30, 51, 23)) + self.pushButton_15.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_15.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_15.setObjectName("pushButton_15") + self.pushButton_16 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_16.setGeometry(QtCore.QRect(700, 30, 51, 23)) + self.pushButton_16.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_16.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_16.setObjectName("pushButton_16") + self.label_16 = QtWidgets.QLabel(self.centralwidget) + self.label_16.setGeometry(QtCore.QRect(630, 0, 131, 21)) + font = QtGui.QFont() + font.setPointSize(12) + self.label_16.setFont(font) + self.label_16.setStyleSheet("color: rgb(255, 255, 255);") + self.label_16.setAlignment(QtCore.Qt.AlignCenter) + self.label_16.setObjectName("label_16") + self.pushButton_17 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_17.setEnabled(True) + self.pushButton_17.setGeometry(QtCore.QRect(870, 560, 141, 27)) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.pushButton_17.sizePolicy().hasHeightForWidth()) + self.pushButton_17.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_17.setFont(font) + self.pushButton_17.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_17.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;\n" +"") + self.pushButton_17.setCheckable(False) + self.pushButton_17.setAutoDefault(False) + self.pushButton_17.setObjectName("pushButton_17") + self.pushButton_18 = QtWidgets.QPushButton(self.centralwidget) + self.pushButton_18.setGeometry(QtCore.QRect(830, 120, 191, 23)) + font = QtGui.QFont() + font.setPointSize(12) + self.pushButton_18.setFont(font) + self.pushButton_18.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.pushButton_18.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 0, 0);\n" +"border-radius:10px;") + self.pushButton_18.setObjectName("pushButton_18") + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1024, 21)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "Slide Scanner - ShanMukha Innovations Pvt Ltd")) + self.label.setText(_translate("MainWindow", "ShanMukha Innovations Pvt Ltd")) + self.label_2.setText(_translate("MainWindow", "Live Preview of Silde")) + self.pushButton.setText(_translate("MainWindow", "Take a Snapshot")) + self.pushButton_2.setText(_translate("MainWindow", "Auto-Focus")) + self.pushButton_3.setText(_translate("MainWindow", "X+")) + self.pushButton_4.setText(_translate("MainWindow", "Y-")) + self.pushButton_5.setText(_translate("MainWindow", "Y+")) + self.pushButton_6.setText(_translate("MainWindow", "X-")) + self.pushButton_7.setText(_translate("MainWindow", "Z - UP")) + self.pushButton_8.setText(_translate("MainWindow", "Z - DOWN")) + self.label_3.setText(_translate("MainWindow", "Slide Movement Controls")) + self.label_4.setText(_translate("MainWindow", "X position")) + self.label_5.setText(_translate("MainWindow", "Z position")) + self.label_6.setText(_translate("MainWindow", "Y position")) + self.pushButton_9.setText(_translate("MainWindow", "Go to X")) + self.pushButton_10.setText(_translate("MainWindow", "Go to Y")) + self.pushButton_11.setText(_translate("MainWindow", "Go to Z")) + self.pushButton_12.setText(_translate("MainWindow", "Set")) + self.label_7.setText(_translate("MainWindow", "Exposure (in ms)")) + self.pushButton_13.setText(_translate("MainWindow", "WSI Scan")) + self.label_8.setText(_translate("MainWindow", "Slide Name")) + self.pushButton_14.setText(_translate("MainWindow", "Set")) + self.label_9.setText(_translate("MainWindow", "Current Positions")) + self.label_10.setText(_translate("MainWindow", "X position")) + self.label_11.setText(_translate("MainWindow", "Y position")) + self.label_12.setText(_translate("MainWindow", "Z position")) + self.label_13.setText(_translate("MainWindow", "0")) + self.label_14.setText(_translate("MainWindow", "0")) + self.label_15.setText(_translate("MainWindow", "0")) + self.pushButton_15.setText(_translate("MainWindow", "40X")) + self.pushButton_16.setText(_translate("MainWindow", "20X")) + self.label_16.setText(_translate("MainWindow", "Magnification")) + self.pushButton_17.setText(_translate("MainWindow", "Best Region Scanning")) + self.pushButton_18.setText(_translate("MainWindow", "Set as Origin")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + MainWindow = QtWidgets.QMainWindow() + ui = Ui_MainWindow() + ui.setupUi(MainWindow) + MainWindow.show() + sys.exit(app.exec_()) + diff --git a/src/python/slide_scanner_test.pyc b/src/python/slide_scanner_test.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60844057f70d85d8c57e887b34c07d57ae0523b8 GIT binary patch literal 11967 zcmcIqNpsuC6>e(rB3rh`i@e+LI`r7GwR#_qCE2oMYoS1S(|Cph5fIfhMJNC$OH-bz zRC%sB=1T`c+)1l-?DY5sO%Jr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=5=aT z9~t#J7U%OkX{kv+HK`{zuI15GZ~Jf87Hv9nazU)Q>}`To3FTmKekDe zJ(B6~`5YhH*ks z991n&Dhe%Erxb;jlGBPpOX3+tfkRSB97Z$6*=CA!iUMb<5?ALH1rARoiVKS3q^h{6 zC{C%0ON!!jq_FA1oEG0%UXXlRLG$#CYUIN;#OO2fD^_);_GZO0rm9tU-3p{z^^M$m zU`z+LPm6r(7PMWMmg|m@^PF`&eH-qwk(U+Q@o59HV7+k+%g9%)HGc(*B`wLcyX>35 zis$>ZQoX#wU$6SYuTXl~=hLQf5d@#*eA*k*<-@rbvp(%g!XRecb%!<`#yA#P&#n0E z{-v?z`gl@97=*T{i?0%qww;e%BXEtEescXvxnAV0avsMwX~*$s1CDE+V`OF3SoJS6 ztrz(zP9|f8v}ilv)1C_(IFIP%B0d3a>igO0aQ{pG9>h28*=DQ~9>uZiWa6|D8^iK$ zm`(|Sgx!U0p-)Z0$FO{3&XXls&GMcJwc)O4p3b0-uB~Cm%bs|b7w=}Gtz-Deu^@wr z!<+AD3$fsA1iaJco%L3CmCCk}cZ|(8i^?|er|tmx)UAo(EyA4^b#x&P^JDL@OpDTs zzVjz>A+XWt%^ds5|Fg6_@~*W|sA9+z3cN!t6joikR)J`i(15X%fcWa;>>Ev5qUphb zXWEX;?jMD$(^ + + MainWindow + + + Qt::WindowModal + + + + 0 + 0 + 1024 + 768 + + + + + 8 + + + + Slide Scanner - ShanMukha Innovations Pvt Ltd + + + + F:/IITT_Logo/0.jpgF:/IITT_Logo/0.jpg + + + false + + + background-color: rgb(90, 90, 90); + + + + + + 20 + 20 + 50 + 50 + + + + false + + + + + 0 + 0 + 0 + + + + + QGraphicsView::SmartViewportUpdate + + + + + + 80 + 20 + 461 + 51 + + + + + 24 + + + + color: rgb(255, 255, 255); + + + ShanMukha Innovations Pvt Ltd + + + + + + 20 + 180 + 640 + 512 + + + + + 640 + 512 + + + + background-color: rgb(85, 255, 127); + + + + + + 220 + 150 + 221 + 31 + + + + + 18 + + + + color: rgb(255, 255, 255); + + + Live Preview of Silde + + + + + true + + + + 680 + 520 + 141 + 27 + + + + + 0 + 0 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + + Take a Snapshot + + + false + + + false + + + + + + 870 + 520 + 141 + 27 + + + + + 0 + 0 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Auto-Focus + + + + + + 734 + 300 + 51 + 23 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + X+ + + + + + + 680 + 330 + 51 + 23 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Y- + + + false + + + true + + + + + + 790 + 330 + 51 + 23 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Y+ + + + + + + 734 + 360 + 51 + 23 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + X- + + + + + + 880 + 300 + 75 + 23 + + + + PointingHandCursor + + + false + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Z - UP + + + + + + 880 + 360 + 75 + 23 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Z - DOWN + + + + + + 680 + 260 + 181 + 21 + + + + + 0 + 0 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Slide Movement Controls + + + + + + 770 + 420 + 113 + 20 + + + + + + + 690 + 420 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + X position + + + + + + 690 + 480 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Z position + + + + + + 770 + 480 + 113 + 20 + + + + + + + 690 + 450 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Y position + + + + + + 770 + 450 + 113 + 20 + + + + + + + 890 + 420 + 75 + 23 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Go to X + + + + + + 890 + 450 + 75 + 23 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Go to Y + + + + + + 890 + 480 + 75 + 23 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Go to Z + + + + + + 940 + 220 + 75 + 23 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Set + + + + + + 680 + 220 + 131 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Exposure (in ms) + + + Qt::AlignCenter + + + + + + 820 + 220 + 113 + 20 + + + + + + true + + + + 680 + 560 + 141 + 27 + + + + + 0 + 0 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + + WSI Scan + + + false + + + false + + + + + + 680 + 180 + 131 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Slide Name + + + Qt::AlignCenter + + + + + + 820 + 180 + 113 + 20 + + + + + + + 940 + 180 + 75 + 23 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Set + + + + + + 840 + 0 + 131 + 16 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Current Positions + + + + + + 840 + 30 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + X position + + + + + + 840 + 60 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Y position + + + + + + 840 + 90 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Z position + + + + + + 930 + 30 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + 0 + + + + + + 930 + 60 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + 0 + + + + + + 930 + 90 + 81 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + 0 + + + + + + 630 + 30 + 51 + 23 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + 40X + + + + + + 700 + 30 + 51 + 23 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + 20X + + + + + + 630 + 0 + 131 + 21 + + + + + 12 + + + + color: rgb(255, 255, 255); + + + Magnification + + + Qt::AlignCenter + + + + + true + + + + 870 + 560 + 141 + 27 + + + + + 0 + 0 + + + + + 10 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + + Best Region Scanning + + + false + + + false + + + + + + 830 + 120 + 191 + 23 + + + + + 12 + + + + PointingHandCursor + + + color: rgb(255, 255, 255); +background-color: rgb(0, 0, 0); +border-radius:10px; + + + Set as Origin + + + + + + + 0 + 0 + 1024 + 21 + + + + + + + + diff --git a/src/python/toQImage.py b/src/python/toQImage.py new file mode 100644 index 0000000..e0243d1 --- /dev/null +++ b/src/python/toQImage.py @@ -0,0 +1,27 @@ +from PyQt5.QtGui import QImage, qRgb +import numpy as np + +class NotImplementedException: + pass + +gray_color_table = [qRgb(i, i, i) for i in range(256)] + +def toQImage(im, copy=False): + if im is None: + return QImage() + + if im.dtype == np.uint8: + if len(im.shape) == 2: + qim = QImage(im.data, im.shape[1], im.shape[0], im.strides[0], QImage.Format_Indexed8) + qim.setColorTable(gray_color_table) + return qim.copy() if copy else qim + + elif len(im.shape) == 3: + if im.shape[2] == 3: + qim = QImage(im.data, im.shape[1], im.shape[0], im.strides[0], QImage.Format_RGB888); + return qim.copy() if copy else qim + elif im.shape[2] == 4: + qim = QImage(im.data, im.shape[1], im.shape[0], im.strides[0], QImage.Format_ARGB32); + return qim.copy() if copy else qim + +#raise NotImplementedException \ No newline at end of file diff --git a/src/python/toQImage.pyc b/src/python/toQImage.pyc new file mode 100644 index 0000000000000000000000000000000000000000..043d3384043b2c0a36317d858419f709eff1475c GIT binary patch literal 1307 zcmbtUOK;Oa5T0G<-3Ab8flB;lA||{+op$ zn@w6d6Kde#?Ln7xD2W+%-Pnt?>tf4nqC`zX+Ll(vltuo6#P-WWzre(w9BbE4ls?>= z@AeBkNn-cC)?d7M{n=XY5R)?E)wHlV2@X7Gr6vNPxO~xaiuh())=k9OfR+`hOD2&+NKRq5$GrusYX5(rv{h= zG4`k_03ppDo8%`RnJ|g+(8D@Im<3Ab$fP?-7J2CI#Y&%P)x$P_*SM90N%p}z4mI8* zWSDscjTT`p8j$(?BrS~njKkjD?Da~98S<8(jrA^vV}cAKo7qf!;~=`4<=c!g@@<)q zb(8e`F$oZhqAu@?Ww9aJVo5HG4rxn9mVOub7>oVl0H3cO;O- wGk3*cnHST2H$AdVSGdSKUYKipnY62%jCSk9UX>UBH9Ita7Z1du>{w6bAMb_)5&!@I literal 0 HcmV?d00001