From 36ef7ead1f5e9aaf1bf6107f4b2d0146405a4c3a Mon Sep 17 00:00:00 2001 From: Florian Vollrath Date: Wed, 7 Sep 2016 14:46:51 +0200 Subject: [PATCH] added an output of merged cell_signals and some information to select PCAs manually --- alternativePlot.m | 9 +++++++-- main.m | 11 ++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/alternativePlot.m b/alternativePlot.m index 4fe762a..86578a3 100644 --- a/alternativePlot.m +++ b/alternativePlot.m @@ -1,4 +1,4 @@ -function alternativePlot(ica_segments, cluster, cell_sig, subPlotCols, sortedIdx, data_r) +function cell_sig_merged = alternativePlot(ica_segments, cluster, cell_sig, subPlotCols, sortedIdx, data_r) cm = colormap(hsv); tempImage = zeros(size(ica_segments, 2), size(ica_segments, 3), 3); @@ -23,7 +23,7 @@ function alternativePlot(ica_segments, cluster, cell_sig, subPlotCols, sortedIdx end %set pixels 0 which are smaller than 0, seems to happen in rare cases.. for i = 1:3 -tempImage(:,:,i) = (tempImage(:,:,i) > 0).*tempImage(:,:,i); + tempImage(:,:,i) = (tempImage(:,:,i) > 0).*tempImage(:,:,i); end %scale tempImage % maximum = max(tempImage(:)); @@ -51,8 +51,13 @@ function alternativePlot(ica_segments, cluster, cell_sig, subPlotCols, sortedIdx subplot(1,2,2); hold on cell_sigPlot = cell_sig(sortedIdx,:); + + + signal = zeros(size(cluster,2),size(cell_sig,2)); for i = 1:size(cluster, 2) + cell_sig_merged{i} = cell_sig(sortedIdx,:); +cell_sig_merged{i} = mean(cell_sig_merged{i}(cluster{i},:), 1); for clusterIdx = cluster{i} %subtract minimum value minimum = min(cell_sigPlot(clusterIdx,:)); diff --git a/main.m b/main.m index 8a788e2..68810ae 100644 --- a/main.m +++ b/main.m @@ -34,7 +34,8 @@ %choose PCAs, type f/b in command line to go back or forward. type two number %to select the range "1 ENTER 25 ENTER" would select the PCAs from 1 to 25 [PCuse] = CellsortChoosePCs(fn_green, mixedfilters, data_g); - +%OR specify the PCAs to use manually: +%PCuse = [2,3,6,13,16,17,18,19,21,22,23,25,29,30]; %% 2b. Plot PC spectrum %optionally, you can display the PC spectrum.. CellsortPlotPCspectrum(fn_green, CovEvals, PCuse, data_g) @@ -67,8 +68,8 @@ %plotting: 1 = yes or 0 = no.. shall a plot be shown or not? smwidth = 1; -thresh = 2; -arealims = [250]; +thresh = 1.5; +arealims = [200]; plotting = 1; [ica_segments, segmentlabel, segcentroid] = CellsortSegmentation(ica_filters, smwidth, thresh, arealims, plotting); @@ -94,7 +95,7 @@ %% show signal of cells (cell_sig) %caluclate correlation matrix for cell_sig [ica_segments, cluster, subPlotCols, subPlotWidth, sortedIdx] = calcCorrEff(cell_sig, ica_segments); -alternativePlot(ica_segments, cluster, cell_sig, subPlotCols, sortedIdx, data_r); +cell_sig_merged = alternativePlot(ica_segments, cluster, cell_sig, subPlotCols, sortedIdx, data_r); %% let user deselect and merge rois %merge -> change cluster ->recereate plots @@ -117,4 +118,4 @@ subPlotCols = size(cluster_new, 2); %redraw -alternativePlot(ica_segments, cluster_new, cell_sig, subPlotCols, sortedIdx, data_r); +cell_sig_merged = alternativePlot(ica_segments, cluster_new, cell_sig, subPlotCols, sortedIdx, data_r);