diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..558d2d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,292 @@ +## Core latex/pdflatex auxiliary files: +*.aux +*.lof +*.log +*.lot +*.fls +*.out +*.toc +*.fmt +*.fot +*.cb +*.cb2 +.*.lb + +## Intermediate documents: +*.dvi +*.xdv +*-converted-to.* +# these rules might exclude image files for figures etc. +# *.ps +# *.eps +# *.pdf + +## Generated if empty string is given at "Please type another file name for output:" +.pdf + +## Bibliography auxiliary files (bibtex/biblatex/biber): +*.bbl +*.bcf +*.blg +*-blx.aux +*-blx.bib +*.run.xml + +## Build tool auxiliary files: +*.fdb_latexmk +*.synctex +*.synctex(busy) +*.synctex.gz +*.synctex.gz(busy) +*.pdfsync + +## Build tool directories for auxiliary files +# latexrun +latex.out/ + +## Auxiliary and intermediate files from other packages: +# algorithms +*.alg +*.loa + +# achemso +acs-*.bib + +# amsthm +*.thm + +# beamer +*.nav +*.pre +*.snm +*.vrb + +# changes +*.soc + +# comment +*.cut + +# cprotect +*.cpt + +# elsarticle (documentclass of Elsevier journals) +*.spl + +# endnotes +*.ent + +# fixme +*.lox + +# feynmf/feynmp +*.mf +*.mp +*.t[1-9] +*.t[1-9][0-9] +*.tfm + +#(r)(e)ledmac/(r)(e)ledpar +*.end +*.?end +*.[1-9] +*.[1-9][0-9] +*.[1-9][0-9][0-9] +*.[1-9]R +*.[1-9][0-9]R +*.[1-9][0-9][0-9]R +*.eledsec[1-9] +*.eledsec[1-9]R +*.eledsec[1-9][0-9] +*.eledsec[1-9][0-9]R +*.eledsec[1-9][0-9][0-9] +*.eledsec[1-9][0-9][0-9]R + +# glossaries +*.acn +*.acr +*.glg +*.glo +*.gls +*.glsdefs +*.lzo +*.lzs + +# uncomment this for glossaries-extra (will ignore makeindex's style files!) +# *.ist + +# gnuplottex +*-gnuplottex-* + +# gregoriotex +*.gaux +*.glog +*.gtex + +# htlatex +*.4ct +*.4tc +*.idv +*.lg +*.trc +*.xref + +# hyperref +*.brf + +# knitr +*-concordance.tex +# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files +# *.tikz +*-tikzDictionary + +# listings +*.lol + +# luatexja-ruby +*.ltjruby + +# makeidx +*.idx +*.ilg +*.ind + +# minitoc +*.maf +*.mlf +*.mlt +*.mtc[0-9]* +*.slf[0-9]* +*.slt[0-9]* +*.stc[0-9]* + +# minted +_minted* +*.pyg + +# morewrites +*.mw + +# newpax +*.newpax + +# nomencl +*.nlg +*.nlo +*.nls + +# pax +*.pax + +# pdfpcnotes +*.pdfpc + +# sagetex +*.sagetex.sage +*.sagetex.py +*.sagetex.scmd + +# scrwfile +*.wrt + +# sympy +*.sout +*.sympy +sympy-plots-for-*.tex/ + +# pdfcomment +*.upa +*.upb + +# pythontex +*.pytxcode +pythontex-files-*/ + +# tcolorbox +*.listing + +# thmtools +*.loe + +# TikZ & PGF +*.dpth +*.md5 +*.auxlock + +# todonotes +*.tdo + +# vhistory +*.hst +*.ver + +# easy-todo +*.lod + +# xcolor +*.xcp + +# xmpincl +*.xmpi + +# xindy +*.xdy + +# xypic precompiled matrices and outlines +*.xyc +*.xyd + +# endfloat +*.ttt +*.fff + +# Latexian +TSWLatexianTemp* + +## Editors: +# WinEdt +*.bak +*.sav + +# Texpad +.texpadtmp + +# LyX +*.lyx~ + +# Kile +*.backup + +# gummi +.*.swp + +# KBibTeX +*~[0-9]* + +# TeXnicCenter +*.tps + +# auto folder when using emacs and auctex +./auto/* +*.el + +# expex forward references with \gathertags +*-tags.tex + +# standalone packages +*.sta + +# Makeindex log files +*.lpz + +# xwatermark package +*.xwm + +# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib +# option is specified. Footnotes are the stored in a file with suffix Notes.bib. +# Uncomment the next line to have this generated file ignored. +#*Notes.bib +thesis.mtc +thesis.pdf +Proposal/TargetBiopsy_Proposal.pdf +*.pdf diff --git a/MyTemplate.sty b/MyTemplate.sty new file mode 100644 index 0000000..ee87c44 --- /dev/null +++ b/MyTemplate.sty @@ -0,0 +1,51 @@ +% This Template Designed By Nima Pourdamghani +\ProvidesPackage{MyTemplate} + + +%Required Packages +%======================================================= +\RequirePackage{hyperref} +\usepackage{fancybox} +\usepackage{graphicx} +\usepackage{subfigure} +\usepackage{endnotes} +\usepackage[small,it]{caption} +\usepackage[font=small,format=plain,labelfont=bf,textfont=it]{caption} %Image captions reformatt +\usepackage[bottom=29mm,top=29mm,left=19mm,right=19mm]{geometry} +\usepackage{multicol} +\usepackage{xepersian} +\graphicspath{{images/}} + +%======================================================= +\addtolength{\topmargin}{-0.8cm} +\addtolength{\textheight}{1.6cm} +\addtolength{\oddsidemargin}{0cm} +\addtolength{\evensidemargin}{-0.5cm} +\addtolength{\textwidth}{0.5cm} + +%Paragraph setting +%======================================================= +\linespread{1.3} %line space +\setlength{\parindent}{0pt} %The indent of the paragraph first line +\setlength{\parskip}{5pt} %Befor paragraph space + +%General Setting +%======================================================= +\hypersetup{colorlinks=true,linkcolor=blue,citecolor=green,filecolor=magneta,urlcolor=cyan} +\settextfont[Scale=1]{Nazli} +\setlatintextfont[Scale=1]{Times New Roman} +\setdigitfont[Scale=1]{Nazli} + +% numbering style definition +\renewcommand{\thesection}{\arabic{section}} +\renewcommand{\thesubsection}{\arabic{subsection}.\arabic{section}} +\renewcommand{\thetable}{\arabic{table}.\arabic{section}} +\renewcommand{\thefigure}{\arabic{figure}.\arabic{section}} + +% Commands and definitions +%======================================================= + + + +\let\LTRfootnote=\endnote +\renewcommand{\notesname}{\vspace{-16pt}} diff --git a/endnotes.sty b/endnotes.sty new file mode 100644 index 0000000..4d28e59 --- /dev/null +++ b/endnotes.sty @@ -0,0 +1,325 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Save file as: ENDNOTES.STY +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% **************************************** +% * ENDNOTES * +% **************************************** +% +% Date of this version: 24 September 1991. +% +% Based on the FOOTNOTES section of +% LATEX.TEX (VERSION 2.09 - RELEASE OF 19 April 1986), with +% "footnote" changed to "endnote" and "fn" changed to "en" (where +% appropriate), with all the minipage stuff pulled out, and with +% some small changes for the different operation of endnotes. +% +% Uses an extra external file, with .ENT extension, to hold the +% text of the endnotes. This may be deleted after the run; a new +% version is generated each time. +% +% This code does not obey \nofiles. Perhaps it should. +% +% John Lavagnino (lav@brandeis.bitnet), 9/23/88 +% Department of English and American Literature, +% Brandeis University +% +% To turn all the footnotes in your documents into endnotes, say +% +% \let\footnote=\endnote +% +% in your preamble, and then add something like +% +% \newpage +% \begingroup +% \parindent 0pt +% \parskip 2ex +% \def\enotesize{\normalsize} +% \theendnotes +% \endgroup +% +% as the last thing in your document. +% +% **************************************** +% * CHANGE LOG * +% **************************************** +% +% JL Modified to include \addtoendnotes. JL, 10/22/89. +% +% JK Modification by J"org Knappen 25. 2. 1991: +% JK +% JK Introduced \notesname in the spirit of international \LaTeX. +% JK \notesname is set per default to be {Notes}, but can easily +% JK be redifined, e.g. for german language +% JK \renewcommand{\notesname}{Anmerkungen} +% +% DW Modification by Dominik Wujastyk, London, 19 September 1991: +% DW +% DW Moved the line +% DW \edef\@currentlabel{\csname p@endnote\endcsname\@theenmark} +% DW out of the definition of \@endnotetext and into the definition +% DW of \@doanenote so that \label and \ref commands work correctly in +% DW endnotes. Otherwise, the \label just pointed to the last section +% DW heading (or whatever) preceding the \theendnotes command. +% +% JL Revised documentation and macros. 24 Sept 1991. +% +% **************************************** +% * ENDNOTE COMMANDS * +% **************************************** +% +% +% \endnote{NOTE} : User command to insert a endnote. +% +% \endnote[NUM]{NOTE} : User command to insert a endnote numbered +% NUM, where NUM is a number -- 1, 2, +% etc. For example, if endnotes are numbered +% *, **, etc. within pages, then \endnote[2]{...} +% produces endnote '**'. This command does not +% step the endnote counter. +% +% \endnotemark[NUM] : Command to produce just the endnote mark in +% the text, but no endnote. With no argument, +% it steps the endnote counter before generating +% the mark. +% +% \endnotetext[NUM]{TEXT} : Command to produce the endnote but no +% mark. \endnote is equivalent to +% \endnotemark \endnotetext . +% +% \addtoendnotes{TEXT} : Command to add text or commands to current +% endnotes file: for inserting headings, +% pagebreaks, and the like into endnotes +% sections. TEXT a moving argument: +% \protect required for fragile commands. +% +% **************************************** +% * ENDNOTE USER COMMANDS * +% **************************************** +% +% Endnotes use the following parameters, similar to those relating +% to footnotes: +% +% \enotesize : Size-changing command for endnotes. +% +% \theendnote : In usual LaTeX style, produces the endnote number. +% +% \@theenmark : Holds the current endnote's mark--e.g., \dag or '1' or 'a'. +% +% \@makeenmark : A macro to generate the endnote marker from \@theenmark +% The default definition is \hbox{$^\@theenmark$}. +% +% \@makeentext{NOTE} : +% Must produce the actual endnote, using \@theenmark as the mark +% of the endnote and NOTE as the text. It is called when effectively +% inside a \parbox, with \hsize = \columnwidth. For example, it might +% be as simple as +% $^{\@theenmark}$ NOTE +% +% +% **************************************** +% * ENDNOTE PSEUDOCODE * +% **************************************** +% +% \endnote{NOTE} == +% BEGIN +% \stepcounter{endnote} +% \@theenmark :=G eval (\theendnote) +% \@endnotemark +% \@endnotetext{NOTE} +% END +% +% \endnote[NUM]{NOTE} == +% BEGIN +% begingroup +% counter endnote :=L NUM +% \@theenmark :=G eval (\theendnote) +% endgroup +% \@endnotemark +% \@endnotetext{NOTE} +% END +% +% \@endnotetext{NOTE} == +% BEGIN +% write to \@enotes file: "\@doanenote{ENDNOTE MARK}" +% begingroup +% \next := NOTE +% set \newlinechar for \write to \space +% write to \@enotes file: \meaning\next +% (that is, "macro:->NOTE) +% endgroup +% END +% +% \addtoendnotes{TEXT} == +% BEGIN +% open endnotes file if not already open +% begingroup +% let \protect to \string +% set \newlinechar for \write to \space +% write TEXT to \@enotes file +% endgroup +% END +% +% \endnotemark == +% BEGIN \stepcounter{endnote} +% \@theenmark :=G eval(\theendnote) +% \@endnotemark +% END +% +% \endnotemark[NUM] == +% BEGIN +% begingroup +% endnote counter :=L NUM +% \@theenmark :=G eval(\theendnote) +% endgroup +% \@endnotemark +% END +% +% \@endnotemark == +% BEGIN +% \leavevmode +% IF hmode THEN \@x@sf := \the\spacefactor FI +% \@makeenmark % put number in main text +% IF hmode THEN \spacefactor := \@x@sf FI +% END +% +% \endnotetext == +% BEGIN \@theenmark :=G eval (\theendnote) +% \@endnotetext +% END +% +% \endnotetext[NUM] == +% BEGIN begingroup counter endnote :=L NUM +% \@theenmark :=G eval (\theendnote) +% endgroup +% \@endnotetext +% END +% +% **************************************** +% * ENDNOTE MACROS * +% **************************************** +% + +\@definecounter{endnote} +\def\theendnote{\arabic{endnote}} + +% Default definition +\def\@makeenmark{\hbox{$^{\@theenmark}$}} + +\newdimen\endnotesep + +\def\endnote{\@ifnextchar[{\@xendnote}{\stepcounter + {endnote}\xdef\@theenmark{\theendnote}\@endnotemark\@endnotetext}} + +\def\@xendnote[#1]{\begingroup \c@endnote=#1\relax + \xdef\@theenmark{\theendnote}\endgroup + \@endnotemark\@endnotetext} + +% Here begins endnote code that's really different from the footnote +% code of LaTeX. + +\let\@doanenote=0 +\let\@endanenote=0 + +\newwrite\@enotes +\newif\if@enotesopen \global\@enotesopenfalse + +\def\@openenotes{\immediate\openout\@enotes=\jobname.ent\relax + \global\@enotesopentrue} + +% The stuff with \next and \meaning is a trick from the TeXbook, 382, +% there intended for setting verbatim text, but here used to avoid +% macro expansion when the footnote text is written. \next will have +% the entire text of the footnote as one long line, which might well +% overflow limits on output line length; the business with \newlinechar +% makes every space become a newline in the \@enotes file, so that all +% of the lines wind up being quite short. + +\long\def\@endnotetext#1{% + \if@enotesopen \else \@openenotes \fi + \immediate\write\@enotes{\@doanenote{\@theenmark}}% + \begingroup + \def\next{#1}% + \newlinechar='40 + \immediate\write\@enotes{\meaning\next}% + \endgroup + \immediate\write\@enotes{\@endanenote}} + +% \addtoendnotes works the way the other endnote macros probably should +% have, requiring the use of \protect for fragile commands. + +\long\def\addtoendnotes#1{% + \if@enotesopen \else \@openenotes \fi + \begingroup + \newlinechar='40 + \let\protect\string + \immediate\write\@enotes{#1}% + \endgroup} + +% End of unique endnote code + +\def\endnotemark{\@ifnextchar[{\@xendnotemark + }{\stepcounter{endnote}\xdef\@theenmark{\theendnote}\@endnotemark}} + +\def\@xendnotemark[#1]{\begingroup \c@endnote #1\relax + \xdef\@theenmark{\theendnote}\endgroup \@endnotemark} + +\def\@endnotemark{\leavevmode\ifhmode + \edef\@x@sf{\the\spacefactor}\fi \@makeenmark + \ifhmode\spacefactor\@x@sf\fi\relax} + +\def\endnotetext{\@ifnextchar + [{\@xendnotenext}{\xdef\@theenmark{\theendnote}\@endnotetext}} + +\def\@xendnotenext[#1]{\begingroup \c@endnote=#1\relax + \xdef\@theenmark{\theendnote}\endgroup \@endnotetext} + + +% \theendnotes actually prints out the endnotes. + +% The user may want separate endnotes for each chapter, or a big +% block of them at the end of the whole document. As it stands, +% either will work; you just say \theendnotes wherever you want the +% endnotes so far to be inserted. However, you must add +% \setcounter{endnote}{0} after that if you want subsequent endnotes +% to start numbering at 1 again. + +% \enoteformat is provided so user can specify some special formatting +% for the endnotes. It needs to set up the paragraph parameters, start +% the paragraph, and print the label. The \leavemode stuff is to make +% and undo a dummy paragraph, to get around the games \section* +% plays with paragraph indenting. + +\def\notesname{Notes}% <------ JK +\def\enoteheading{\section*{\notesname + \@mkboth{\uppercase{\notesname}}{\uppercase{\notesname}}}% + \leavevmode\par\vskip-\baselineskip} + +\def\enoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em + \leavevmode\llap{\hbox{$^{\@theenmark}$}}} + +\def\enotesize{\footnotesize} + +% The definition of \ETC. is needed only for versions of TeX prior +% to 2.992. Those versions limited \meaning expansions to 1000 +% characters; in 2.992 and beyond there is no limit. At Brandeis the +% BIGLATEX program changed the code in the token_show procedure of +% TeX to eliminate this problem, but most ``big'' versions of TeX +% will not solve this problem. + +\def\theendnotes{\immediate\closeout\@enotes \global\@enotesopenfalse + \begingroup + \makeatletter + \def\@doanenote##1##2>{\def\@theenmark{##1}\par\begingroup + \edef\@currentlabel{\csname p@endnote\endcsname\@theenmark} %DW + \enoteformat} + \def\@endanenote{\par\endgroup}% + \def\ETC.{\errmessage{Some long endnotes will be truncated; % + use BIGLATEX to avoid this}% + \def\ETC.{\relax}} + \enoteheading + \enotesize + \@input{\jobname.ent}% + \endgroup} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/images/rcnn.png b/images/rcnn.png new file mode 100644 index 0000000..fa313a4 Binary files /dev/null and b/images/rcnn.png differ diff --git a/multirow.sty b/multirow.sty new file mode 100644 index 0000000..2576eb9 --- /dev/null +++ b/multirow.sty @@ -0,0 +1,159 @@ +%% +%% multirow.sty V1.6 version (5-May-2004) +%% +%% Author: Jerry Leichter +%% Piet van Oostrum +%% +%% This file may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1 or, at your option, any later version. +%% +%% V1.0 was distributed anonymously, based on a Usenet posting that was +%% not intended for stand-alone use. +%% V1.1 was modified by Piet van Oostrum to allow it to +%% work without bigstrut.sty. +%% V1.2 was modified by Jerry Leichter for the same goal, but using a +%% different approach which will work properly in conjunction with +%% bigstrut.sty. +%% V1.2a was modified by Piet van Oostrum to use \vskip +%% instead of \raise in positioning, avoiding making rows too high +%% when the adjustment is large. +%% V1.3 was modified by Piet van Oostrum to work properly in a p{} column +%% (\leavevmode added) +%% V1.4 was modified by Piet van Oostrum to check for the special case that +%% the width is given as an *. In this case the natural +%% width of the text argument will be used and the argument +%% is processed in LR-mode. +%% V1.5 was modified by Piet van Oostrum: Added a % after \hbox{#5}\vfill}. +%% Added \struts around #5 for better vertical positioning. +%% Additional coding for negative value of nrows. +%% V1.6 was modified by Piet van Oostrum: Replace a space by \relax after +%% \advance\@tempdima#4. +%% +% Make an entry that will span multiple rows of a table. +% +% \multirow{nrows}[bigstruts]{width}[fixup]{text} +% +% nrows is the number of rows to span. It's up to you to leave the other +% rows empty, or the stuff created by \multirow will over-write it. +% With a positive value of nrows the spanned colomns are this row and +% (nrows-1) rows below it. With a negative value of nrows they are +% this row and (1-nrows) above it. +% +% bigstruts is mainly used if you've used bigstrut.sty. In that case it +% is the total number of uses of \bigstrut within the rows being +% spanned. Count 2 uses for each \bigstrut, 1 for each \bigstrut[x] +% where x is either t or b. The default is 0. +% width is the width to which the text is to be set, or * to indicate that +% the text argument's natural width is to be used. +% +% text is the actual text. If the width was set explicitly, the text will +% be set in a parbox of that width; you can use \\ to force linebreaks +% where you like. +% +% If the width was given as * the text will be set in LR mode. If you +% want a multiline entry in this case you should use a tabular or array +% in the text parameter. +% +% The text is centered vertically within the range spanned by nrows. +% +% fixup is a length used for fine tuning: The text will be raised (or +% lowered, if fixup is negative) by that length above (below) wherever +% it would otherwise have gone. +% +% For example (using both multirow and bigstrut) +% +% \newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} +% \begin{tabular}{|c|c|} +% \hline +% \multirow{4}{1in}{Common g text} & Column g2a\\ +% & Column g2b \\ +% & Column g2c \\ +% & Column g2d \\ +% \hline +% \multirow{3}[6]*{Common g text} & Column g2a\bigstrut\\\cline{2-2} +% & Column g2b \bigstrut\\\cline{2-2} +% & Column g2c \bigstrut\\ +% \hline +% \multirow{4}[8]{1in}{Common g text} & Column g2a\bigstrut\\\cline{2-2} +% & Column g2b \bigstrut\\\cline{2-2} +% & Column g2c \bigstrut\\\cline{2-2} +% & Column g2d \bigstrut\\ +% \hline +% \multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\ +% & Column g2b \\ +% & Column g2c \\ +% & Column g2d \\ +% \hline +% \end{tabular} +% +% If any of the spanned rows are unusually large, or if you're using +% bigstrut.sty and \bigstrut's are used assymetrically about the centerline of +% the spanned rows, the vertical centering may not come out right. Use the +% fixup argument in this case. +% +% Just before "text" is expanded, the \multirowsetup macro is expanded to +% set up any special environment. Initially, \multirowsetup contains just +% \raggedright. It can be redefined with \renewcommand. +% +% Bugs: It's just about impossible to deal correctly with descenders. The +% text will be set up centered, but it may then have a baseline that doesn't +% match the baseline of the stuff beside it, in particular if the stuff +% beside it has descenders and "text" does not. This may result in a small +% missalignment. About all that can be done is to do a final touchup on +% "text", using the fixup optional argument. (Hint: If you use a measure +% like .1ex, there's a reasonable chance that the fixup will still be correct +% if you change the point size.) +% +% \multirow is mainly designed for use with table, as opposed to array, +% environments. It will not work well in an array environment since the lines +% have an extra \jot of space between them which it won't account for. Fixing +% this is difficult in general, and doesn't seem worth it. The bigstruts +% argument can be used to provide a semi-automatic fix: First set +% \bigstrutjot to .5\jot. Then simply repeat nrows as the bigstruts argument. +% This will be close, but probably not exact; you can use the fixup argument +% to refine the result. (If you do this repeatedly, you'll probably want to +% wrap these steps up in a simple macro. Note that the modified \bigstrutjot +% value will not give reasonable results if you have bigstruts and use this +% argument for its intended purpose elsewhere. In that case, you might want +% to set it locally.) +% +% If you use \multirow with the colortbl package you have to take +% precautions if you want to color the column that has the \multirow in it. +% colortbl works by coloring each cell separately. So if you use \multirow +% with a positive nrows value, colortbl will first color the top cell, then +% \multirow will typeset nrows cells starting with this cell, and later +% colortbl will color the other cells, effectively hiding the text in that +% area. This can be solved by putting the \multirow is the last row with a +% negative nrows value. +% Example: +% +% \begin{tabular}{l>{\columncolor{yellow}}l} +% aaaa & \\ +% cccc & \\ +% dddd & \multirow{-3}*{bbbb}\\ +% \end{tabular} +% +\def\multirowsetup{\raggedright} +\def\multirow#1{\relax\@ifnextchar + [{\@multirow{#1}}{\@multirow{#1}[0]}} +\def\@multirow#1[#2]#3{\@ifnextchar [{\@xmultirow{#1}[#2]{#3}}% + {\@xmultirow{#1}[#2]{#3}[0pt]}} +\def\@xmultirow#1[#2]#3[#4]#5{\@tempcnta=#1% + \@tempdima\@tempcnta\ht\@arstrutbox + \advance\@tempdima\@tempcnta\dp\@arstrutbox + \ifnum\@tempcnta<0\@tempdima=-\@tempdima\fi + \advance\@tempdima#2\bigstrutjot + \if*#3\setbox0\vtop to \@tempdima{\vfill\multirowsetup + \hbox{\strut#5\strut}\vfill}% + \else + \setbox0\vtop to \@tempdima{\hsize#3\@parboxrestore + \vfill \multirowsetup \strut#5\strut\par\vfill}% + \fi + \ht0\z@\dp0\z@ + \ifnum\@tempcnta<0\advance\@tempdima-\dp\@arstrutbox + \else\@tempdima=\ht\@arstrutbox + \ifnum#2>0 \advance\@tempdima\bigstrutjot \fi + \fi + \advance\@tempdima#4\relax\leavevmode\vtop{\vskip-\@tempdima\box0\vss}} +\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot \bigstrutjot\jot}{} diff --git a/ref.bib b/ref.bib new file mode 100755 index 0000000..ff7e488 --- /dev/null +++ b/ref.bib @@ -0,0 +1,160 @@ +% Encoding: UTF-8 + +@Article{pacal2021robust, + author = {Pacal, Ishak and Karaboga, Dervis}, + journal = {Computers in Biology and Medicine}, + title = {A Robust Real-Time Deep Learning Based Automatic Polyp Detection System}, + year = {2021}, + issn = {0010-4825}, + month = {jul}, + pages = {104519}, + volume = {134}, + doi = {10.1016/j.compbiomed.2021.104519}, + publisher = {Elsevier}, +} + +@Misc{cancer_keystatistics, + howpublished = {https://www.cancer.org/cancer/colon-rectal-cancer/about/key-statistics.html}, + note = {Accessed: 2021-08-10}, + title = {Key Statistics for Colorectal Cancer}, +} + +@Article{pacal2020comprehensive, + author = {Pacal, Ishak and Karaboga, Dervis and Basturk, Alper and Akay, Bahriye and Nalbantoglu, Ufuk}, + journal = {Computers in Biology and Medicine}, + title = {A comprehensive review of deep learning in colon cancer}, + year = {2020}, + month = {nov}, + pages = {104003}, + volume = {126}, + doi = {10.1016/j.compbiomed.2020.104003}, + publisher = {Elsevier}, +} + + +@Article{Jha_2021, + author = {Jha, Debesh and Ali, Sharib and Tomar, Nikhil Kumar and Johansen, Havard D. and Johansen, Dag and Rittscher, Jens and Riegler, Michael A. and Halvorsen, Pal}, + journal = {IEEE Access}, + title = {Real-Time Polyp Detection, Localization and Segmentation in Colonoscopy Using Deep Learning}, + year = {2021}, + issn = {2169-3536}, + pages = {40496–40510}, + volume = {9}, + doi = {10.1109/access.2021.3063716}, + publisher = {Institute of Electrical and Electronics Engineers (IEEE)}, + url = {http://dx.doi.org/10.1109/ACCESS.2021.3063716}, +} + +@Misc{zaidi2021survey, + author = {Syed Sahil Abbas Zaidi and Mohammad Samar Ansari and Asra Aslam and Nadia Kanwal and Mamoona Asghar and Brian Lee}, + title = {A Survey of Modern Deep Learning based Object Detection Models}, + year = {2021}, + archiveprefix = {arXiv}, + eprint = {2104.11892}, + primaryclass = {cs.CV}, +} + +@InProceedings{girshick2014rich, + author = {Girshick, Ross and Donahue, Jeff and Darrell, Trevor and Malik, Jitendra}, + booktitle = {Proceedings of the IEEE conference on computer vision and pattern recognition}, + title = {Rich feature hierarchies for accurate object detection and semantic segmentation}, + year = {2014}, + month = {jun}, + pages = {580--587}, + publisher = {{IEEE}}, + doi = {10.1109/cvpr.2014.81}, +} + +@Article{nogueira2021deep, + author = {Nogueira-Rodr{\'\i}guez, Alba and Dom{\'\i}nguez-Carbajales, Rub{\'e}n and L{\'o}pez-Fern{\'a}ndez, Hugo and Iglesias, {\'A}gueda and Cubiella, Joaqu{\'\i}n and Fdez-Riverola, Florentino and Reboiro-Jato, Miguel and Glez-Pe{\~n}a, Daniel}, + journal = {Neurocomputing}, + title = {Deep neural networks approaches for detecting and classifying colorectal polyps}, + year = {2021}, + month = {jan}, + pages = {721--734}, + volume = {423}, + doi = {10.1016/j.neucom.2020.02.123}, + publisher = {Elsevier}, +} + +@InProceedings{yolo2016, + author = {Redmon, Joseph and Divvala, Santosh and Girshick, Ross and Farhadi, Ali}, + booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, + title = {You Only Look Once: Unified, Real-Time Object Detection}, + year = {2016}, + month = {June}, + publisher = {{IEEE}}, + doi = {10.1109/cvpr.2016.91}, +} + +@Misc{szegedy2014going, + author = {Christian Szegedy and Wei Liu and Yangqing Jia and Pierre Sermanet and Scott Reed and Dragomir Anguelov and Dumitru Erhan and Vincent Vanhoucke and Andrew Rabinovich}, + month = {jun}, + title = {Going Deeper with Convolutions}, + year = {2014}, + archiveprefix = {arXiv}, + booktitle = {2015 {IEEE} Conference on Computer Vision and Pattern Recognition ({CVPR})}, + doi = {10.1109/cvpr.2015.7298594}, + eprint = {1409.4842}, + primaryclass = {cs.CV}, + publisher = {{IEEE}}, +} + +@Article{ssd, + author = {Liu, Wei and Anguelov, Dragomir and Erhan, Dumitru and Szegedy, Christian and Reed, Scott and Fu, Cheng-Yang and Berg, Alexander C.}, + journal = {Lecture Notes in Computer Science}, + title = {SSD: Single Shot MultiBox Detector}, + year = {2016}, + issn = {1611-3349}, + pages = {21–37}, + booktitle = {Computer Vision {\textendash} {ECCV} 2016}, + doi = {10.1007/978-3-319-46448-0_2}, + isbn = {9783319464480}, + publisher = {Springer International Publishing}, + url = {http://dx.doi.org/10.1007/978-3-319-46448-0_2}, +} + +@Misc{redmon2016yolo9000, + author = {Joseph Redmon and Ali Farhadi}, + month = {jul}, + title = {YOLO9000: Better, Faster, Stronger}, + year = {2016}, + archiveprefix = {arXiv}, + booktitle = {2017 {IEEE} Conference on Computer Vision and Pattern Recognition ({CVPR})}, + doi = {10.1109/cvpr.2017.690}, + eprint = {1612.08242}, + primaryclass = {cs.CV}, + publisher = {{IEEE}}, +} + +@InProceedings{dpm, + author = {Felzenszwalb, Pedro and McAllester, David and Ramanan, Deva}, + booktitle = {2008 IEEE conference on computer vision and pattern recognition}, + title = {A discriminatively trained, multiscale, deformable part model}, + year = {2008}, + month = {jun}, + organization = {Ieee}, + pages = {1--8}, + publisher = {{IEEE}}, + doi = {10.1109/cvpr.2008.4587597}, +} + +@Misc{redmon2018yolov3, + author = {Joseph Redmon and Ali Farhadi}, + title = {YOLOv3: An Incremental Improvement}, + year = {2018}, + archiveprefix = {arXiv}, + eprint = {1804.02767}, + primaryclass = {cs.CV}, +} + +@Misc{bochkovskiy2020yolov4, + author = {Alexey Bochkovskiy and Chien-Yao Wang and Hong-Yuan Mark Liao}, + title = {YOLOv4: Optimal Speed and Accuracy of Object Detection}, + year = {2020}, + archiveprefix = {arXiv}, + eprint = {2004.10934}, + primaryclass = {cs.CV}, +} + +@Comment{jabref-meta: databaseType:bibtex;} diff --git a/seminar.tex b/seminar.tex new file mode 100644 index 0000000..51b51a4 --- /dev/null +++ b/seminar.tex @@ -0,0 +1,194 @@ +\documentclass[11pt]{article} +\usepackage{makecell} +\usepackage{amsfonts} +\usepackage{amsmath} + +\usepackage{MyTemplate} + +\usepackage{endnotes} + +\let\footnote=\endnote + +\newcommand{\پاورقی}[1]{\footnote{\lr{#1}}} +\newcommand{\cols}[1]{ + \begin{tabular}{@{}c@{}} #1 \end{tabular} +} + + +\begin{document} + +\input{title} + + +{\bf {چکيده: }} +روش‌های تشخیص پولیپ به کمک کامپیوتر تأثیر زیادی در کم کردن نرخ عدم تشخیص + +{\bf { واژه‌های کلیدی: }} +تشخیص پولیپ، دسته‌بندی پولیپ، سرطان روده، کولونوسکوپی، تشخیص بی‌درنگ + +\setlength{\parindent}{0.25in} %The indent of the paragraph first line + +\section{مقدمه} +امروزه سرطان یکی از مهم‌ترین بیماری‌هایی است که سلامتی افراد را تحت تاثیر قرار داده است و همچنین نرخ مرگ و میر بالایی نیز دارد. سرطان‌ها بر اساس تومور بدخیم پدید می‌آیند. در تمام انواع سرطان، بعضی سلول‌ها تقسیم می‌شوند و در اطراف پخش می‌شوند +\cite{pacal2020comprehensive}. +سرطان روده سومین عامل مرگ و میر در جهان در بین مردان و دومین عامل مرگ در بین زنان است. +به طور کلی ریسک گرفتن سرطان روده برای مردان +$4.3$ \% +و برای زنان +$4.0$ \% +است +\cite{cancer_keystatistics}. + + + +\section{واژگان تخصصی تحقیق (اختیاری)} + +\paragraph{پولیپ (\lr{Polyp})} +به صورت رشد غیرطبیعی توده‌های خوش‌خیم در جدار اعضای بدن تعریف می‌شود؛ مانند پولیپ روده، معده، بینی و پولیپ رحم. +\textbf{پولیپ، سرطان نیست} +ولی سرطان می‌تواند منشا آن باشد. +پولیپ می‌تواند در هر جایی ظاهر شود ولی معمولا در ناحیه روده ظاهر می‌شوند +\cite{Jha_2021}. +%% Todo: انواع پولیپ +پولیپ به طور کلی در دو دسته نئوپلاستیک +\lr{(neoplastic)} +و غیر نئوپلاستیک +\lr{(non-neoplastic)} +دسته بندی می‌شود. پولیپ‌‌های غیرنئوپلاستیک معمولا سرطانی نیستند و خطری ندارند. این پولیپ‌ها به سه زیردسته هایپرپلاستیک +\lr{(hyper-plastic)} +، +التهابی +\lr{(inflammatory)} +، +همارتوماتوز +\lr{(hamartomatous)} +تقسیم بندی می‌شوند. در سوی دیگر پولیپ‌های نئوپلاستیک هستند که می‌توانند به پولیپ سرطانی تبدیل شوند. این پولیپ‌ها نیز به دو زیردسته +آدنوما +\lr{(adenomas)} +و +دندانه‌دار +\lr{(serrated)} +تقسیم‌بندی می‌شوند +\cite{Jha_2021}. + + +\paragraph{کولونوسکوپی + ( + \lr{Colonoscopy} + ) +} +آزمایشی است که برای تشخیص تغییرات یا موارد غیر عادی در روده بزرگ و رکتوم (راست روده) مورد استفاده قرار می گیرد. +در طول کولونوسکوپی یک لوله طولانی و انعطاف پذیر به نام کولونوسکوپ داخل رکتوم (راست روده) قرار داده می شود. یک دوربین ویدئویی کوچک در بالای لوله وجود دارد که به پزشک اجازه می دهد تا داخل کل روده بزرگ را به خوبی مشاهده کند. در طول کولونوسکوپی، اگر نیاز باشد، پولیپ یا سایر بافت های غیر طبیعی را می توان حذف کرد. + + + + +\section{ادبیات پژوهش} + + + +در مقالات اکثرا از روش‌های مبتنی بر CNN +استفاده شده که روش‌ حل ما نیز بر اساس همان است. شبکه‌های استفاده شده در مقالات +\lr{R-CNN} +، +\lr{Fast R-CNN} +، +\lr{Faster R-CNN} +و +\lr{YOLO} +بوده است. + + + + +به طور کلی روش‌های تشخیص شی دو دسته هستند +\cite{zaidi2021survey}: + +\begin{itemize} + \item + روش های مبتنی بر پردازش تصویر که ویژگی‌ها را بصورت دستی استخراج می‌کنند ولی نیاز به داده برچسب‌دار ندارند. عیب اصلی این روش‌ها این است که در مواجهه با سناریوهای پیچیده‌تر مثل استتار + \پاورقی{occlusion} + کارا نیستند. + \item + روش‌های مبتنی بر یادگیری عمیق که + مبتنی بر یادگیری تقویتی هستند و کارایی آن به قدرت GPU که روی آن پردازش می‌شود نیز بستگی دارد. + این روش‌ها در مواجهه با سناریوهای پیچیده‌تر مثل استتار + و یا نوردهی متفاوت + \پاورقی{illumination} + کاراتر هستند ولی نیاز به داده برچسب‌دهی شده زیادی دارند. +\end{itemize} + +روش‌های مبتنی بر یادگیری عمیق نیز به دو دسته کلی تک مرحله‌ای +\پاورقی{single-stage} +و دومرحله‌ای +\پاورقی{multi-stage} +تقسیم بندی می‌شوند که در ادامه آن‌ها را به تفضیل بررسی خواهیم کرد. +پیش از این توجه داریم که +با توجه به این که روش‌های مبتنی بر پردازش تصویر نمی‌توانند ساختارهای پیچیده‌تر را یاد بگیرند و عموما دقت کمی دارند در این تحقیق بر روی روش‌های مبتنی بر یادگیری عمیق متمرکز خواهیم شد. + + +\subsection{روش های دومرحله‌ای} + +\subsubsection{R-CNN} + +مدل +\lr{R-CNN} +\cite{girshick2014rich} +در سال ۲۰۱۴ +معرفی شد که برای هر تصویر سه مرحله را انجام می‌هد. در این الگوریتم (همان طور که در شکل +\ref{fig:rcnn} +نشان داده شده است +)، ابتدا با استفاده از یک الگوریتم پیشنهاد ناحیه +\lr{(region proposal)} +به نام جستجوی انتخابی +\lr{(selective search)} +تعدادی (تقریبا ۲۰۰۰ تا) ناحیه استخراج می‌شود، سپس نواحی استخراجی از یک شبکه CNN عبور می‌کند و با استفاده از SVM +\پاورقی { + \lr{Support Vector Machine} +} +دسته‌بندی انجام می‌شود. + +اهمیت این شبکه از این لحاظ است که از مدل‌های پیشین خود به طرز شگفت آوری بهتر عمل کرد و mAP را ۳۰ درصد افزایش داد. معایب این روش این است که آموزش شبکه بصورت انتها به انتها انجام نمیشود و یک فرآیند چندمرحله‌ای داریم که باعث کند شدن سرعت شده است. ثانیا آموزش این مدل هم از نظر زمانی و هم از نظر فضای دیسک بسیار هزینه بر است زیرا ویژگی‌ها به ازای هر تصویر استحراج می‌شوند و بر روی دیسک نوشته می‌شوند که باعث اشغال کردن مقدار زیادی فضا می‌شود (در حد چند صد گیگابایت. + +% TODO: \usepackage{graphicx} required +\begin{figure} + \centering + \includegraphics[width=0.7\linewidth]{images/rcnn} + \caption[خلاصه مراحل تشخیص در R-CNN]{} + \label{fig:rcnn} +\end{figure} + + + + +\subsection[تشخیص و دسته‌بندی پولیپ] {تشخیص و دسته‌بندی پولیپ \پاورقی{Polyp detection and classification}} + +نیز در زمره بهترین معماری‌های یادگیری عمیق قرار دارند. در جدول مقایسه + کاملی بین روش‌های قبلی در این زمینه وجود دارد. همان طور که مشخص است تعداد کارهای انجام شده ای که هم تشخیص و هم دسته‌بندی پولیپ را انجام دهند بسیار کم است و در چند سال گذشته نیز کسی روی این زمینه کار نکرده است. + + + +\clearpage +\section{آزمایش‌های اجرا شده} +\input{tables/datasets} + +\linespread{1} +\small +\setlength{\parskip}{0pt} +\setlength{\parsep}{0pt} +\input{bib} + +\newpage + + + + +%\Persian +\section*{واژه‌نامه} +\begin{LTR} +\begin{multicols}{3} +\theendnotes +\end{multicols} +\end{LTR} +\end{document} + diff --git a/tables/datasets.tex b/tables/datasets.tex new file mode 100644 index 0000000..29e7ee4 --- /dev/null +++ b/tables/datasets.tex @@ -0,0 +1,24 @@ + +\begin{table}[] +\centering +\caption{مجموعه دادگان مورد استفاده در پژوهش} +\label{tab:datasets} +\begin{tabular}{cccc} +\hline +مجموعه دادگان & تعداد تصویر یا ویدئو & رزولوشن & کار \\ \hline +\lr{CVC-ClinicDB} & 612 تصویر & SD +، +$384 \times 288$ & تشخیص و مکان‌یابی \\ \hline +\lr{CVC-VideoClinicDB} & 18 ویدئو & SD +، $768 \times 576$ & تشخیص و مکان‌یابی \\ \hline +\lr{Colonoscopy Dataset} & 76 ویدئو & SD +، $768 \times 576$ & دسته بندی \\ \hline +\lr{ETIS-Larib} & 196 تصویر & HD +، $1225 \times 966$ & تشخیص و مکان‌یابی \\ \hline +\lr{Kvasir-SEG} & 1000 تصویر & متفاوت & قطعه‌بندی +%\\ \hline +%\lr{Kvasir} & & & \\ \hline +%\lr{Hyper-Kvasir} & & & +\end{tabular} + +\end{table} \ No newline at end of file diff --git a/title.tex b/title.tex new file mode 100644 index 0000000..ba1bbd9 --- /dev/null +++ b/title.tex @@ -0,0 +1,42 @@ +\thispagestyle{empty} +\begin{center} +\includegraphics{logo} +\vskip 1cm + +\large{ +{\bf +دانشگاه صنعتی شریف\\ دانشکده مهندسی کامپیوتر\\ سمینار کارشناسی ارشد گرایش هوش مصنوعی +} +\\ +\vskip 1cm +عنوان:\\ +{ \bf +تست تست +} +\\{ \bf \large +\lr{ My test }} +\vskip 1cm +نگارش:\\ +\textbf{امیر پورمند} +\\ +\vskip 0.5cm +شماره دانشجویی: \\ +3123123123213 +\\ +\vskip 1cm +استاد راهنما:\\ + \textbf{دکتر } + \\ +\vskip 1cm +استاد ممتحن داخلی:\\ +\textbf{دکتر } +\\ + +\vskip 3.5cm + +} +بهمن ۱۴۰۰ +\newpage +\end{center} + + diff --git a/toi.tex b/toi.tex new file mode 100644 index 0000000..cc9800f --- /dev/null +++ b/toi.tex @@ -0,0 +1,3 @@ +\tableofcontents +\listoffigures +%\listoftables diff --git a/unsrtabbrv.bst b/unsrtabbrv.bst new file mode 100755 index 0000000..9b79554 --- /dev/null +++ b/unsrtabbrv.bst @@ -0,0 +1,959 @@ +%-------------------------------------------------------------- +% +% BibTeX bibliography style `unsrtabbrv' +% Created by mixing unsrt.bst and abbrv.bst. +% +%-------------------------------------------------------------- + + +% BibTeX bibliography style `unsrt+abbrv' + % Version 0.99b (8-Dec-10 release) for BibTeX versions 0.99a or later. + % Copyright (C) 1984, 1985, 1988, 2010 Howard Trickey and Oren Patashnik. + % Unlimited copying and redistribution of this file are permitted as long as + % it is unmodified. Modifications (and redistribution of modified versions) + % are also permitted, but only if the resulting file is renamed to something + % besides btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst. + % This restriction helps ensure that all standard styles are identical. + % The file btxbst.doc has the documentation for this style. + +ENTRY + { address + author + booktitle + chapter + edition + editor + howpublished + institution + journal + key + month + note + number + organization + pages + publisher + school + series + title + type + volume + year + } + {} + { label } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem{" write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { "{\em " swap$ * "}" * } + if$ +} + +INTEGERS { nameptr namesleft numnames } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { ", " * t * } + { numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.authors} +{ author empty$ + { "" } + { author format.names } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names + editor num.names$ #1 > + { ", editors" * } + { ", editor" * } + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title "t" change.case$ } + if$ +} + +FUNCTION {n.dashify} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.date} +{ year empty$ + { month empty$ + { "" } + { "there's a month but no year in " cite$ * warning$ + month + } + if$ + } + { month empty$ + 'year + { month " " * year * } + if$ + } + if$ +} + +FUNCTION {format.btitle} +{ title emphasize +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { "volume" volume tie.or.space.connect + series empty$ + 'skip$ + { " of " * series emphasize * } + if$ + "volume and number" number either.or.check + } + if$ +} + +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + { series field.or.null } + { output.state mid.sentence = + { "number" } + { "Number" } + if$ + number tie.or.space.connect + series empty$ + { "there's a number but no series in " cite$ * warning$ } + { " in " * series * } + if$ + } + if$ + } + { "" } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { edition "l" change.case$ " edition" * } + { edition "t" change.case$ " edition" * } + if$ + } + if$ +} + +INTEGERS { multiresult } + +FUNCTION {multi.page.check} +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { "pages" pages n.dashify tie.or.space.connect } + { "page" pages tie.or.space.connect } + if$ + } + if$ +} + +FUNCTION {format.vol.num.pages} +{ volume field.or.null + number empty$ + 'skip$ + { "(" number * ")" * * + volume empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + } + if$ + pages empty$ + 'skip$ + { duplicate$ empty$ + { pop$ format.pages } + { ":" * pages n.dashify * } + if$ + } + if$ +} + +FUNCTION {format.chapter.pages} +{ chapter empty$ + 'format.pages + { type empty$ + { "chapter" } + { type "l" change.case$ } + if$ + chapter tie.or.space.connect + pages empty$ + 'skip$ + { ", " * format.pages * } + if$ + } + if$ +} + +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { "In " booktitle emphasize * } + { "In " format.editors * ", " * booktitle emphasize * } + if$ + } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ + type "t" change.case$ + } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + 'type + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +FUNCTION {format.article.crossref} +{ key empty$ + { journal empty$ + { "need key or journal for " cite$ * " to crossref " * crossref * + warning$ + "" + } + { "In {\em " journal * "\/}" * } + if$ + } + { "In " key * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {format.crossref.editor} +{ editor #1 "{vv~}{ll}" format.name$ + editor num.names$ duplicate$ + #2 > + { pop$ " et~al." * } + { #2 < + 'skip$ + { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { " et~al." * } + { " and " * editor #2 "{vv~}{ll}" format.name$ * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.book.crossref} +{ volume empty$ + { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + "In " + } + { "Volume" volume tie.or.space.connect + " of " * + } + if$ + editor empty$ + editor field.or.null author field.or.null = + or + { key empty$ + { series empty$ + { "need editor, key, or series for " cite$ * " to crossref " * + crossref * warning$ + "" * + } + { "{\em " * series * "\/}" * } + if$ + } + { key * } + if$ + } + { format.crossref.editor * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {format.incoll.inproc.crossref} +{ editor empty$ + editor field.or.null author field.or.null = + or + { key empty$ + { booktitle empty$ + { "need editor, key, or booktitle for " cite$ * " to crossref " * + crossref * warning$ + "" + } + { "In {\em " booktitle * "\/}" * } + if$ + } + { "In " key * } + if$ + } + { "In " format.crossref.editor * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { journal emphasize "journal" output.check + format.vol.num.pages output + format.date "year" output.check + } + { format.article.crossref output.nonnull + format.pages output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + new.block + format.btitle "title" output.check + crossref missing$ + { format.bvolume output + new.block + format.number.series output + new.sentence + publisher "publisher" output.check + address output + } + { new.block + format.book.crossref output.nonnull + } + if$ + format.edition output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {booklet} +{ output.bibitem + format.authors output + new.block + format.title "title" output.check + howpublished address new.block.checkb + howpublished output + address output + format.date output + new.block + note output + fin.entry +} + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + new.block + format.btitle "title" output.check + crossref missing$ + { format.bvolume output + format.chapter.pages "chapter and pages" output.check + new.block + format.number.series output + new.sentence + publisher "publisher" output.check + address output + } + { format.chapter.pages "chapter and pages" output.check + new.block + format.book.crossref output.nonnull + } + if$ + format.edition output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.chapter.pages output + new.sentence + publisher "publisher" output.check + address output + format.edition output + format.date "year" output.check + } + { format.incoll.inproc.crossref output.nonnull + format.chapter.pages output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.pages output + address empty$ + { organization publisher new.sentence.checkb + organization output + publisher output + format.date "year" output.check + } + { address output.nonnull + format.date "year" output.check + new.sentence + organization output + publisher output + } + if$ + } + { format.incoll.inproc.crossref output.nonnull + format.pages output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull + address output + } + if$ + } + { format.authors output.nonnull } + if$ + new.block + format.btitle "title" output.check + author empty$ + { organization empty$ + { address new.block.checka + address output + } + 'skip$ + if$ + } + { organization address new.block.checkb + organization output + address output + } + if$ + format.edition output + format.date output + new.block + note output + fin.entry +} + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + "Master's thesis" format.thesis.type output.nonnull + school "school" output.check + address output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {misc} +{ output.bibitem + format.authors output + title howpublished new.block.checkb + format.title output + howpublished new.block.checka + howpublished output + format.date output + new.block + note output + fin.entry + empty.misc.check +} + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check + new.block + format.btitle "title" output.check + new.block + "PhD thesis" format.thesis.type output.nonnull + school "school" output.check + address output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output } + { format.editors output.nonnull } + if$ + new.block + format.btitle "title" output.check + format.bvolume output + format.number.series output + address empty$ + { editor empty$ + { publisher new.sentence.checka } + { organization publisher new.sentence.checkb + organization output + } + if$ + publisher output + format.date "year" output.check + } + { address output.nonnull + format.date "year" output.check + new.sentence + editor empty$ + 'skip$ + { organization output } + if$ + publisher output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + format.tr.number output.nonnull + institution "institution" output.check + address output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + note "note" output.check + format.date output + fin.entry +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"Jan."} + +MACRO {feb} {"Feb."} + +MACRO {mar} {"Mar."} + +MACRO {apr} {"Apr."} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"Aug."} + +MACRO {sep} {"Sept."} + +MACRO {oct} {"Oct."} + +MACRO {nov} {"Nov."} + +MACRO {dec} {"Dec."} + +MACRO {acmcs} {"ACM Comput. Surv."} + +MACRO {acta} {"Acta Inf."} + +MACRO {cacm} {"Commun. ACM"} + +MACRO {ibmjrd} {"IBM J. Res. Dev."} + +MACRO {ibmsj} {"IBM Syst.~J."} + +MACRO {ieeese} {"IEEE Trans. Softw. Eng."} + +MACRO {ieeetc} {"IEEE Trans. Comput."} + +MACRO {ieeetcad} + {"IEEE Trans. Comput.-Aided Design Integrated Circuits"} + +MACRO {ipl} {"Inf. Process. Lett."} + +MACRO {jacm} {"J.~ACM"} + +MACRO {jcss} {"J.~Comput. Syst. Sci."} + +MACRO {scp} {"Sci. Comput. Programming"} + +MACRO {sicomp} {"SIAM J. Comput."} + +MACRO {tocs} {"ACM Trans. Comput. Syst."} + +MACRO {tods} {"ACM Trans. Database Syst."} + +MACRO {tog} {"ACM Trans. Gr."} + +MACRO {toms} {"ACM Trans. Math. Softw."} + +MACRO {toois} {"ACM Trans. Office Inf. Syst."} + +MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."} + +MACRO {tcs} {"Theoretical Comput. Sci."} + +READ + +STRINGS { longest.label } + +INTEGERS { number.label longest.label.width } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #1 'number.label := + #0 'longest.label.width := +} + +FUNCTION {longest.label.pass} +{ number.label int.to.str$ 'label := + number.label #1 + 'number.label := + label width$ longest.label.width > + { label 'longest.label := + label width$ 'longest.label.width := + } + 'skip$ + if$ +} + +EXECUTE {initialize.longest.label} + +ITERATE {longest.label.pass} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" longest.label * "}" * write$ newline$ +} + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +EXECUTE {end.bib}