diff --git a/src/firmware/IAD_v2_4_AIO.ino b/src/firmware/IAD_v2_4_AIO.ino deleted file mode 100644 index 7f32eff..0000000 --- a/src/firmware/IAD_v2_4_AIO.ino +++ /dev/null @@ -1,479 +0,0 @@ -#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; i 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 deleted file mode 100644 index d1de1d8..0000000 Binary files a/src/python/0.jpg and /dev/null differ diff --git a/src/python/pyuic5.bat b/src/python/pyuic5.bat deleted file mode 100644 index 4606b87..0000000 --- a/src/python/pyuic5.bat +++ /dev/null @@ -1 +0,0 @@ -@"C:\Users\jeevan\AppData\Local\Programs\Python\Python35-32\python" -m PyQt5.uic.pyuic %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/src/python/slide_scanner_gui.py b/src/python/slide_scanner_gui.py deleted file mode 100644 index a45dee3..0000000 --- a/src/python/slide_scanner_gui.py +++ /dev/null @@ -1,399 +0,0 @@ -from PyQt5 import QtCore,QtGui,QtWidgets -import sys -import slide_scanner_test -import numpy as np -import cv2 -import threading, time -from ximea import xiapi -import toQImage, PIL.Image -import serial - - -class gui(QtWidgets.QMainWindow,slide_scanner_test.Ui_MainWindow): - def __init__(self,parent=None): - super(gui,self).__init__(parent) - self.setupUi(self) - self.connectActions() - def main(self): - self.logoView.setPixmap(QtGui.QPixmap("0.jpg").scaled(50,50)) - self.cam = xiapi.Camera() - self.cam.open_device() - self.cam.set_exposure(2000) - self.cam.set_imgdataformat('XI_RGB24') - self.img = xiapi.Image() - self.cam.start_acquisition() - self.livePreview = threading.Thread(name='cam_initialization',target=self.openCam,args=()) - self.livePreview.start() - self.connect2arduino = threading.Thread(name='connect_arduino',target=self.connectArduino,args=()) - self.connect2arduino.start() - self.currxpos = 0; self.currypos = 0; self.currzpos = 0 - self.xFov = 1255; self.yFov = 1004; self.ymiddle = 40000;#round((12.5*self.yFov)/0.1596); - self.x0 = 0; self.x1 = 210000;#round((45*self.xFov)/0.1995); - self.y0 = 0; self.y1 = 80000;#round((12*self.yFov)/0.1596); - self.Zpulserate = 38400;self.Xpulserate = 38400;self.Ypulserate = 38400 - self._translate = QtCore.QCoreApplication.translate - self.show() - - def connectActions(self): - self.pushButton.clicked.connect(self.snapshot) - self.pushButton_2.clicked.connect(self.autoFocus) - self.pushButton_3.clicked.connect(self.xPlus) - self.pushButton_4.clicked.connect(self.yMinus) - self.pushButton_5.clicked.connect(self.yPlus) - self.pushButton_6.clicked.connect(self.xMinus) - self.pushButton_7.clicked.connect(self.zUp) - self.pushButton_8.clicked.connect(self.zDown) - self.pushButton_9.clicked.connect(lambda: self.gotoX(self.lineEdit.text())) - self.pushButton_10.clicked.connect(lambda: self.gotoY(self.lineEdit_3.text())) - self.pushButton_11.clicked.connect(lambda: self.gotoZ(self.lineEdit_2.text())) - self.pushButton_12.clicked.connect(lambda: self.setExposure(self.lineEdit_4.text())) - self.pushButton_13.clicked.connect(self.test) - self.pushButton_17.clicked.connect(self.bloodsmear) - self.pushButton_18.clicked.connect(self.resetOrigin) - - def openCam(self): - while True: - self.cam.get_image(self.img) - self.data = self.img.get_image_data_numpy(invert_rgb_order=True) - self.pixmap = QtGui.QPixmap.fromImage(toQImage.toQImage(self.data)) - self.slideImageView.setPixmap(self.pixmap.scaled(680,520)) - - def connectArduino(self): - self.ser = serial.Serial('COM3',57600) - #self.ser.open() - - def setExposure(self, value): - self.cam.set_exposure(int(value)) - - def resetOrigin(self): - self.currxpos = 0 - self.currypos = 0 - self.currzpos = 0 - self.ser.write(b'X') - self.label_13.setText(self._translate("MainWindow", str(self.currxpos))) - self.label_14.setText(self._translate("MainWindow", str(self.currypos))) - self.label_15.setText(self._translate("MainWindow", str(self.currzpos))) - def snapshot(self): - snapshot = PIL.Image.fromarray(self.data,'RGB') - snapshot.save('snap.jpg') - - def autoFocus(self): - ts_start = time.time() - # Crude Auto-Focus - Z_travel_for_crude = 16000; crude_step_count = 500; - crude_pulse_count = Z_travel_for_crude / crude_step_count; - crude_max_var=0; crude_loc_max_var=0; - 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.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 deleted file mode 100644 index d7d4f29..0000000 --- a/src/python/slide_scanner_test.py +++ /dev/null @@ -1,419 +0,0 @@ -# -*- 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 deleted file mode 100644 index 6084405..0000000 Binary files a/src/python/slide_scanner_test.pyc and /dev/null differ diff --git a/src/python/slide_scanner_test.qml b/src/python/slide_scanner_test.qml deleted file mode 100644 index fa9d594..0000000 --- a/src/python/slide_scanner_test.qml +++ /dev/null @@ -1,111 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Window 2.2 -import QtGraphicalEffects 1.0 - -Window { - id: main - visible: true - width: 1280 - height: 720 - color: "#000000" - title: qsTr("Main") - - Image { - id: image - x: 30 - anchors.right: parent.right - anchors.rightMargin: 558 - anchors.left: parent.left - anchors.leftMargin: 30 - anchors.bottom: parent.bottom - anchors.bottomMargin: 30 - anchors.top: parent.top - anchors.topMargin: 170 - clip: false - source: "qrc:/qtquickplugin/images/template_image.png" - } - - Image { - id: image1 - x: 30 - y: 30 - width: 50 - height: 50 - fillMode: Image.Stretch - source: "0.jpg" - } - - Text { - id: text1 - x: 86 - y: 30 - width: 442 - height: 50 - color: "#ffffff" - text: qsTr("ShanMukha Innovations Pvt Ltd") - verticalAlignment: Text.AlignVCenter - lineHeight: 5 - fontSizeMode: Text.Fit - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 31 - } - - Text { - id: text2 - x: 260 - y: 135 - color: "#ffffff" - text: qsTr("Live View of the Slide") - styleColor: "#d20909" - fontSizeMode: Text.Fit - font.pixelSize: 24 - } - - Row { - id: row - x: 758 - y: 170 - width: 512 - height: 256 - spacing: 2 - anchors.right: parent.right - anchors.rightMargin: 30 - - Rectangle { - id: rectangle - width: 240 - height: 64 - color: "#ffffff" - radius: 30 - border.color: "#040404" - - Text { - id: text3 - text: qsTr("Take a Snapshot") - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 24 - } - } - - Rectangle { - id: rectangle1 - width: 240 - height: 64 - color: "#ffffff" - radius: 30 - anchors.right: parent.right - anchors.rightMargin: 0 - - Text { - id: text4 - text: qsTr("Auto Focus") - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 24 - } - } - } -} diff --git a/src/python/slide_scanner_test.qmlproject b/src/python/slide_scanner_test.qmlproject deleted file mode 100644 index 363f86e..0000000 --- a/src/python/slide_scanner_test.qmlproject +++ /dev/null @@ -1,20 +0,0 @@ -/* File generated by Qt Creator */ - -import QmlProject 1.1 - -Project { - mainFile: "slide_scanner_test.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ "../exampleplugin" ] -} diff --git a/src/python/slide_scanner_test.ui b/src/python/slide_scanner_test.ui deleted file mode 100644 index 532b3eb..0000000 --- a/src/python/slide_scanner_test.ui +++ /dev/null @@ -1,986 +0,0 @@ - - - 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 deleted file mode 100644 index e0243d1..0000000 --- a/src/python/toQImage.py +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index 043d338..0000000 Binary files a/src/python/toQImage.pyc and /dev/null differ