** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: ctndicom.cpp,v 1.3 2001/03/02 02:08:14 kevin Exp $
+** $Id: ctndicom.cpp,v 1.4 2001/03/02 05:10:22 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
}
m_iContents = DICOM_CONTENTS_PROJECTIONS;
m_pProjections = new Projections;
- m_pProjections->initFromSomatomAR_STAR (iNViews, iNDets, pRawProjections, lRtnLength);
+ if (! m_pProjections->initFromSomatomAR_STAR (iNViews, iNDets, pRawProjections, lRtnLength)) {
+ m_bFail = true;
+ m_strFailMessage = "Error converting raw projection data";
+ delete m_pProjections;
+ m_pProjections = NULL;
+ }
+
delete pRawProjections;
}
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.51 2001/03/02 02:08:14 kevin Exp $
+** $Id: projections.cpp,v 1.52 2001/03/02 05:10:22 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pData, unsigned long lDataLength)
{
init (iNViews, iNDets);
+ m_geometry = Scanner::GEOMETRY_EQUIANGULAR;
+ m_dFanBeamAngle = iNDets * convertDegreesToRadians (3.06976 / 60);
+ m_dFocalLength = 51;
+ m_dSourceDetectorLength = 89;
+ m_detInc = convertDegreesToRadians (3.06976 / 60);
+ m_detStart = -m_dFanBeamAngle / 2;
+ m_rotInc = TWOPI / static_cast<double>(iNViews);
+ m_rotStart = 0;
+ m_dViewDiameter = sin (m_dFanBeamAngle / 2) * m_dFocalLength * 2;
if (iNDets != 1024)
return false;
- if (iNViews == 750 &&
+ bool bValid = (iNViews == 750 && lDataLength == 1560000L) || (iNViews == 950 && lDataLength == 1976000L) || (iNViews == 1500 && lDataLength == 3120000);
+ if (! bValid)
+ return false;
+
+ long lDataPos = 0;
+ for (int iv = 0; iv < iNViews; iv++) {
+ long* pLong = reinterpret_cast<long*>(pData + lDataPos+0);
+#ifndef WORDS_BIGENDIAN
+ SwapBytes4 (pLong);
+#endif
+ long lProjNumber = *pLong;
+
+ pLong = reinterpret_cast<long*>(pData + lDataPos+20);
+#ifndef WORDS_BIGENDIAN
+ SwapBytes4 (pLong);
+#endif
+ long lEscale = *pLong;
+
+ pLong = reinterpret_cast<long*>(pData + lDataPos+28);
+#ifndef WORDS_BIGENDIAN
+ SwapBytes4 (pLong);
+#endif
+ long lTime = *pLong;
+
+ float* pFloat = reinterpret_cast<float*>(pData + lDataPos+4);
+#ifndef WORDS_BIGENDIAN
+ SwapBytes4 (pFloat);
+#endif
+ double dAlpha = *pFloat;
+
+ pFloat = reinterpret_cast<float*>(pData + lDataPos+12);
+#ifndef WORDS_BIGENDIAN
+ SwapBytes4 (pFloat);
+#endif
+ double dAlign = *pFloat;
+
+ pFloat = reinterpret_cast<float*>(pData + lDataPos+16);
+#ifndef WORDS_BIGENDIAN
+ SwapBytes4 (pFloat);
+#endif
+ double dMaxValue = *pFloat;
+
+ lDataPos += 32;
+ double dEScale = pow (2.0, -lEscale);
+ double dBetaInc = convertDegreesToRadians (3.06976 / 60);
+ int iCenter = (iNDets + 1) / 2;
+
+ DetectorArray& detArray = getDetectorArray( iv );
+ detArray.setViewAngle (dAlpha);
+ DetectorValue* detval = detArray.detValues();
+
+ double dTempScale = 2294.4871 * dEScale;
+ for (int id = 0; id < iNDets; id++) {
+ int iV = pData[lDataPos+1] + 256 * pData[lDataPos];
+ if (iV > 32767)
+ iV = iV - 65536;
+ double dCosScale = cos ((id + 1 - iCenter) * dBetaInc);
+ detval[id] = iV / (dTempScale * dCosScale);
+ lDataPos += 2;
+ }
+ }
+
+ return true;
}
--------------------Configuration: libctsim - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BC.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP6F.tmp" with contents
[
/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "..\..\..\wx2.2.5\src\png" /I "..\..\..\wx2.2.5\src\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2.2.5\include" /I "\dicom\ctn\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "HAVE_CTN_DICOM" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
-"C:\ctsim\libctsim\backprojectors.cpp"
-"C:\ctsim\libctsim\ctndicom.cpp"
-"C:\ctsim\libctgraphics\dlgezplot.cpp"
-"C:\ctsim\libctsim\filter.cpp"
-"C:\ctsim\libctsim\fourier.cpp"
-"C:\ctsim\libctsim\globalvars.cpp"
-"C:\ctsim\libctsupport\hashtable.cpp"
-"C:\ctsim\libctsim\imagefile.cpp"
-"C:\ctsim\libctsim\phantom.cpp"
-"C:\ctsim\libctsupport\plotfile.cpp"
-"C:\ctsim\libctgraphics\pol.cpp"
-"C:\ctsim\libctsim\procsignal.cpp"
"C:\ctsim\libctsim\projections.cpp"
-"C:\ctsim\libctsim\reconstruct.cpp"
-"C:\ctsim\libctsim\scanner.cpp"
-"C:\ctsim\libctsupport\syserror.cpp"
-"C:\ctsim\libctsim\trace.cpp"
]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BC.tmp"
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BD.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP6F.tmp"
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP70.tmp" with contents
[
/nologo /out:"Debug\libctsim.lib"
.\Debug\array2dfile.obj
.\Debug\transformmatrix.obj
.\Debug\xform.obj
]
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BD.tmp"
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP70.tmp"
<h3>Output Window</h3>
Compiling...
-ctndicom.cpp
projections.cpp
-Skipping... (no relevant changes detected)
-backprojectors.cpp
-dlgezplot.cpp
-filter.cpp
-fourier.cpp
-globalvars.cpp
-hashtable.cpp
-imagefile.cpp
-phantom.cpp
-plotfile.cpp
-pol.cpp
-procsignal.cpp
-reconstruct.cpp
-scanner.cpp
-syserror.cpp
-trace.cpp
Creating library...
<h3>
--------------------Configuration: ctsim - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BE.tmp" with contents
-[
-/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /I "\dicom\ctn\include" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.1.0\" /D "HAVE_CTN_DICOM" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
-"C:\ctsim\src\backgroundmgr.cpp"
-"C:\ctsim\src\backgroundsupr.cpp"
-"C:\ctsim\src\graph3dview.cpp"
-"C:\ctsim\src\threadproj.cpp"
-"C:\ctsim\src\threadraster.cpp"
-"C:\ctsim\src\threadrecon.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BE.tmp"
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BF.tmp" with contents
-[
-/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /I "\dicom\ctn\include" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.1.0\" /D "HAVE_CTN_DICOM" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
-"C:\ctsim\src\ctsim.cpp"
-"C:\ctsim\src\dialogs.cpp"
-"C:\ctsim\src\dlgprojections.cpp"
-"C:\ctsim\src\dlgreconstruct.cpp"
-"C:\ctsim\src\docs.cpp"
-"C:\ctsim\src\views.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BF.tmp"
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1C0.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP71.tmp" with contents
[
winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib ctn_lib.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Debug"
.\Debug\backgroundmgr.obj
\wx2.2.5\lib\zlibd.lib
\wx2.2.5\lib\tiffd.lib
]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1C0.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP71.tmp"
<h3>Output Window</h3>
-Compiling...
-backgroundmgr.cpp
-Skipping... (no relevant changes detected)
-backgroundsupr.cpp
-graph3dview.cpp
-threadproj.cpp
-threadraster.cpp
-threadrecon.cpp
-Compiling...
-ctsim.cpp
-Skipping... (no relevant changes detected)
-dialogs.cpp
-dlgprojections.cpp
-dlgreconstruct.cpp
-docs.cpp
-views.cpp
Linking...