static char *RCSid="$Id: tape_gen_wprocess.c,v 1.1 2000/01/17 19:30:35 jwm Exp $"; /*********************************************************************** tape_gen_wprocess.c ********************************************************************** Description: Skeleton of RTOG format image file writing and exch_file_t node filling. Functions included are: wprocess_comment Process comment files wprocess_ct Process CT files wprocess_mrus Process MR or US files wprocess_structure Process anatomic structure files wprocess_beam Process all beams for a TELE plan wprocess_seed Process seeds for a SEED plan wprocess_dvh Process all DVH's for a TELE plan wprocess_sdvh Process all DVH's for a SEED plan wprocess_film Process all digital films for plan wprocess_dose Process doses for a given TELE plan wprocess_sdose Process doses for a given SEED plan Revision History: $Log: tape_gen_wprocess.c,v $ * Revision 1.1 2000/01/17 19:30:35 jwm * Upgrade generic version to 4.00 standard * * Revision 1.0 2000/01/17 15:37:27 jwm * Initial revision **********************************************************************/ /* DISABLE SOME INCLUSIONS */ #define NOT_MAIN /* Include Files */ #include #include #include #include #include #include #include #include #include #include #include "sitedata.h" #include "exchkeys.h" #include "patexchange.h" #include "writexch.h" /************************************************************** wprocess_comment() ************************************************************* Function Description: Reads in a comment file for a patient and reformats it to match the RTOG tape exchange format while building the directory entry structure node for the file. *************************************************************/ exch_file_t *wprocess_comment ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *file_number /* NUMBER OF THIS FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ /* PROGRESS MESSAGE */ sprintf( aapm_log_string, "Processing comment file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* INCREMENT THE FILE NUMBER */ *file_number += 1; /* RETURN STATUS */ return( cur_file ); } /********************* End of wprocess_comment() *****************/ /************************************************************** wprocess_ct() ************************************************************* Function Description: Reads in a ct file for a patient and reformats it to match the RTOG tape exchange format while building the directory entry structure node for the file. ************************************************************/ exch_file_t *wprocess_ct ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *file_number /* NUMBER OF THIS FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Processing ct file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* INCREMENT THE FILE NUMBER */ *file_number += 1; /* RETURN POINTER TO CURRENT LINKED LIST NODE */ return( cur_node ); } /********************* End of wprocess_ct() *********************/ /* */ /************************************************************** wprocess_mrus() ************************************************************* Functional Description: Reads in an MR or US file for a patient and reformats it to match the RTOG exchange format while building the directory entry structure node for the file. ************************************************************/ exch_file_t *wprocess_mrus ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *file_number /* NUMBER OF THIS FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ char ftype[4]; /* HOLDS FILE DESCRIPTOR (MR OR US) */ cur_node = cur_file; /* DISTINGUISH MR OR US */ if(cur_file->image_flag == eMRISCAN) { strcpy( (char *)&ftype, "MR" ); } else if(cur_file->image_flag == eUSSCAN) { strcpy( (char *)&ftype, "US" ); } else { sprintf( aapm_log_string, "Unknown image_flag in wprocess_mrus" ); aapm_status( eAAPM_ERROR, aapm_log_string ); return( NULL ); } sprintf( aapm_log_string, "Processing %s file #%d", ftype, cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); return( cur_node ); } /********************* End of wprocess_mrus() *********************/ /************************************************************** wprocess_structure() ************************************************************* Function Description: Reads in an anatomic structure file for a patient and reformats it to match the RTOG tape exchange format while building the directory entry structure node for the file. ************************************************************/ exch_file_t *wprocess_structure ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *file_number /* NUMBER OF THIS FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Processing structure file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* INCREMENT THE FILE NUMBER */ *file_number += 1; /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_structure() ****************/ /************************************************************** wprocess_beam() ************************************************************* Function Description: Reads in plan file for a patient and reformats the beam data to match the RTOG tape exchange format while building the directory entry structure node for the file(s). If more than one beam per plan, this may insert additional exch_file_t nodes in the linked list. ************************************************************/ exch_file_t *wprocess_beam ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *plan_number /* NUMBER OF THIS PLAN FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Processing beam file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); fflush( stdout ); aapm_status( eAAPM_INFO, aapm_log_string ); /* INCREMENT BEAM/PLAN NUMBER */ *plan_number += 1; /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_beam() *****************/ /************************************************************** wprocess_seed() ************************************************************* Functional Description: Reads in plan file for a patient and reformats the seed data to match the RTOG exchange format while building the directory entry structure node for the file. ************************************************************/ exch_file_t *wprocess_seed ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *plan_number /* NUMBER OF THIS PLAN FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Processing SEED file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); fflush( stdout ); aapm_status( eAAPM_INFO, aapm_log_string ); /* INCREMENT BEAM/PLAN NUMBER */ *plan_number += 1; /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_seed() *****************/ /************************************************************** wprocess_dvh() ************************************************************* Function Description: Reads in DVH data file for a patient and formats it for output in the RTOG tape exchange format. ************************************************************/ exch_file_t *wprocess_dvh ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *plan_number /* NUMBER OF THIS PLAN FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Process dvh file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_dvh() **************************/ /* */ /************************************************************** wprocess_sdvh() ************************************************************* Functional Description: Reads in DVH data file for a SEED plan and formats it for output in the RTOG tape exchange format. ************************************************************/ exch_file_t *wprocess_sdvh ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *plan_number /* NUMBER OF THIS PLAN FILE */ ) { exch_file_t *cur_node; /* DIRECTORY FOR WALKING LINKED LIST */ /* SET LOCAL COPY OF FILE POINTER */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Process SEED DVH file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_sdvh() *****************/ /************************************************************** wprocess_film() ************************************************************* Function Description: Reads in a digital film file for a patient and reformats it to match the AAPM tape exchange format while building the directory entry structure node for the file. ************************************************************/ exch_file_t *wprocess_film ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *film_number, /* FILM ID INDEX NUMBER */ int *plan_number /* NUMBER OF THIS PLAN FILE IN SITE_DATA */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Processing film file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_film() *****************/ /************************************************************** wprocess_dose() ************************************************************* Function Description: Reads in a dose file for a patient and reformats it to match the AAPM tape exchange format while building the directory entry structure node for the file. ************************************************************/ exch_file_t *wprocess_dose ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *file_number /* NUMBER OF THIS FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Processing dose file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_dose() *********************/ /************************************************************** wprocess_sdose() ************************************************************* Functional Description: Reads in a dose file for a SEED plan and reformats it to match the RTOG tape exchange format while building the directory entry structure node for the file. ************************************************************/ exch_file_t *wprocess_sdose ( exch_file_t *cur_file, /* DIRECTORY STRUCTURE NODE TO FILL */ case_t *patcase, /* PATIENT CASE STRUCTURE POINTER */ tapedir_t *tape, /* TAPE DIRECTORY STRUCTURE */ int *file_number /* NUMBER OF THIS FILE */ ) { exch_file_t *cur_node; /* CURRENT exch_file_t POINTER TO HANDLE INSERTIONS */ cur_node = cur_file; /* LET USER KNOW WHAT'S GOING ON */ sprintf( aapm_log_string, "Processing SEED dose file #%d", cur_file->image_number ); aapm_status( eAAPM_INFO, aapm_log_string ); /* RETURN A POINTER TO THE CURRENT EXCH_FILE_T NODE AS NODES MAY HAVE BEEN INSERTED BY THIS ROUTINE */ return( cur_node ); } /********************* End of wprocess_sdose() ************************/ /******************** End of tape_gen_wprocess.c ******************/