Summary of the invention
The technical problem that the present invention will solve provides the implementation method of a kind of three-dimensional image server and client communication, overcomes prior art and reads the defective that the sheet work station is not suitable for carrying out three-dimensional image reconstruction.
The present invention solves the problems of the technologies described above the technical scheme that is adopted to be:
The implementation method of a kind of three-dimensional image server and client communication comprises step:
A1, three-dimensional image server and client are set up the command channel respectively through privately owned communication protocol and are connected with data channel and are connected;
A2, said client are registered said command channel and said data channel to said three-dimensional image server;
A3, said three-dimensional image server and said client are transmitted interactive command and operating parameter through said command channel;
A4, said three-dimensional image server carry out 3-dimensional reconstruction and generate 3 d image data according to said operating parameter;
A5, said three-dimensional image server send said 3 d image data through said data channel to said client;
A6, said three-dimensional image server and said client are broken off said command channel and are connected with said data channel and are connected.
The implementation method of described three-dimensional image server and client communication; Wherein in said three-dimensional image server, set up corresponding server-side processes process, at in-process server end command channel processing threads, server end data channel processing threads and the task processing threads of being provided with of said server-side processes.
The implementation method of described three-dimensional image server and client communication; Wherein set up corresponding client process process, at in-process Client command passage processing threads, client data passage processing threads and the user interactions thread of being provided with of said client process in said client.
The implementation method of described three-dimensional image server and client communication, wherein said task processing threads and said server end command channel processing threads transmit information through message queue.
The implementation method of described three-dimensional image server and client communication, wherein said task processing threads and said server end data channel processing threads transmit information through message queue.
The implementation method of described three-dimensional image server and client communication, wherein said user interactions thread and said Client command passage processing threads transmit information through message queue.
The implementation method of described three-dimensional image server and client communication, wherein said user interactions thread and said client data passage processing threads transmit information through message queue.
The implementation method of described three-dimensional image server and client communication, wherein said privately owned communication protocol is made as the application layer protocol of ICP/IP protocol.
The implementation method of described three-dimensional image server and client communication; Wherein said three-dimensional image server and said client be through service class data packet delivery interactive command, at the head of said service class packet communication information common headers data structure and parameter Data transmission structure is set.
The implementation method of described three-dimensional image server and client communication, wherein said service class packet is made as string format.
Beneficial effect of the present invention: the implementation method of three-dimensional image server of the present invention and client communication focuses on three-dimensional visualization computational process by three-dimensional image server; Then three-dimensional visualization result of calculation is delivered to read on the sheet work station in real time and shows real-time response user's operational motion.Because three-dimensional visualization result of calculation is exactly bitmap, data volume is little, can on network, transmit in real time fully.Adopt technical scheme of the present invention; Not only can avoid downloading the time of two-dimensional ct image data cost; And can make full use of the computing capability of three-dimensional image server, common like this computer is connected to can be read the sheet work station as three-dimensional specialty behind the three-dimensional image server and use.
Embodiment
According to accompanying drawing and embodiment the present invention is done further explain below:
As shown in Figure 1; Image documentation equipment is responsible for image data; Data are sent to storage server files; The data load of after storage server is filed data needs being rebuild is carried out preliminary treatment to three-dimensional image server; When three-dimensional is read sheet work station (client) and need be read sheet, send the request of processing to three-dimensional image server, three-dimensional image server calculates data load after receiving Processing tasks in internal memory, then result of calculation is returned and is read the sheet work station to three-dimensional and show.
In order to realize above-mentioned 3-D view processing mode, at first must read and set up privately owned communication protocol between the sheet work station in three-dimensional image server and three-dimensional, realize mutual information interaction.On ICP/IP protocol, set up an application layer protocol 3DAP (3D Access Protocol) for this reason; Just can the operation requests of client be submitted to three-dimensional image server through this application layer protocol 3DAP and handle, three-dimensional image server can turn back to client with result of calculation equally and show.
As shown in table 1, at first define one group of service class:
Table 1
Service class |
Explanation |
FM_CONTROL |
The request service connects |
FM_EXECUTE |
Carry out an operational order |
FM_EXECUTE_RESPONSE |
The return command result |
FM_GET_FILE |
Obtain flow data |
FM_GET_FILE_RESPONSE |
Return and obtain the flow data result |
FM_PUT_FILE |
Submit flow data to |
FM_PUT_FILE_RESPONSE |
Return and submit the flow data result to |
As shown in table 2, service class definition has been arranged after, also need use and the concrete condition of confirming to handle for each service class defines corresponding processing messages:
Table 2
Application layer protocol 3DAP has been arranged, just can carry out exchanges data flexibly between client and the three-dimensional image server.Concrete operation mainly is divided into five big steps:
The first step: connect, promptly set up the communication pipe of bottom.Rule and definition according to the front description; Client is used top service; Send the related request FM_CONTROL (FMMC_CONNECT) that sets up to three-dimensional image server; Three-dimensional image server is accepted and should be asked, and sets up acceptance/refusal FM_CONTROL (FMMC_ACCEPT/FMMC_REJECT) response after the legitimacy of three-dimensional image server checking client.If success, promptly client is received FM_CONTROL (FMMC_ACCEPT), representes that then the association between client and the three-dimensional image server is set up successfully.
Second step: send execution of command operations, promptly client is sent fill order to three-dimensional image server.Client is followed bilateral agreement; Send the FM_EXECUTE request to three-dimensional image server; User's operating parameter is bundled in the FM_EXECUTE service class, is submitted on the three-dimensional image server, if three-dimensional image server successfully receives order; Be that client is received FM_EXECUTE_RESPONSE (FMMC_SUCCESS), if unsuccessful client is received FM_EXECUTE_RESPONSE (FMMC_FAIL).
The 3rd step: submit the flow data operation to, promptly client is sent binary data stream to three-dimensional image server.Because fill order is generally submitted the less parameter of data volume to, when client need be submitted to for the bulky grain data and define an order when three-dimensional image server submitted bigger binary data to specially.When client need be sent FM_PUT_FILE when three-dimensional server sends binary data; Simultaneously data content is bundled to service class; Be submitted to three-dimensional image server; If three-dimensional image server successfully receives order, promptly client is received FM_PUT_ FILE_RESPONSE (FMMC_SUCCESS), if unsuccessful client is received FM_PUT FILE_RESPONSE (FMMC_FAIL).
The 4th step: obtain the flow data operation, promptly client is to three-dimensional image server acquisition request data flow.Behind the various processing commands that client is submitted to; Three-dimensional image server is to handle with the mode of streamline; The data of handling return results the time by the each acquisition request data of client; At first client can be sent the request that FM_GET_STREAM obtains data, if there are the data of having finished dealing with can content be returned to client on the three-dimensional image server, client receives FM_GET_FILE_RESPONSE (FMMC_RETURN_PARAM); If result is not arranged, three-dimensional image server can return FM_GET_ FILE_RESPONSE (FMMC_SUCCESS).
The 5th step: discharge association, after the communication completion, both sides discharge connection this time through sending related release request FM_CONTROL (FMMC_DISCONNECT).
Like Fig. 2, Fig. 3, Fig. 4 and shown in Figure 5; Can find out according to top interactive mode and to send execution of command operations FM_EXECUTE, data submit operation FM_PUT_FILE, obtain between the data manipulation FM_GET_FILE not relation; How can several service class be connected? Because computing time of three-dimensional image server is slow than client submiting command the time; So can not wait for all at every turn that three-dimensional image server is finished dealing with and submit new request task again to behind the subcommand, like this get up promptness that will feel mutual of client operation is good inadequately.For fear of this problem; The present invention uses the method for continuous productive process; Between three-dimensional image server and client, set up two network channels simultaneously: command channel and data channel; The command channel is used for receiving the order that client is submitted to specially, and data channel is used for returning the result of three-dimensional image server specially, and command channel and data channel are used the pattern of asynchronous process.
Client user's exchange threads just can be submitted data to three-dimensional image server through the command channel interface of client in real time after command channel and data channel had been arranged; Three-dimensional image server is handled through the command channel task of receiving; Data content after will handling then returns to client through data channel, and notice user interactions layer showed after the client data passage received data.The aforesaid operations process is accomplished operation and the display effect that the user needs; Command channel and data channel fully independently are connected physically being two; The privately owned communication protocol of using also is identical;, client and three-dimensional image server can open this two interface channels simultaneously when connecting; How does three-dimensional image server discern which are these two passages? In order to discern two passages; Can send log-in command channel command and active user's accession designation number and be used for the marking command passage at the client success post command passage that connects, data channel can be sent data channel log-in command and user's accession designation number, has had unified Customs Assigned Number just can several objects effectively be connected with different log-in commands.
As shown in Figure 6; The realization of pipelining mainly is to be divided into six parts; Be respectively at client process in-process Client command passage processing threads, client data passage processing threads and user interactions thread, at server-side processes in-process server end command channel processing threads, server end data channel processing threads and task processing threads.The present invention disposes corresponding message queue for each processing threads; When carrying out between processing threads when mutual; Mission bit stream is stored in the corresponding message queue; Notify corresponding processing threads need carry out a task then, after processing threads receives notice, can operate accordingly to taking-up Processing tasks in the message queue.
In order to realize message queue, set up following data structure:
Set up the data buffer zone (FData) that to deposit 200 information according to this data structure structure, write down current location index (WriteIndex) and the formation that writes formation with two variablees then and read location index (ReadIndex)
When needs will be carried out following code when message queue writes data:
=WriteIndex) will jump out circulation, carry out the ProcessData function and carry out task processes:
Three-dimensional image server and client be through service class data packet delivery interactive command, at the head of service class packet communication information common headers data structure and parameter Data transmission structure is set.At first be the communication information common headers, its data structure is following:
Each service class packet beginning all is the such data structure of LMsgHeader; Flag is used for the legitimacy of identity protocol; The value of Type should be service class one of them, like FM_EXECUTE, MsgCode is the message definition code like FMMC_CONNECT; Error is an error code, is confirmed by concrete disposition.Parameter Data transmission structure is following:
Parameter Data transmission structure comprises three values; Be respectively Command: the transferring command value can be the data that client and three-dimensional image server are confirmed jointly, like loading data body order comLoadVolume; ParameterSize characterising parameter size; If be that parameter is not with in 0 this order of explanation, Accessory describes whether the band binary data is arranged, if data are not with in 0 explanation.The parameter value of message queue is the array of a VARIANT, and type has various ways, in order to improve reading property and flexibility, when communicating packing, all passes by certain format and changes the character visible string into.
Word string is content-defined: < type >=< content >; < type >=< content 1>| < content 2>| < content 3>| < content 4 >.
Instantiation
Like Fig. 7 and shown in Figure 8, at client and three-dimensional image server working procedure Test3DClient.exe and Test3DServer.exe respectively, the operation task that the former is used for responding the user with handle after display effect, the latter is used for centralized calculation.
According to the dicom standard definition, each inspection can be divided into a plurality of sequences, and each sequence can be divided into multiple image, and the data of three-dimensional visualization are made up of one group of two-dimensional ct image data of a sequence.Inspection, sequence, image have all defined unique UID sign in the standard the inside; Client notice three-dimensional image server is rebuild one group of two-dimensional sequence image; The present invention uses two-stage UID; Just client is sent inspection UID and sequence UID, and three-dimensional image server is opened data content according to these two index values.
For example: the good service IP of client configuration address: 192.168.141.82 at first; Port: 4450; In the connection behind the server; Inspection number input 1.2.840.113704.1.111.5600.1107858801.1, sequence number input 1.2.840.113704.1.111.5600.1107859570.17, point is opened knob
At first client can be opened two threads, is respectively command channel (SendCommandChannel) and data channel (ReadDataChannel):
Open?SendCommandChannel
Connect<IP:192.168.141.82Port:4450>
<--SEND?MESSAGE?HEADER(FM_CONTROL,FMMC_CONNECT)
-->RECEIVE?MESSAGE?HEADER(FM_CONTROL,FMMC_ACCEPT)
Open?ReadDataChannel
Connect<IP:192.168.141.82Port:4450>
<--SEND?MESSAGE?HEADER(FM_CONTROL,FMMC_CONNECT)
-->RECEIVE?MESSAGE?HEADER(FM_CONTROL,FMMC_ACCEPT)
The back client that connects can be sent active user's numbering to three-dimensional image server through the command channel:
<--SEND?MESSAGE?HEADER(FM_EXECUTE,FMMC_CONNECT)
<--SEND?FILE?PARAMETER
Command:comOpenObject
Accessory:0
Parameter:STRING=38942B2D56BB49
The while data channel also will be sent identical Customs Assigned Number and register:
<--SEND?MESSAGE?HEADER(FM_EXECUTE,FMMC_CONNECT)
<--SEND?FILE?PARAMETER
Command:comLoginObject
Accessory:0
Parameter:STRING=38942B2D56BB49
Three-dimensional image server is the command channel with this gap marker, as special reception command information after receiving the Customs Assigned Number and comOpenObject order that the command channel sends.After receiving the Customs Assigned Number and comLoginObject order that data channel sends, be data channel with this gap marker, as special return data.
Successful connection post command passage sends to three-dimensional image server and opens the data volume order:
<--SEND?MESSAGE?HEADER(FM_EXECUTE,FMMC_CONNECT,3V)
<--SEND?FILE?PARAMETER
Command:comOpenVolume
Accessory:0
Parameter:STRING=1.2.840.113704.1.111.5600.1107858801.1;STRING=1.2.840.113704.1.111.5600.1107859570.17;
-->RECEIVE?MESSAGE
HEADER(FM_EXECUTE_RESPONSE,FMMC_SUCCESS)
Client is sent the reading of data request through data channel simultaneously:
<--SEND?MESSAGE?HEADER(FM_GET_FILE,FMMC_CONNECT)
<--SEND?FILE?PARAMETER
Command:comGetImageData
Accessory:0
-->RECEIVE?MESSAGE?HEADER(FM_GET_FILE
_RESPONSE,FMMC_ACCEPT)
-->RECEIVE?FILE?PARAMETER
Command:comGetImageData
Accessory:0
Parameter:INTEGER=5512;INTEGER=985;INTEGER=512;INTEGER=512;INTE?GER=665;INTEGER=-2048;INTEGER=1;INTEGER=500;INTEGER=100;
CubeContainSize985
PixelSize?x:512,y:512,z:665
WindowWidth:500,WindowCenter:100
If three-dimensional image server is opened data volume success, at first some essential informations with data volume return to client, like the pixel size of the X of data volume, Y, Z, acquiescence window width window place value etc.
Client can repeat to send read data request to data channel after obtaining master data information:
<--SEND?MESSAGE?HEADER(FM_GET_FILE,FMMC_CONNECT)
<--SEND?FILE?PARAMETER
Command:comGetImageData
Accessory:0
Because the three-dimensional reconstruction data volume is generally all bigger, loading data needs certain hour, so three-dimensional image server should return the loading progress to client in real time in loading procedure:
-->RECEIVE?MESSAGE?HEADER(FM_GET_FILE
_RESPONSE,FMMC_ACCEPT)
-->RECEIVE?FILE?PARAMETER
Command:comGetImageData
Accessory:0
Parameter:INTEGER=5500;FLOAT=10.000000;
Progress:10%
The image that after data load is accomplished, will calculate the back generation is sent to client:
-->RECEIVE?MESSAGE
HEADER(FM_GET_FILE_RESPONSE,FMMC_ACCEPT)
-->RECEIVE?FILE?PARAMETER
Command:comGetImageData
Accessory:273016
Parameter:INTEGER=5515;INTEGER=0;SIZE=532|708;INTEGER=0;
-->RECEIVE?FILE?DATA
Data transmission period (millisecond): 0, size (byte): 273016
The data decode time (millisecond): 93, size (byte): 1129968
RGBImage?X:532,Y:708,Size:273016
Data load is after client, and client can show according to current display layout, and the loading procedure of three-dimensional data finishes.If the certain hour client is not sent task requests to three-dimensional image server; Three-dimensional image server can regularly return a null message to client, the existence between client and three-dimensional image server just can be known through certain heartbeat pattern by this method.After avoiding client to withdraw from unusually, the three-dimensional image server resource is the generation of occupied situation always:
<--SEND?MESSAGE?HEADER(FM_GET_FILE,FMMC_CONNECT)
<--SEND?FILE?PARAMETER
Command:comGetImageData
Accessory:0
-->RECEIVE?MESSAGE
HEADER(FM_GET_FILE_RESPONSE,FMMC_ACCEPT)
-->RECEIVE?FILE?PARAMETER
Command:comGetImageData
Accessory:0
Parameter:STRING=comReturnObjectEvent
Those skilled in the art do not break away from essence of the present invention and spirit; Can there be the various deformation scheme to realize the present invention; The above is merely the preferable feasible embodiment of the present invention; Be not so limit to interest field of the present invention, the equivalent structure that all utilizations specification of the present invention and accompanying drawing content are done changes, and all is contained within the interest field of the present invention.