Plot Dynamic MRI Slice Images in Matlab

%% mriplot.m
%  Click on any the three MRI images and press "ENTER" to change slices at new [x,y,z] positions.
%  Press "ESC" and press "ENTER" to exit.
%  by Binlin Wu -- CCNY Physics
%  09/14/2010
load mri.mat;
D1=double(squeeze(D));
DIM = size(D1);
% [X,Y,Z]=meshgrid(1:DIM(2),1:DIM(1),1:DIM(3));
h1=subplot(2,2,1);imagesc(D1(:,:,round(DIM(3)/2)),[min(D1(:)) max(D1(:))]);colormap(gray);title('axial');colorbar;
xlabel('x');ylabel('y');
h2=subplot(2,2,2);imagesc(squeeze(D1(:,round(DIM(2)/2),:)),[min(D1(:)) max(D1(:))]);colormap(gray);title('sagittal');colorbar;
xlabel('z');ylabel('y');
h3=subplot(2,2,3);imagesc(squeeze(D1(round(DIM(1)/2),:,:)),[min(D1(:)) max(D1(:))]);colormap(gray);title('coronal');colorbar;
xlabel('z');ylabel('x');
% subplot(2,2,4);slice(X,Y,Z,D1,64,64,14);colormap(gray);shading flat;title('3D Slices')
% xlabel('x');ylabel('y');zlabel('z');
x=round(DIM(2)/2);y=round(DIM(1)/2);z=round(DIM(3)/2);
button = 0;
while(1)
try
[A,B,button]=ginput;
catch
return
end
if length(A)==0
A=14;B=64;button=0;
end
A=A(end);
B=B(end);
button=button(end);
A=ceil(A-0.5);
B=ceil(B-0.5);
if button==27
break;
end
if gca==h1
x=A;
y=B;
if x <= 0 || x > DIM(2) || y <=0 || y> DIM(1)
continue
end
axes(h2);imagesc(squeeze(D1(:,x,:)),[min(D1(:)) max(D1(:))]);colormap(gray);title('sagittal');colorbar;
xlabel('z');ylabel('y')
axes(h3);imagesc(squeeze(D1(y,:,:)),[min(D1(:)) max(D1(:))]);colormap(gray);title('coronal');colorbar;
xlabel('z');ylabel('x')
%         subplot(2,2,4);slice(X,Y,Z,D1,x,y,z);colormap(gray);shading flat;title('3D Slices')
%         xlabel('x');ylabel('y');zlabel('z');
elseif gca==h2
z=A;
y=B;
if z <= 0 || z > DIM(3) || y <= 0 || y > DIM(1)
continue
end
axes(h1);imagesc(D1(:,:,z),[min(D1(:)) max(D1(:))]);colormap(gray);title('axial');colorbar;
xlabel('x');ylabel('y')
axes(h3);imagesc(squeeze(D1(y,:,:)),[min(D1(:)) max(D1(:))]);colormap(gray);title('coronal');colorbar;
xlabel('z');ylabel('x')
%         subplot(2,2,4);slice(X,Y,Z,D1,x,y,z);colormap(gray);shading flat;title('3D Slices')
%         xlabel('x');ylabel('y');zlabel('z');
elseif gca==h3
z=A;
x=B;
if x <= 0 || x > DIM(2) || z <= 0 || z > DIM(3)
continue
end
axes(h1);imagesc(D1(:,:,z),[min(D1(:)) max(D1(:))]);colormap(gray);title('axial');colorbar;
xlabel('x');ylabel('y')
axes(h2);imagesc(squeeze(D1(:,x,:)),[min(D1(:)) max(D1(:))]);colormap(gray);title('sagittal');colorbar;
xlabel('z');ylabel('y')
%         subplot(2,2,4);slice(X,Y,Z,D1,x,y,z);colormap(gray);shading flat;title('3D Slices')
%         xlabel('x');ylabel('y');zlabel('z');
end
end

Advertisements

Windows picture and fax viewer not working

1. Right click on a file and select Open With->and then select windows pic and fax viewer

2. Click Start>Run and type in:

regsvr32 shimgvw.dll

3. http://www.kellys-korner-xp.com/xp_tweaks.htm

Go to the link below and scroll down to Line 80 (left column) and click on “Restore Picture and Fax Viewer” to download a reg file fix. Save the REG File to your hard disk. Double click it and answer yes to the import prompt.

XPSViewer stopped working

I’m using win XP. I have IE and firefox. But firefox was set to the default internet browser. When I try to open an .xps file that I just created, firefox retarts and it asked me to download or open in a popup window.

