PRUEBA_II_Sgript_Estim_Long_Axon_Estereo_PLANOS.m 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. function [Matriz_Q, Matriz_Error_Length, Axon_Real_Length, Estimated_Axon_Length, Filas_Centros, Columnas_Centros, Z_Centros] = PRUEBA_II_Sgript_Estim_Long_Axon_Estereo_PLANOS ( AXON_Cell, AXON, Distancias_entre_Planos, Step_Lengths, Grosor_Corte, h_Cortes, lado_x_Frame, lado_y_Frame, sampling_box_height, AZIM, ELEV, ONSET )
  2. % INPUT
  3. % h_Cortes = 1; % Analizamos un corte cada 'h_Cortes' cortes de la muestra
  4. % % El 'frame' es la sampling box en la que se introduce la esfera; esa caja luego se introduce en la celda de la rejilla en que se ha dividido el corte.
  5. % lado_x_Frame = 25; % en micras
  6. % lado_y_Frame = 25; % en micras
  7. % sampling_box_height = 25; % en micras
  8. % Longitud total del axón
  9. branch_length = zeros( 1, length(AXON_Cell) );
  10. aa= 0;
  11. for i = 1:length(AXON_Cell)
  12. dummy = AXON_Cell{1, i};
  13. diff_dummy = diff( dummy, 1, 1 );
  14. branch_length( i ) = sum( sqrt( sum( diff_dummy(:, 1:3).^2, 2 ) ) );
  15. aa = aa + length(dummy);
  16. end
  17. Axon_Real_Length = sum( branch_length );
  18. % Generamos cortes de en el plano xy
  19. CORTES_XY_AXON = cell( 1, length( Step_Lengths ) );
  20. FILAS_REJILLA = cell( 1, length( Step_Lengths ) );
  21. COLUMNAS_REJILLA = cell( 1, length( Step_Lengths ) );
  22. CORTES = cell( 1, length( Step_Lengths ) );
  23. for e = 1:length( Step_Lengths )
  24. % [Cortes_XY_Axon, Filas_Rejilla, Columnas_Rejilla, Cortes] = Script_Corte_y_Rejilla_del_Axon ( AXON, AXON_Cell, Grosor_Corte, Step_Lengths( e ), Step_Lengths( e ) );
  25. [Cortes_XY_Axon, Filas_Rejilla, Columnas_Rejilla, Cortes] = Script_Corte_y_Rejilla_del_Axon_2 ( AXON, AXON_Cell, Grosor_Corte, Step_Lengths( e ), Step_Lengths( e ) );
  26. CORTES_XY_AXON{1, e} = Cortes_XY_Axon;
  27. FILAS_REJILLA{1, e} = Filas_Rejilla;
  28. COLUMNAS_REJILLA{1, e}= Columnas_Rejilla;
  29. CORTES{1, e} = Cortes;
  30. disp([num2str(e), ' muestra preparada de ', num2str(length( Step_Lengths ))]);
  31. end
  32. Matriz_Q = zeros(length( Step_Lengths ), length( Distancias_entre_Planos )); % Filas para los step_lengths y columnas para los diámetros de la sonda
  33. Matriz_Error_Length = zeros(length( Step_Lengths ), length( Distancias_entre_Planos )); % Filas para los step_lengths y columnas para lso diámetros de la sonda
  34. % Obtenemos las intersecciones de la esfera para estimar la longitud total:
  35. for e = 1:length( Step_Lengths )
  36. for d = 1:length( Distancias_entre_Planos ) % Recorremos los diámteros de la sonda esférica:
  37. % [Q, ~, Error_Length] = Script_Analisis_Esferas_Neuronas_1 ( CORTES_XY_AXON{1, e}, h_Cortes, Diams_Sonda( d )/2, COLUMNAS_REJILLA{1, e}, Step_Lengths( e ), FILAS_REJILLA{1, e}, Step_Lengths( e ), CORTES{1, e}, Grosor_Corte, lado_x_Frame, lado_y_Frame, sampling_box_height, Axon_Real_Length );
  38. [Q, ~, Error_Length, Estimated_Axon_Length, Filas_Centros, Columnas_Centros, Z_Centros] = PRUEBA_II_Script_Analisis_PLANOS_Neuronas_1 ( CORTES_XY_AXON{1, e}, h_Cortes, COLUMNAS_REJILLA{1, e}, Step_Lengths( e ), FILAS_REJILLA{1, e}, Step_Lengths( e ), CORTES{1, e}, Grosor_Corte, lado_x_Frame, lado_y_Frame, sampling_box_height, Axon_Real_Length, Distancias_entre_Planos( d ), AZIM, ELEV, ONSET );
  39. Matriz_Q( e, d ) = Q;
  40. Matriz_Error_Length( e, d ) = Error_Length;
  41. disp([e, d]);
  42. end
  43. end