help > Edge Plot
Showing 1-19 of 19 posts
Display:
Results per page:
Jul 29, 2016  02:07 AM | Gyan Raj Koirala
Edge Plot
Hi there,

I have an adjacency matrix which consists of both positive and negative edge values.

When I tried to view the connectivity using BrainNet, it shows error in MATLAB command window which are as below:

----------------------------------------------------------------------
Subscripted assignment dimension mismatch.

Error in BrainNet>Nettrans (line 668)
[cylinder(:,1),cylinder(:,2)]=ind2sub(size(net),index);
Error in BrainNet>NetPrepare (line 351)
[surf.ncyl,surf.cylinder]=Nettrans(surf.net,min(surf.net(:)));
Error in BrainNet>FileView (line 2781)
NetPrepare;
Error in BrainNet>NV_m_LF_Callback (line 3643)
a=FileView;
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in BrainNet (line 53)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)BrainNet('NV_m_LF_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uimenu Callback

-----------------------------------------------------------------------------------------------------------

Could you please help me to fix this problem?

Additionally, I wish to have different edge color for positive and negative values respectively. Please help me.

Thanks in advance.

Gyan
Jul 30, 2016  10:07 AM | Mingrui Xia
RE: Edge Plot
Hi Gyan,

It seems that the number of nodes in your node file is not matched with your matrix. You can attach your files so that I can have check. 

To have different edge color for positive and negative value srespectively, pls select threshold for edge color in the option panel, then set the threshold to 0 and select each of the color. 

Best,
Mingrui
Aug 1, 2016  02:08 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

Thank you for your kind response.

I have attached both the node file and the edge matrix here.

The problem that I encountered is with the matrix having both positive and negative matrix entries, however, it works fine with only positive entries of the matrix.

Thank you.

Sincerely yours,
Gyan
Aug 1, 2016  02:08 AM | Gyan Raj Koirala
RE: Edge Plot
Here is also the node file.
Attachment: Node_BA84.node
Aug 1, 2016  02:08 AM | Mingrui Xia
RE: Edge Plot
Hi Gyan,

I found that your edge file is not in ascii format, that's why BNV could not read it. Please use the following code to transform the format: 

M = load('ThreMatPosNeg_Delta.edge');
save('ThreMatPosNeg_Delta2.edge','M','-ascii');

I also attached the modified edge file, figure and the option file.

Best,
Mingrui
Attachment: test.zip
Aug 1, 2016  05:08 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

At this point, I overcome my problems and its working fine.

Thank you very much.

By the way, is it possible to change the node colors corresponding to the edge entries (For eg. red nodes to those connected with positive edge values and blue nodes to those connected with negative edge values)???

Thank you.

Sincerely yours,
Gyan
Aug 1, 2016  12:08 PM | Mingrui Xia
RE: Edge Plot
Dear Gyan,

We may add this function in future. But what color should I choose if a node connected with both positive and negative edges?

Best,
Mingrui
Aug 2, 2016  12:08 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

I believe that the addition of color would be very helpful for effective visualization. 

Yes of course, the color value for the nodes having both positive and negative is the critical thing to be considered here. In my opinion, there could be some ways that can be applied:

i) Counting the number of positive and negative edges to a particular node. In simple, the color can be biased to the highest number of edges (either positive or negative). In complex, one way could be to evaluate the intermediate colors based on the edge densities (positive and negative).

ii) If we have significant size of nodes then we can resemble the densities of positive and negative edges in terms of pie-chart as well.

These are just my suggestions to you, and hope it would help you to some extent.

Thank you for your kind response.

Sincerely yours,
Gyan
Sep 8, 2016  02:09 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

I have encountered a problem in plotting. It shows the following error.

...........................................................................................
Operands to the || and && operators must be convertible to logical
scalar values.

