@@ -36,7 +36,7 @@ public sealed record DicomFileStorageMetadata : FileStorageMetadata
36
36
/// Gets or set the Study Instance UID of the DICOM instance.
37
37
/// </summary>
38
38
[ JsonPropertyName ( "studyInstanceUid" ) ]
39
- public string StudyInstanceUid { get ; init ; } = default ! ;
39
+ public string StudyInstanceUid { get ; set ; } = default ! ;
40
40
41
41
/// <summary>
42
42
/// Gets or set the Series Instance UID of the DICOM instance.
@@ -93,6 +93,15 @@ public DicomFileStorageMetadata(string associationId, string identifier, string
93
93
StudyInstanceUid = studyInstanceUid ;
94
94
SeriesInstanceUid = seriesInstanceUid ;
95
95
SopInstanceUid = sopInstanceUid ;
96
+ SetupFilePaths ( associationId ) ;
97
+
98
+ DataOrigin . DataService = dataService ;
99
+ DataOrigin . Source = callingAeTitle ;
100
+ DataOrigin . Destination = calledAeTitle ;
101
+ }
102
+
103
+ private void SetupFilePaths ( string associationId )
104
+ {
96
105
File = new StorageObjectMetadata ( FileExtension )
97
106
{
98
107
TemporaryPath = string . Join ( PathSeparator , associationId , DataTypeDirectoryName , $ "{ Guid . NewGuid ( ) } { FileExtension } ") ,
@@ -106,16 +115,45 @@ public DicomFileStorageMetadata(string associationId, string identifier, string
106
115
UploadPath = $ "{ File . UploadPath } { DicomJsonFileExtension } ",
107
116
ContentType = DicomJsonContentType ,
108
117
} ;
118
+ }
109
119
110
- DataOrigin . DataService = dataService ;
111
- DataOrigin . Source = callingAeTitle ;
112
- DataOrigin . Destination = calledAeTitle ;
120
+ public void SetupGivenFilePaths ( string ? DestinationFolder )
121
+ {
122
+ if ( DestinationFolder is null )
123
+ {
124
+ return ;
125
+ }
126
+
127
+ if ( DestinationFolder . EndsWith ( '/' ) )
128
+ {
129
+ DestinationFolder = DestinationFolder . Remove ( DestinationFolder . Length - 1 ) ;
130
+ }
131
+
132
+ File = new StorageObjectMetadata ( FileExtension )
133
+ {
134
+ TemporaryPath = string . Join ( PathSeparator , DestinationFolder , $ "Temp{ PathSeparator } { Guid . NewGuid ( ) } { FileExtension } ") ,
135
+ UploadPath = string . Join ( PathSeparator , DestinationFolder , $ "{ SopInstanceUid } { FileExtension } ") ,
136
+ ContentType = DicomContentType ,
137
+ DestinationFolderOverride = true ,
138
+ } ;
139
+
140
+ JsonFile = new StorageObjectMetadata ( DicomJsonFileExtension )
141
+ {
142
+ TemporaryPath = $ "{ File . TemporaryPath } { DicomJsonFileExtension } ",
143
+ UploadPath = $ "{ File . UploadPath } { DicomJsonFileExtension } ",
144
+ ContentType = DicomJsonContentType ,
145
+ DestinationFolderOverride = true ,
146
+ } ;
147
+
148
+ //DestinationFolderNeil = DestinationFolder;
113
149
}
114
150
151
+ public void SetStudyInstanceUid ( string newStudyInstanceUid ) => StudyInstanceUid = newStudyInstanceUid ;
152
+
115
153
public override void SetFailed ( )
116
154
{
117
155
base . SetFailed ( ) ;
118
156
JsonFile . SetFailed ( ) ;
119
157
}
120
158
}
121
- }
159
+ }
0 commit comments