Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = “aab”,
Return
[ ["aa","b"], ["a","a","b"] ]
#include <vector> #include <string> #include <iostream> using namespace std; class Solution { public: vector<vector> partition(string s) { // Start typing your C/C++ solution below vector tempp; vector temp; vector<vector> result; int nStart = 0; int nEnd = 1; for(int i=0;i<s.length();i++){ string strtemp; strtemp = s.substr(i,1); temp.push_back(strtemp); if (nEnd==s.length()){ string str; str = s.substr(nStart,nEnd-nStart); tempp.push_back(str); continue; } if(s.at(nStart)!=s.at(nEnd)){ string str; str = s.substr(nStart,nEnd-nStart); tempp.push_back(str); nStart=nEnd; nEnd++; } else{ nEnd++; } } result.push_back(tempp); result.push_back(temp); return result; } }; void main() { string s = "aabccbbb"; //for test vector<vector<string>> vecResults; Solution sol; vecResults = sol.partition(s); for(int i=0;i<vecResults.size();i++){ for(int j=0;j<vecResults.at(i).size();j++){ cout<<vecResults.at(i).at(j); cout<<" "; } cout<<"\n"; } }
MRI hardware components
A typical MRI system include following components:
- Magnet
- RF coils
- Gradient coils
- Shim coils
- Magnet coils
- Magnet power supply
- Shim power supply
- Gradient amplifiers
- RF transmitter
- RF receivers
- Digitizer
- Host computer
- Operators console
- Image processor
Sequence: Spin Echo
T1 weighted images (T1WI) are achieve using a short TE and short TR
T2 weighted images (T2WI) are achieve using a long TE and long TR
Proton Density images (PD) are achieve using a short TE and long TR
MRI and Nobel
A brief historical account of the Nobel Prize Laureates clearly shows the track of the discovery, development, and applications of NMR spectroscopy.
Otto Stern, USA: Nobel Prize in Physics 1943, “for his contribution to the development of molecular ray method and his discovery of the magnetic moment of the proton”
Isidor I. Rabi, USA: Nobel Prize in Physics 1944, “for his resonance method for recording the magnetic properties of atomic nuclei”
Felix Bloch, USA and Edward M. Purcell, USA: Nobel Prize in Physics 1952, “for their discovery of new methods for nuclear magnetic precision measurements and discoveries in connection therewith”
Richard R. Ernst, Switzerland: Nobel Prize in Chemistry 1991, “for his contributions to the development of the methodology of high resolution nuclear magnetic resonance (NMR) spectroscopy
Kurt Wüthrich, Switzerland: Nobel Prize in Chemistry 2002, “for his development of nuclear magnetic resonance spectroscopy for determining the three-dimensional structure of biological macromolecules in solution”
Paul C. Lauterbur, USA and Peter Mansfield, United Kingdom: Nobel Prize in Physiology or Medicine 2003, “for their discoveries concerning magnetic resonance imaging”
Find your file in the folder
If you want to search a file under the MFC programming environment, the below source code may help you.
///… Search File
HANDLE hFile;
WIN32_FIND_DATA FindFileData;
CString szFileMask; //file search path and file wildcard
hFile = FindFirstFile(szFileMask,&FindFileData);
while(hFile != INVALID_HANDLE_VALUE)
{
if(!FindNextFile(hFile,&FindFileData))
break;
}
FindClose(hFile);
///…End Search File
“Unable to Attach to the Process” visual studio 2008 error
Problem: It’s really weird. when I try debug the program as usual, there is an error box jump up “Unable to Attach to the Process”.
Solution: Project propeties->debugging->Attach set to NO.
The function of Attach is specifies whether to start or attach to the application. Default setting is No. I don’t know why mine is set to yes.
MRI take home point 4
- The data in the center of k-space determine SNR.
- The spin-echo pulse sequence consists of a 90-TE/2-180-TE/2-ADC.
- Total scan time for 2D spin-echo imaging is determined by the product of TR, the number of phase-encoding steps, and the number of excitations per phase-encoding step.
- In multislice SE, many slices are collected in the same scan time as a single slice. The maximum number of slices is determined by TR and TE, the longer TR and the shorter TE, the more slices that can be acquired.
- Gradient-echo pulse sequences speed image acquisitions by using partial flip angles (less than 90 degree) and gradient-reversal to form a signal echo.
- Fast spin-echo (FSE) sequences provide similar contrast weighting to SE sequences, but with reduced scan times.
- The echo train length (ETL) in FSE describes the number of echoes acquired after each excitation; each echo corresponds to a different phase-encoding view (or line in k-space).
- Echo planar imaging (EPI) acquires extremely fast images but at limited spatial resolution and contrast weighting; more sensitive to chemical shift artifacts.
- Short TI inversion recovery (STIR) sequences provide fat suppression by selection of a TI value that nulls the signal from fat; STIR is a useful substitute for fat-suppressed T2W SE or FSE sequences.
- “Fast STIR” imaging collects multiple phase-encoding views (or lines in k-space) for each
- 180-TI-90-TE/2-180-TE/2-ADC pulse train, making it a practical alternative
- to FSE for obtaining fat-suppressed T2-weighted images.
- Noise is best measured as the standard deviation in the background of an MRI.
- Image SNR increases approximately linearly with static magnetic field strength above 0.5 tesla.
- Image SNR increases linearly with pixel size.
- When two similarly acquired images are added or subtracted, the resulting image has a noise level that is square root of 2 higher than that in either image.
- The larger the lesion area or contrast, and the lower the noise, the easier the lesion is to detect.
- The rose model describes the relationship between lesion area, contrast, and noise for lesion detection; the larger the lesion area or contrast, and the lower the noise, the easier the lesion is to detect.
- Artifacts can be caused by imperfection of hardware including B0, B1, gradients, shielding, RF coils.
- Cross-talking in multi-slice MRI. Partial-volume artifacts.
- Most artifacts in PE direction (such as motion) but chemical shift artifact which in FE direction.
- Ringing artifacts by insufficient sample points, Wraparound artifacts by insufficient FOV.
- Gd-chelates’ primary effect is marked shortening of T1; thus heavily T1-weighted sequences are essential for high sensitivity to cancer.
- Gd-chelate contrast agents have the potential to cause a new, potentially serious disease (nephrogenic systemic fibrosis or NSF) in patients who have moderate to end-stage kidney disease at the time of administration of contrast agent