Error in BrainNet_Option>Initialization (line 327)
if
EC.lbl_threshold>max(surf.sphere(:,5))||EC.lbl_threshold
Error in BrainNet_Option_BrainNet_Option_OpeningFcn (line 79)
Initialization(handles);
Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [],
guidata(gui_hFigure), varargin{:});
Error in BrainNet_Option (line 52)
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
Error in BrainNet>NV_m_LF_Callback (line 3634)
H=BrainNet_Option;
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in BrainNet (line 53)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)BrainNet('NV_m_LF_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating Menu Callback

......................................................................................................................

I have also attached the node and edge matrix file. Could you please help me to sort out this problem.

Thank you Sir.
Attachment: 34ROIs.node
Sep 8, 2016  02:09 AM | Gyan Raj Koirala
RE: Edge Plot
The edge file here.
Attachment: Check1.edge
Sep 8, 2016  03:09 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

I have already got the solution. 

The node file has some irrelevant input in the first row and corrected it.

Thank you.
Sep 9, 2016  01:09 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

I would be very grateful to you if you could guide me to solve the following issues in BrainNet visualization.

Kindly check the attached picture.

1. The labeling of the nodes are not very convincing since some of the node labels can not be seen. I wish to customize the node labels so that we could get all the labels perfectly according to the nodes. Red circled and marked by 1,2,3.
2. Also the edge lines are missing within some brain regions, which I wish to be shown above brain region. Red circled and marked by 4.

Thank you very much for your kind consideration.
Attachment: Check.jpg
Sep 10, 2016  02:09 AM | Mingrui Xia
RE: Edge Plot
Hi, 

1. Currently, I don't have good solution to solve the problem of label overlapping. You may have to manually label the nodes. 

2. Please try to decrease the transparency of the surface. 

Best,
Mingrui
Oct 6, 2016  02:10 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

I have a 1x6239 data file computed from LORETA. I would like to visualize the result in BrainNet, but I have a problem in creating an appropriate volume file.

...............................................................................................................
Error using read_hdr (line 55)
Unrecognised datatype (12336) for "D:\1 ThreDeltaLoc.img.

Error in nifti (line 27)
vol = read_hdr(fname);
Error in BrainNet_spm_vol_nifti (line 16)
N = nifti(fname);
Error in BrainNet_spm_vol>subfunc (line 136)
V = BrainNet_spm_vol_nifti(p);
Error in BrainNet_spm_vol>subfunc1 (line 84)
v = subfunc(P(i,:));
Error in BrainNet_spm_vol>subfunc2 (line 70)
V = subfunc1(P);
Error in BrainNet_spm_vol (line 54)
V = subfunc2(P);
Error in BrainNet_LoadFiles>VF_load (line 347)
hdr=BrainNet_spm_vol(filename); %%% Edited by Mingrui Xia,
111026, integrated SPM NIFTI into BrainNet Viewer.
Error in BrainNet_LoadFiles>OK_button_Callback (line 192)
[surf.hdr surf.vol]=VF_load(File.VF);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in BrainNet_LoadFiles (line 56)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)BrainNet_LoadFiles('OK_button_Callback',hObject,eventdata,guidata(hObject))
Error using waitfor
Error while evaluating UIControl Callback
.........................................................................................................................................

I have attached a sample data file here too (I had tried to convert .txt to .hdr and .img file but failed to proceed so I attached a raw .txt file).

Thank you.
Attachment: ThreDeltaLoc.txt
Oct 6, 2016  02:10 AM | Mingrui Xia
RE: Edge Plot
Hi,

I don't know what does this vector mean in an anatomical space. You may see the manual of LORETA to transfer it to a nifti file. 

Best,
Mingrui
Oct 6, 2016  02:10 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

For your kind information, those vectors are the computed current source density measures between pre and post states of a test.

I convert the LORETA file to the text file but failed to make it a volume file in BrainNet.

That's the problem I wish to sort out.

Thank you.

Sincerely yours,
Oct 6, 2016  02:10 AM | Mingrui Xia
RE: Edge Plot
Hi, 

The converting from txt to nifti requires to know where each value of the vector should be located in the nifti file space which is lacking in your case. BrainNet Viewer can only read correct nifti files instead make them. So, I could help to convert it to volume file, unless you can find out the spatial information of the vector. 

Best,
Mingrui
Oct 6, 2016  04:10 AM | Gyan Raj Koirala
RE: Edge Plot
Dear Mingrui,

I have extracted the voxel co-ordinate file (file attached) from LORETA. Does it help to make a nifti file for volume plot???

Sincerely yours,
Attachment: Voxel List.csv
Oct 8, 2016  02:10 AM | Mingrui Xia
RE: Edge Plot
Hi, 

There following codes can be used to convert your txt file to nifti file: 

hdr = spm_vol('Reslice_ch2.nii');
vol = spm_read_vols(hdr);
vol_new = zeros(size(vol));
value = load('ThreDeltaLoc.txt');
loc = load('location.txt');
loc = loc';
loc(4,:) = 1;
loc = round(hdr.mat\loc);
ind = sub2ind(hdr.dim,loc(1,:),loc(2,:),loc(3,:));
vol_new(ind) = value;
hdr_new = hdr;
hdr_new.fname = 'ThreDeltaLoc.nii';
hdr_new.dt(1) = 64;
hdr_new.descrip = '';
spm_write_vol(hdr_new,vol_new);

I also attached relevant files. I resliced the nifti file to a 5mm resolution according to your coordinates, you can use different resolution in other cases.

Best,
Mingrui
Attachment: ThreDeltaLoc.zip