Actually, this is just a file type association problem. Right now, .xps is associated with “C:\WINDOWS\system32\XPSViewer\xpsviewer.exe”. If you just want to open this xps file, you can restart IE, then drag the .xps file to IE or open the file from menu->file->open ….  If you want solve this problem permanently. Another words, if you want to open xps file directly by double click, you can just change the file type association, which can be done in many ways.

1. Right click the .xps file->open with-> choose program-> choose IE. You can check “Always use the selected program to open this kind of file”, then click OK. If you don’t see “open with”, you can use SHIFT+right click.

This can also be done by changing the file type association in the folder options, which can be seen in “my computer->Tools->folder options”, or from menu of any folder. Click File types, find xps, click “change” for “open with”.

2. If your IE is not visible in the list, you can’t find it whatsoever, then you can choose to change the file type association in the registry.

Open registry by running “regedit” and find the key at

HKey_Classes_Root\XPSViewer.Document.1\shell\open\command

Double click the key and change the value data to:
“c:\Program files\Internet Explorer\iexplore.exe” “%1”

Solutions: Window Explorer problem after Data Execution Prevention problem

I first got error message at startup.

“Data Execution Prevention – Windows has encountered a problem and needs to close.”

I turned off DEP for explorer.exe by going to:

System Properties->Advanced->Performance: Settings->Data Execution Prevention->”select Turn on DEP for all programs and services except those I select“, then add “explorer.exe” by browsing to C:\windows\ and select it.

Then I got another error message at startup: “Windows has encountered a problem and needs to close.” If I go to event viewer, I saw details as:

AppName: explorer.exe AppVer: 6.0.2900.5512 ModName: unknown
ModVer: 0.0.0.0 Offset: 71ab6a55

I tried many things, including virus scanning and spyware removal and run “sfc /scannow“. But none seemed to work. Later the error became:

AppName: explorer.exe AppVer: 6.0.2900.5512 ModName: ws2_32.dll
ModVer: 5.1.2600.5512 Offset: 00006a55

Then I searched again. A lot “solutions” again. This is a win socket problem. I tried winsockfix 1.2from “http://www.softpedia.com/get/System/OS-Enhancements/WinSock-XP-Fix.shtml&#8221;. It still didn’t work. But the error message seems to change a little bit from one to another. But they are all windows explorer.exe error message.

One blog says most of windows explorer problems are due to registry problem. So I download RegCure and used RegCure v1.5.2.7   Crack by Computer Angelzz. It found some problems and fixed it. But it didn’t help me fix the windows explorer problem.

Actually, the same problem has been happening in another computer of mine. So I have a feeling that this is still a virus/malware/spyware problem. But of Norton, spybot search and destroy, Ad-Aware etc, none worked. From somewhere, I read something about the W32/Autorun worm. That seems more possible. I found an application called cleanautorun and tried that. Unfortunately, it didn’t work either.

Because of the same problem in two of my computers happening at the same time, I belived it was a malware problem. I want to try more. So I searched for all top antivirus software: bitdefender, vipre, kaspersky etc. Norton, MCafee seems not the best in the list. I decided to try kaspersky since I tried it before.

Voila!!! Finally, windows explorer crash problem was fixed. Kaspersky found some kinf of w32/autorun worm.

How to deal with .001, .002 … files

It could be .iso.001, .iso.002 … or .part1.rar, .part2.rar … or .r01, .r02 … etc etc.

There’re two possibilities to extract these files. 1. These are slpitted files during compression using winrar. Put all files in one folder. Just extract the first file, it will extract everything. 2. These are splitted files using splitting software such as cutncopy, hjsplit etc. We need use them to joint all files together.

There’re some explaination links:

http://www.slyck.com/ng.php?page=10

http://forums.afterdawn.com/thread_view.cfm/248020

http://answers.yahoo.com/question/index?qid=20071006003758AA4XgLb

Show hidden files and folders

 

I got a problem with my computer. I can’t show hidden files and folders. If I choose “Show Hidden Files and Folders”, it will be change back to “Do Not …” . I did a search on the Net. The second solution solved my problem.

Solution 1:

  1. Start->Run->Regedit
  2. Go to:

//HKEY_CURRENT_USER//SoftWare//MicroSoft//Windows//CurrentVersion//Explorer//Advanced

  1. Set key Hidden = 1
  2. Refresh

Solution 2:

If you got RavMon virus etc, you may need this.

  1. Start->Run->Regedit
  2. Go to:
     

    HKEY_LOCAL_MACHINE//SoftWare//MicroSoft//Windows//CurrentVersion//Explorer//Advanced

  3. SET DWORD key CheckedValue = 1If it’s not DWORD value, delete it and recreate as DWORD value and set it to 1.
  4. Refresh