-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with opening files on the IBL ENV GUI #309
Comments
Hi, could you briefly describe the method you used to get the xyz_picks.json file and also send me the file that you are getting this problem for. Thanks |
Here are the xyz picks: |
I use the SHARP track script to get the probe points file and then I use this code to convert it into useable xyz picks files: POINTLISTFILE = "\QNAP-AL001.dpag.ox.ac.uk\Data\AMR013\histology\probe_pointselectrodetrack.mat"; folder = dir(POINTLISTFILE); probePoints = load(POINTLISTFILE); numProbes = size(probePoints.pointList.pointList,1); for p = 1:numProbes
end |
Hello, sorry for the delay. Could you also give the original .mat file and let me know which columns relates to ML, AP, DV in this original mat file and in what coordinate system they are in (are they in Allen CCF)? Thanks |
Hi,
Here is the original .mat file and the first column has the six probe
tracks listed:
[image: image.png]
and if you click on one of them it will open this up:
[image: image.png]
which I believe is the ML AP DV coordinates in pixels (units) and we have a
script to convert these into um units and they are in the Allen CCF
coordinate system. I have attached the script which we use to do this. The
output of this is the xyz_picks.json file which is generated for each
probe.
Sincerely,
Antara
…On Thu, Jun 2, 2022 at 1:33 PM mayofaulkner ***@***.***> wrote:
Hello, sorry for the delay. Could you also give the original .mat file and
let me know which columns relates to ML, AP, DV in this original mat file
and in what coordinate system they are in (are they in Allen CCF)?
Thanks
—
Reply to this email directly, view it on GitHub
<#309 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARV7RISYMPUPNRQKYYUZCH3VNCSYPANCNFSM5WMWQTBQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
*_____*
*Antara Majumdar*
DPhil Physiology, Anatomy and Genetics | Kellogg College
University of Oxford | Lak Lab
Department of Physiology, Anatomy and Genetics
Sherrington Building, Sherrington Rd, Oxford OX1 3PT
Tel: +44 07709252462
%Input: probePoints file generated after aligning histology slices to the atlas and selecting probe dye locations.
% only one point should be selected per probe per slice.
%Output: json file (one per probe) listing probe points [ML AP DV] in um from bregma
POINTLISTFILE = "\\QNAP-AL001.dpag.ox.ac.uk\Data\AMR001\Histology\RGB\probe_pointsAMR001_Probe_Points_single.mat";
folder = dir(POINTLISTFILE);
jsonOutputFolder = folder.folder;
probePoints = load(POINTLISTFILE);
numProbes = size(probePoints.pointList.pointList,1);
for p = 1:numProbes
thisProbe = probePoints.pointList.pointList{p,1}; %get first probe coords
% Convert probe coordinates (in pixels) to mm relative to bregma
ML = (thisProbe(:,1) - 570)*0.01;
DV = thisProbe(:,2)*0.01;
AP = (thisProbe(:,3) - 540)*0.01;
% Convert to um and the correct sign
ML = 1000*ML;
DV = -1000*DV;
AP = -1000*AP;
%Ouput should be ML AP DV
out = jsonencode( struct('xyz_picks', round([ML AP DV])) );
fid = fopen( fullfile(jsonOutputFolder, ['Probe' num2str(p) '_xyz_picks.json']) , 'w');
fprintf(fid, out);
fclose(fid);
end
|
Hey, the files don't seem to be attached. Could you try sending again. Thanks |
Hi,
I have attached them again.
Sincerely,
Antara
…On Fri, Jun 3, 2022 at 12:54 PM mayofaulkner ***@***.***> wrote:
Hey, the files don't seem to be attached. Could you try sending again.
Thanks
—
Reply to this email directly, view it on GitHub
<#309 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARV7RIWB53G73TDFT2FPX33VNHW7JANCNFSM5WMWQTBQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
*_____*
*Antara Majumdar*
DPhil Physiology, Anatomy and Genetics | Kellogg College
University of Oxford | Lak Lab
Department of Physiology, Anatomy and Genetics
Sherrington Building, Sherrington Rd, Oxford OX1 3PT
Tel: +44 07709252462
%Input: probePoints file generated after aligning histology slices to the atlas and selecting probe dye locations.
% only one point should be selected per probe per slice.
%Output: json file (one per probe) listing probe points [ML AP DV] in um from bregma
POINTLISTFILE = "\\QNAP-AL001.dpag.ox.ac.uk\Data\AMR001\Histology\RGB\probe_pointsAMR001_Probe_Points_single.mat";
folder = dir(POINTLISTFILE);
jsonOutputFolder = folder.folder;
probePoints = load(POINTLISTFILE);
numProbes = size(probePoints.pointList.pointList,1);
for p = 1:numProbes
thisProbe = probePoints.pointList.pointList{p,1}; %get first probe coords
% Convert probe coordinates (in pixels) to mm relative to bregma
ML = (thisProbe(:,1) - 570)*0.01;
DV = thisProbe(:,2)*0.01;
AP = (thisProbe(:,3) - 540)*0.01;
% Convert to um and the correct sign
ML = 1000*ML;
DV = -1000*DV;
AP = -1000*AP;
%Ouput should be ML AP DV
out = jsonencode( struct('xyz_picks', round([ML AP DV])) );
fid = fopen( fullfile(jsonOutputFolder, ['Probe' num2str(p) '_xyz_picks.json']) , 'w');
fprintf(fid, out);
fclose(fid);
end
|
Hi Antara, I've had a look into this and the problem occurs because the dv position of the second from last point (-7720) falls outside of the ccf atlas. This is happening because in the script above when converting you are assuming that there is no offset from bregma in the dv axis when in reality there is ~ 330um difference. The quickest fix will be to add this in before saving to json
There is, however, also a function that converts from ccf coordinates to the bregma ones used in the alignment gui that you can also use. Here I have written an example of how you would convert your points. It requires saving the points you have in matlab to an npy file and then reading them in in python to do the conversion In matlab you can do the following (FYI here is the writeNPY function https://github.com/kwikteam/npy-matlab)
and then in python
Two things that I noticed when looking at your tracing (see images for coronal and sagittal slice)
I hope that all makes sense. Please let me know if you need any other help. |
I was able to prepare files for the IBLenv GUI but then I run into issues with loading it in and I get these error messages:
(iblenv) C:\Users\Antara\int-brain-lab\iblapps\atlaselectrophysiology>python ephys_atlas_gui.py -o True
Failed to load the remote cache file
Traceback (most recent call last):
File "C:\Users\Antara\int-brain-lab\iblapps\atlaselectrophysiology\ephys_atlas_gui.py", line 1240, in data_button_pressed
self.ephysalign = EphysAlignment(self.xyz_picks, self.chn_depths,
File "C:\Users\Antara\int-brain-lab\ibllib-repo\ibllib\pipes\ephys_alignment.py", line 47, in init
= self.get_histology_regions(self.xyz_samples, self.sampling_trk, self.brain_atlas)
File "C:\Users\Antara\int-brain-lab\ibllib-repo\ibllib\pipes\ephys_alignment.py", line 229, in get_histology_regions
region_ids = brain_atlas.get_labels(xyz_coords, mapping=mapping)
File "C:\Users\Antara\int-brain-lab\ibllib-repo\ibllib\atlas\atlas.py", line 250, in get_labels
regions_indices = self._get_mapping(mapping=mapping)[self.label.flat[self._lookup(xyz)]]
File "C:\Users\Antara\int-brain-lab\ibllib-repo\ibllib\atlas\atlas.py", line 240, in _lookup
return self._lookup_inds(self.bc.xyz2i(xyz))
File "C:\Users\Antara\int-brain-lab\ibllib-repo\ibllib\atlas\atlas.py", line 230, in _lookup_inds
inds = np.ravel_multi_index(idims, self.bc.nxyz[self.xyz2dims])
File "<array_function internals>", line 180, in ravel_multi_index
ValueError: invalid entry in coordinates array
Could you let me know how to resolve this? Thank you!
The text was updated successfully, but these errors were encountered: