/*
Copyright (C) 1993, 1994, RSNA and Washington University
The software and supporting documentation for the Radiological
Society of North America (RSNA) 1993, 1994 Digital Imaging and
Communications in Medicine (DICOM) Demonstration were developed
at the
Electronic Radiology Laboratory
Mallinckrodt Institute of Radiology
Washington University School of Medicine
510 S. Kingshighway Blvd.
St. Louis, MO 63110
as part of the 1993, 1994 DICOM Central Test Node project for, and
under contract with, the Radiological Society of North America.
THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER RSNA NOR
WASHINGTON UNIVERSITY MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS
PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY
SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF
THE SOFTWARE IS WITH THE USER.
Copyright of the software and supporting documentation is
jointly owned by RSNA and Washington University, and free access
is hereby granted as a license to use this software, copy this
software and prepare derivative works based upon this software.
However, any distribution of this software source code or
supporting documentation or derivative works (source code and
supporting documentation) must include the three paragraphs of
the copyright notice.
*/
/* Copyright marker. Copyright will be inserted above. Do not remove */
/*
** DICOM 93
** Electronic Radiology Laboratory
** Mallinckrodt Institute of Radiology
** Washington University School of Medicine
**
** Module Name(s): DCM_OpenFile
** DCM_CreateObject
** DCM_CloseObject
** DCM_AddElement
** DCM_AddSequenceElement
** DCM_RemoveElement
** DCM_GetElementValue
** DCM_GetElementSize
** DCM_ScanParseObject
** DCM_ImportStream
** DCM_ExportStream
** DCM_GetObjectSize
** DCM_DumpElements
** DCM_Debug
** DCM_WriteFile
** DCM_ModifyElements
** DCM_ParseObject
** DCM_RemoveGroup
** DCM_GetSequenceList
** DCM_ComputeExportSize
** private functions
** newElementItem
** findCreateGroup
** insertNewElement
** updateObjectType
** updateSpecialElements
** exportFixedFields
** exportData
** fileSize
** swapInPlace
** checkObject
** writeFile
** countBytes
** exportStream
** verifyFormat
** readFile
** Author, Date: Stephen M. Moore, 26-Apr-93
** Intent:
** This file contains the routines which implement a facility for
** manipulating DICOM V3 information objects. These routines parse
** and construct NEMA objects (or streams). Users are able to
** read/write/examine individual attributes. The package uses those
** individual elements to construct an internal memory representation of
** an object. This representation is a linked list of the individual
** attributes. The user of the package can add attributes to an object,
** remove an element from an object, query the object about an attribute,
** and convert the object to and from its "stream" representation.
** In addition, the package can parse a file which contains a stream
** and create its internal object.
** Last Update: $Author: smm $, $Date: 2002/12/13 15:11:24 $
** Source File: $RCSfile: dcm.c,v $
** Revision: $Revision: 1.161 $
** Status: $State: Exp $
*/
static char rcsid[] = "$Revision: 1.161 $ $RCSfile: dcm.c,v $";
#include "ctn_os.h"
#include "dicom.h"
#include "condition.h"
#include "lst.h"
#include "dicom_uids.h"
#include "dicom_objects.h"
#include "dcmprivate.h"
#define BYTEORDER_SAME 1
#define BYTEORDER_REVERSE 2
#define NATIVE_ORDER BYTEORDER_SAME
#ifdef BIG_ENDIAN_ARCHITECTURE
#define LITTLE_ORDER BYTEORDER_REVERSE
#define BIG_ORDER BYTEORDER_SAME
#endif
#ifdef LITTLE_ENDIAN_ARCHITECTURE
#define LITTLE_ORDER BYTEORDER_SAME
#define BIG_ORDER BYTEORDER_REVERSE
#endif
static CTNBOOLEAN debug = FALSE;/* Flag for debugging messages to stdout */
/* Prototypes for internal functions
*/
static CONDITION
newElementItem(DCM_ELEMENT * src, CTNBOOLEAN allocateData,
PRV_ELEMENT_ITEM ** dst);
static CONDITION
findCreateGroup(PRIVATE_OBJECT ** object, unsigned short group,
PRV_GROUP_ITEM ** groupPtr);
static CONDITION
insertNewElement(PRIVATE_OBJECT ** object,
DCM_ELEMENT * element);
static CONDITION
updateObjectType(PRIVATE_OBJECT ** object,
DCM_ELEMENT * element);
static CONDITION
updateSpecialElements(PRIVATE_OBJECT ** object,
PRV_ELEMENT_ITEM * item);
static void
exportFixedFields(DCM_ELEMENT * element,
unsigned char *b, U32 length, int byteOrder,
CTNBOOLEAN explicitVR, U32 * rtnLength);
static CONDITION
exportData(PRIVATE_OBJECT ** object, PRV_ELEMENT_ITEM * item,
unsigned char *src,
unsigned char *dst, U32 length, int byteOrder,
U32 * rtnLength);
#ifdef MACOS
static long fileSize(int fd);
#else
static int fileSize(int fd);
#endif
static void swapInPlace(PRIVATE_OBJECT ** object, DCM_ELEMENT * e);
static CONDITION checkObject(PRIVATE_OBJECT ** object, char *caller);
static CONDITION
writeFile(void *buffer, U32 length, int flag, void /* int */ *fd);
static CONDITION
countBytes(void *buffer, U32 length, int flag,
void /* unsigned long */ *sizePtr);
static CONDITION
exportStream(DCM_OBJECT ** callerObject, unsigned long opt,
void *buffer, U32 bufferlength, CONDITION(*callback) (),
void *ctx, int sequenceLevel);
static CONDITION
verifyFormat(PRV_ELEMENT_ITEM * item);
#if 0
static CONDITION
readFile(char *name, unsigned char *callerBuf, int fd, long size,
off_t fileOffset, int recursionLevel,
unsigned long opt, DCM_OBJECT ** callerObject,
U32 * scannedLength, CTNBOOLEAN * remainOpenFlag,
void *ctx,
CONDITION(*rd) (void *ctx, void *buf, int toRead, int *bytesRead),
CONDITION(*sk) (void *ctx, int offset, int flag));
#endif
static CONDITION
readFile1(const char *name, unsigned char *callerBuf, int fd, U32 size,
off_t * fileOffset, int recursionLevel,
unsigned long opt, PRIVATE_OBJECT ** parentObject,
DCM_OBJECT ** callerObject,
U32 * scannedLength, CTNBOOLEAN * remainOpenFlag,
void *ctx,
CONDITION(*rd) (void *ctx, void *buf, int toRead, int *bytesRead),
CONDITION(*sk) (void *ctx, int offset, int flag));
static PRV_ELEMENT_ITEM *locateElement(PRIVATE_OBJECT ** obj, DCM_TAG tag);
static void computeVM(PRIVATE_OBJECT ** object, DCM_ELEMENT * element);
static void ctxSensitiveLookup(PRIVATE_OBJECT ** object, DCM_ELEMENT * element);
static CONDITION
copyData(PRIVATE_OBJECT ** object, PRV_ELEMENT_ITEM * item,
DCM_ELEMENT * to, U32 * rtnLength);
static CONDITION
readLengthToEnd(int fd, const char *fileName,
unsigned long opt, U32 * lengthToEnd);
#ifdef LITTLE_ENDIAN_ARCHITECTURE
static void swapATGroupElement(DCM_ELEMENT * e);
#endif
static void
dumpBinaryData(void *d, DCM_VALUEREPRESENTATION vr,
long vm, long vmLimit);
static void
compareGroup(PRV_GROUP_ITEM * g1, PRV_GROUP_ITEM * g2,
void (*callback) (const DCM_ELEMENT * e1,
const DCM_ELEMENT * e2,
void *ctx),
void *ctx);
static void remapFileName(const char *name, char *mapName);
/* DCM_OpenFile
**
** Purpose:
** This function opens a file that conforms to the DICOM V3 standard.
** The file is parsed and an internal representation of the data is created.
** A handle is returned to the caller to allow access to the data.
**
** Parameter Dictionary:
** name ASCIZ string giving path name to file to be opened.
** opt BITMASK giving options used when opening file and
**
没有合适的资源?快使用搜索试试~ 我知道了~
ctn-3.0.6
共1193个文件
c:390个
h:251个
makefile:141个
需积分: 0 16 下载量 178 浏览量
2008-05-23
16:38:23
上传
评论
收藏 2.49MB ZIP 举报
温馨提示
dicom标准C语言开发库
资源详情
资源评论
资源推荐
收起资源包目录
ctn-3.0.6 (1193个子文件)
irun.11.5.1 331B
create_icons.94 4KB
add-accession-numbers 604B
copy_release.bat 2KB
copy_debug.bat 2KB
headerexport.bat 2KB
ctn_binary_install.bat 1KB
createdirectory.bat 203B
w32_env.bat 155B
dcm.c 206KB
idb.c 200KB
database.c 142KB
dcmdict.c 124KB
hisdb.c 124KB
dulfsm.c 117KB
sequences.c 104KB
javactn.c 89KB
tbl_sqlserver.c 82KB
dulprotocol.c 81KB
services.c 63KB
image_utils.c 57KB
ie.c 57KB
simple_storage.c 57KB
messages.c 57KB
verify.c 54KB
print_shared.c 54KB
tbl_sybase.c 54KB
image_utils.c 53KB
build.c 50KB
print_shared.c 49KB
tbl_psql.c 49KB
databaseForm.c 48KB
dicom_chr.c 47KB
fisget.c 47KB
filmBoxForm.c 46KB
client_support.c 46KB
dulsnoop.c 45KB
tbl_mysql.c 41KB
lex_mod.c 40KB
tbl_msql.c 40KB
lex_mod.c 40KB
sybase.c 39KB
topLevelShell1.c 39KB
archive_cgi.c 38KB
get.c 38KB
dulconstruct.c 38KB
dump.c 38KB
hunk_man.c 36KB
set.c 35KB
icon.c 35KB
srv1.c 34KB
print.c 33KB
create.c 32KB
hunk_file.c 32KB
fileview.c 32KB
topLevelShell1.c 30KB
spray_image.c 30KB
display_icon.c 30KB
parse.c 29KB
dcm_map_to_8.c 29KB
snp.c 29KB
gq.c 29KB
srv2.c 28KB
select.c 28KB
applicationShell1.c 28KB
parseMB.c 28KB
ctndisp_x_support.c 28KB
filmSessionForm.c 27KB
topLevelShell1.c 27KB
requests.c 26KB
applicationShell1.c 26KB
print_mgr.c 26KB
control.c 26KB
query_interface.c 25KB
utils.c 24KB
gram_mod_w32.c 24KB
gram_mod.c 24KB
fisinsert.c 24KB
dcm_verify.c 24KB
gram_mod.c 24KB
move.c 24KB
queryCTN.c 24KB
hapbuildstudy.c 23KB
parse.c 23KB
utility.c 23KB
applicationShell1.c 23KB
uid.c 23KB
storage.c 23KB
UxXt.c 22KB
UxXt.c 22KB
UxXt.c 22KB
UxXt.c 22KB
UxXt.c 22KB
UxXt.c 22KB
UxXt.c 22KB
UxXt.c 22KB
find.c 22KB
send_image.c 22KB
cmd_valid.c 22KB
move.c 22KB
共 1193 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
CragHacK
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0